Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onCanvasMouseUp: function (event) {
- var me = this;
- this.isDown = false;
- me.mouseDown = null;
- var canvas = this.canvas;
- var ctx = canvas.getContext("2d");
- if (this.cropMode) {
- if (this.rectangle.height > 2) {
- var canvasHeight = this.firstCrop && this.zoomConfig.initialHeight > canvas.height ? this.zoomConfig.initialHeight : canvas.height;
- var canvasWidth = this.firstCrop && this.zoomConfig.initialWidth > canvas.width ? this.zoomConfig.initialWidth : canvas.width;
- var zoomLevel = canvas.getZoom();
- canvasHeight = canvasHeight * zoomLevel;
- canvasWidth = canvasWidth * zoomLevel;
- ctx.globalAlpha = .50;
- ctx.fillStyle = "black";
- ctx.fillRect(0, 0, canvasWidth, canvasHeight);
- ctx.restore();
- ctx.save();
- ctx.beginPath();
- var left = this.rectangle.left * zoomLevel,
- top = this.rectangle.top * zoomLevel,
- width = this.rectangle.width * zoomLevel,
- height = this.rectangle.height * zoomLevel;
- ctx.clearRect(left, top, width, height);
- ctx.globalAlpha = 1;
- ctx.rect(left, top, width, height);
- ctx.clip();
- ctx.drawImage(canvas.backgroundImage._element, 0, 0, canvasWidth, canvasHeight);
- ctx.restore();
- this.updateCanvasState();
- this.firstCrop = false;
- } else {
- this.removeCropMode();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement