SHARE
TWEET

Untitled

a guest Jul 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onCanvasMouseUp: function (event) {
  2.     var me = this;
  3.     this.isDown = false;
  4.     me.mouseDown = null;
  5.     var canvas = this.canvas;
  6.     var ctx = canvas.getContext("2d");
  7.     if (this.cropMode) {
  8.         if (this.rectangle.height > 2) {
  9.             var canvasHeight = this.firstCrop && this.zoomConfig.initialHeight > canvas.height ? this.zoomConfig.initialHeight : canvas.height;
  10.             var canvasWidth = this.firstCrop && this.zoomConfig.initialWidth > canvas.width ? this.zoomConfig.initialWidth : canvas.width;
  11.             var zoomLevel = canvas.getZoom();
  12.             canvasHeight = canvasHeight * zoomLevel;
  13.             canvasWidth = canvasWidth * zoomLevel;
  14.             ctx.globalAlpha = .50;
  15.             ctx.fillStyle = "black";
  16.             ctx.fillRect(0, 0, canvasWidth, canvasHeight);
  17.             ctx.restore();
  18.             ctx.save();
  19.             ctx.beginPath();
  20.             var left = this.rectangle.left * zoomLevel,
  21.                 top = this.rectangle.top * zoomLevel,
  22.                 width = this.rectangle.width * zoomLevel,
  23.                 height = this.rectangle.height * zoomLevel;
  24.             ctx.clearRect(left, top, width, height);
  25.             ctx.globalAlpha = 1;
  26.             ctx.rect(left, top, width, height);
  27.             ctx.clip();
  28.             ctx.drawImage(canvas.backgroundImage._element, 0, 0, canvasWidth, canvasHeight);
  29.             ctx.restore();
  30.             this.updateCanvasState();
  31.             this.firstCrop = false;
  32.         } else {
  33.             this.removeCropMode();
  34.         }
  35.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top