Releases: zhanziyang/vue-croppa
v1.1.3
- Fixing a serious bug:
promisedBlob()
's arguments were not applied correctly, which resulted in compression not working.
v1.1.2
v1.1.1
v1.1.0: Add Loading Support
Change Log:
-
New props:
show-loading
,loading-size
,loading-color
to show/hide/style the built-in spinner at the bottom right corner that will show up only when a image is loading (will but not yet drawn on canvas). -
New events:
loading-start
,loading-end
-
Unnamed (default) slots now will be appended to the
.croppa-container
instead of being ignored. Usually you need to setposition: absolute
on these slots or it will expand the container. It can be useful to make a custom loading if you find the built-in loading not fancy enough. -
New boolean type state data
loading
indicates whether an image is loading. -
Bundle size has increased by 3kb.
v1.0.5
Change Log:
- Add a new data field
currentIsInitial
to differentiate between initial image and non-initial image. You can now check if the current image is initial image like this:
this.myCroppa.currentIsInitial // true or false
- Fix a few bugs where
prevent-white-space
fails in various situations.
v1.0.4
v1.0.3
v1.0.2
Change Log:
- Fixing prop validation of the
quality
prop. It doesn't need to be an integer (a stupid mistake).
v1.0.1
Change Log:
- Fixing some bugs from the last release:
applyMetadata()
wrong position bug.- Wrong apect ratio after rotating.
v1.0.0
Change Log:
- BIG CHANGE! Now the instance is the component itself and the methods we can use are simply the methods of the component. This means that for a template like this,
<croppa ref="croppa" v-model="myCroppa"></croppa>
<!-- note that "myCroppa" and "croppa" are just examples,
you can give them other names. -->
we have the v-model
ed value and the ref
point to the same thing.
this.$refs.croppa === this.myCroppa // true
and we can now access the component state data via the "v-model
ed" value:
this.myCroppa.outputWidth
this.myCroppa.dragging
this.myCroppa.imgData
this.myCroppa.naturalHeight
this.myCroppa.scaleRatio
this.myCroppa.originalImage
this.myCroppa.canvas
this.myCroppa.ctx
// ... checkout vue devtool to see more
and the same methods that are used to called by the v-model
ed (this.myCroppa
) can also be called by the ref
(this.$refs.croppa
).
var croppa = this.$refs.croppa
croppa.chooseFile()
croppa.remove()
croppa.generateDataUrl()
croppa.generateDataUrl()
croppa.getMetadata()
// ...
which also means that we don't even need the v-model
ed value anymore. Just use the ref
, it feels more natural for me. But it's just a matter of preference.
scaleRatio
is now reactive. Changing it will cause zooming. It's useful if you want to make a zooming slider. (#28)
this.myCroppa.scaleRatio += 0.001 // zooming in
-
New event:
@new-image-drawn
emitted when a new image is drawn on canvas for the first time. (#30) -
BREAKING CHANGE:
accept
's default value is now removed due to its incompatibility in different browsers. Please specify it as you need. Now, by default the users can choose a non-image file but nothing will happen. -
New prop:
:input-attrs
to pass attributes to the hiddeninput[type=file]
element.
<croppa :input-attrs="{capture: true, class: 'file-input'}"></croppa>
-
New methods:
move()
andzoom()
are now exposed for more flexibility. -
Deprecated:
getActualImageSize()
is now deprecated. Usethis.myCroppa.outputWidth
andthis.myCroppa.outputHeight
instead. -
Fixing a few bugs. (including #29)
Edit: There is a new bug in this release with applyMetadata()
which will be fixed in the next release.