Skip to content

v1.2.0

Compare
Choose a tag to compare
@zhanziyang zhanziyang released this 28 Jan 01:11
· 49 commits to master since this release
b404725

Change Log:

  • New prop: passive
    (1.2.0) Switch to passive mode. Croppa in passive mode will sync state with another croppa if they v-model the same object. Also it will not have self-control - user can't manipulate image on passive croppa. This is useful as a preview component.

    These states will be synced:

    ['imgData', 'img', 'imgSet', 'originalImage', 'naturalHeight', 'naturalWidth', 'orientation', 'scaleRatio']

    Fix #68
    Demo

  • New prop: image-border-radius
    (1.2.0) Set rounded corders to image. Note that this has effect on the output image.

    Fix #67
    Demo

  • New method addClipPlugin(func) to add clip plugin to clip the image. Example:

    // Add a clip plugin to make a circle clip on image
    onInit(vm) {
      this.croppa.addClipPlugin(function (ctx, x, y, w, h) {
        /*
         * ctx: canvas context
         * x: start point (top-left corner) x coordination
         * y: start point (top-left corner) y coordination
         * w: croppa width
         * h: croppa height
        */
        ctx.beginPath()
        ctx.arc(x + w / 2, y + h / 2, w / 2, 0, 2 * Math.PI, true)
        ctx.closePath()
      })
    },

    Demo