# Migration to 1.0
On one hand I wish to minimize breaking-changes in this release, on the other hand, due to beta-testing, I realize that many aspects of the library should be updated. The library has grown much larger and more difficult to maintain, as a result breaking-changes are inevitable.
The goal of this guide is to facilitate the migration of the library to the newer versions.
# Installation
# Styles
Styles are no longer automatically injected. You should import the styles directly.
# Using Bundler
import { Cropper } from 'vue-advanced-cropper';
// Add the following line to import the cropper styles
import 'vue-advanced-cropper/dist/style.css';
# Using CDN
<script src="https://unpkg.com/vue-advanced-cropper@^1.0.0/dist/index.umd.js" />
<!-- Add the following line to import the cropper styles -->
<link rel="stylesheet" href="https://unpkg.com/vue-advanced-cropper@^1.0.0/dist/style.css" />
# Changed the markup of cropper
Background is limited by the cropper boundary now. If you set the
background-colorin thebackground-classit won't fill the entire cropper, it will fill only the area that fits in the cropper boundary. The entire cropper could be wider or taller than its boundary. To set the background for the entire cropper set thebackground-colorin theclassattribute now.The foreground layer has been added. to customize it use
foreground-class. It layers over the background and the image to darken it and sits below the stencil.
# Changed the defaults
The default setting for
default-boundariesis'fill'now (previously'fit'). It seems to be a more appropriate setting for the majority of the available croppers.The default setting for
image-restrictionisfit-areanow (previously'fill-area')The default setting for
size-restrictions-algorithmhas been changed:minWidth,minHeight,maxWidthandmaxHeightset the limitations in pixels now (previously limitations were set in percentages).The default setting of
resizeImagehas been changed. NowadjustStencilis enabled by default.
# Changed props
Replaced
wheelResize,touchResize,touchMove,mouseMoveprops withresizeImageandmoveImageprops.Renamed
classname,areaClassname,backgroundClassname,imageClassname,linesClassnamesandclassnamestoclass,boundariesClass,backgroundClass,imageClass,linesClassesandclassesrespectively.Renamed
lineComponent,handlerComponenttolinesComponent,handlersComponentRenamed
restrictionstosize-restrictions-algorithmThe priority prop now accepts
'visible-area'instead of'visibleArea'.The
RectangleStencil,CircleStencilandBoundingBoxpropscalablewere renamed toresizable.
# Changed methods
- The callback in
setCoordinatesmethod now should accept only one argument: an object with propertiescoordinates,imageSizeandvisibleArea.
this.$refs.cropper.setCoordinates(({ coordinates, imageSize, visibleArea}) => {
return {
width: visibleArea.width,
height: visibleArea.height
}
})