1.4.5 • Published 5 years ago

vueshapeimg v1.4.5

Weekly downloads
56
License
MIT
Repository
-
Last release
5 years ago

vueShapeImg

install size Codacy Badge

Picture clipping component made with vue. vue编写的图片裁剪组件

If you like, please give me a star (๑•̀ㅂ•́)و✧

如果你喜欢它,可以给我星星吗 (๑•̀ㅂ•́)و✧

Demonstration

English 中文文档

OnlineDemo

How to use

import vueShapeImg from 'vueshapeimg'
Vue.use(vueShapeImg)

<vue-shape-img></vue-shape-img>

vueShapeImg API Doc

props

ParametersDescriptionTypeOptional valuesDefault value
useFrameClipping pictures using marquee boxesBooleanYfalse
canResizeFrameWhether the box can be scaled and movedBooleanYtrue
initRangeLeft,Top,Width and Height of box initializationArrayY[width*0.25,height*0.25,width*0.5,height*0.5]
height-NumberY500
width-NumberY500
timelyGetRangeTimely get user's select rangeBooleanYfalse
timelyImageDataTimely converting pictures that capture the user's range of choice into imageDataBooleanYfalse
aspectRatioKeeping aspect ratio scaling clipping frameBooleanYfalse
disableResizeForbidding scaling clipping frameBooleanYfalse
tips: You can't use imageData directly,show it in canvas putImageData

methods

Method nameDescriptionParameters
rotateRotate the picture on canvasdeg(Arbitrary integer)
setImgSrcUse network picture. Pictures with different domain names are best not to be usedimgSrc(Picture links or Base64 files)
fileClickUse local picture-
showMaskOpen the mask layer, select the area-
closeMaskClose the mask layer-
getRangeGet the scope of user selection-
setRangeSet the scope of user selection[left,top,width,height]
getImgGet pictures of the range selected by the usertype('base64'/'blob'), imgType('image/jpeg' Or other image types),encoderOptions(0.00 - 1.00)
tips: getImg -> imgType -> 'image/jpeg' can compress pictures better

emit

emit nameDescription
imageDataChangeif props timelyImageData is true, this emit can return the imageData in timely
rangeChangeif props timelyGetRange is true, this emit can return the range in timely
errorerror tips: -1(Picture format error), -2(Picture loading failed), -3(Pictures are cross-domain resources)
tips: You can not use imageData directly,show it in canvas putImageData

Example OnlineDemo

Browser support

IE10+, chrome, firefox or other modern Browser

Upgraded content

1.4.5 (2019-6-26 15:16:00)

Added the function of keeping aspect ratio scaling clipping frame and forbidding scaling clipping frame.

1.4.3 (2019-6-24 17:30:44)

Repairing drag problem in clipping frame zooming

1.4.1 (2019-5-24 09:41:00)

Fixed the problem of dragging the whole canvas when the mouseup event was triggered on the clipping box when moving the picture in the frame mode in IE browser.

1.3.4 (2019-5-15 15:17:51)

Limit the range of input parameters of setRange function

1.3.2 (2019-5-15 11:23:55)

Fixed the problem of calling the rotate function picture to return to the center of the canvas after moving the picture in frame mode

more version info

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago