Skip to content

Commit

Permalink
Build Project
Browse files Browse the repository at this point in the history
  • Loading branch information
berviantoleo committed Nov 28, 2020
1 parent 9e56624 commit f126b73
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/react-multi-crop/dist/ReactMultiCrop/ReactMultiCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,38 @@ var ReactMultiCrop = /*#__PURE__*/function (_Component) {
}, setOutput);
}
}
}, {
key: "zoom",
value: function zoom(options) {
var canvas = this.state.canvas;

if (!canvas) {
return;
}

var delta = options.e.deltaY;
var zoom = canvas.getZoom();
zoom *= Math.pow(0.999, delta);
if (zoom > 20) zoom = 20;
if (zoom < 0.01) zoom = 0.01;
canvas.setZoom(zoom);
options.e.preventDefault();
options.e.stopPropagation();
this.setState({
canvas: canvas
});
}
}, {
key: "initialCanvas",
value: function initialCanvas() {
var canvas = new _fabric.fabric.Canvas(this.props.id);
canvas.uniScaleTransform = true;
var doubleClickEvent = this.doubleClickEvent.bind(this);
var objectModifiedEvent = this.setOutput.bind(this);
var zoomHandler = this.zoom.bind(this);
canvas.on("mouse:dblclick", doubleClickEvent);
canvas.on("object:modified", objectModifiedEvent);
canvas.on("mouse:wheel", zoomHandler);
var initialImg = this.initialImage.bind(this);
this.setState({
canvas: canvas
Expand Down

0 comments on commit f126b73

Please sign in to comment.