Changeset 0c6b92a for imaps-frontend/node_modules/konva/lib/Context.js
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/konva/lib/Context.js
rd565449 r0c6b92a 5 5 const Global_1 = require("./Global"); 6 6 function simplifyArray(arr) { 7 varretArr = [], len = arr.length, util = Util_1.Util, n, val;7 let retArr = [], len = arr.length, util = Util_1.Util, n, val; 8 8 for (n = 0; n < len; n++) { 9 9 val = arr[n]; … … 18 18 return retArr; 19 19 } 20 varCOMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()', EQUALS = '=', CONTEXT_METHODS = [20 const COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()', EQUALS = '=', CONTEXT_METHODS = [ 21 21 'arc', 22 22 'arcTo', … … 52 52 'translate', 53 53 ]; 54 varCONTEXT_PROPERTIES = [54 const CONTEXT_PROPERTIES = [ 55 55 'fillStyle', 56 56 'strokeStyle', … … 107 107 } 108 108 getTrace(relaxed, rounded) { 109 vartraceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args;109 let traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args; 110 110 for (n = 0; n < len; n++) { 111 111 trace = traceArr[n]; … … 143 143 } 144 144 _trace(str) { 145 vartraceArr = this.traceArr, len;145 let traceArr = this.traceArr, len; 146 146 traceArr.push(str); 147 147 len = traceArr.length; … … 151 151 } 152 152 reset() { 153 varpixelRatio = this.getCanvas().getPixelRatio();153 const pixelRatio = this.getCanvas().getPixelRatio(); 154 154 this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0); 155 155 } … … 158 158 } 159 159 clear(bounds) { 160 varcanvas = this.getCanvas();160 const canvas = this.getCanvas(); 161 161 if (bounds) { 162 162 this.clearRect(bounds.x || 0, bounds.y || 0, bounds.width || 0, bounds.height || 0); … … 173 173 } 174 174 _applyOpacity(shape) { 175 varabsOpacity = shape.getAbsoluteOpacity();175 const absOpacity = shape.getAbsoluteOpacity(); 176 176 if (absOpacity !== 1) { 177 177 this.setAttr('globalAlpha', absOpacity); … … 209 209 } 210 210 createImageData(width, height) { 211 vara = arguments;211 const a = arguments; 212 212 if (a.length === 2) { 213 213 return this._context.createImageData(width, height); … … 227 227 } 228 228 drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) { 229 vara = arguments, _context = this._context;229 const a = arguments, _context = this._context; 230 230 if (a.length === 3) { 231 231 _context.drawImage(image, sx, sy); … … 335 335 } 336 336 _enableTrace() { 337 varthat = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;338 varfunc = function (methodName) {339 varorigMethod = that[methodName], ret;337 let that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args; 338 const func = function (methodName) { 339 let origMethod = that[methodName], ret; 340 340 that[methodName] = function () { 341 341 args = simplifyArray(Array.prototype.slice.call(arguments, 0)); … … 353 353 that.setAttr = function () { 354 354 origSetter.apply(that, arguments); 355 varprop = arguments[0];356 varval = arguments[1];355 const prop = arguments[0]; 356 let val = arguments[1]; 357 357 if (prop === 'shadowOffsetX' || 358 358 prop === 'shadowOffsetY' || … … 368 368 _applyGlobalCompositeOperation(node) { 369 369 const op = node.attrs.globalCompositeOperation; 370 vardef = !op || op === 'source-over';370 const def = !op || op === 'source-over'; 371 371 if (!def) { 372 372 this.setAttr('globalCompositeOperation', op); … … 393 393 } 394 394 _fillColor(shape) { 395 varfill = shape.fill();395 const fill = shape.fill(); 396 396 this.setAttr('fillStyle', fill); 397 397 shape._fillFunc(this); … … 402 402 } 403 403 _fillLinearGradient(shape) { 404 vargrd = shape._getLinearGradient();404 const grd = shape._getLinearGradient(); 405 405 if (grd) { 406 406 this.setAttr('fillStyle', grd); … … 452 452 const start = shape.getStrokeLinearGradientStartPoint(), end = shape.getStrokeLinearGradientEndPoint(), colorStops = shape.getStrokeLinearGradientColorStops(), grd = this.createLinearGradient(start.x, start.y, end.x, end.y); 453 453 if (colorStops) { 454 for ( varn = 0; n < colorStops.length; n += 2) {454 for (let n = 0; n < colorStops.length; n += 2) { 455 455 grd.addColorStop(colorStops[n], colorStops[n + 1]); 456 456 } … … 459 459 } 460 460 _stroke(shape) { 461 vardash = shape.dash(), strokeScaleEnabled = shape.getStrokeScaleEnabled();461 const dash = shape.dash(), strokeScaleEnabled = shape.getStrokeScaleEnabled(); 462 462 if (shape.hasStroke()) { 463 463 if (!strokeScaleEnabled) { 464 464 this.save(); 465 varpixelRatio = this.getCanvas().getPixelRatio();465 const pixelRatio = this.getCanvas().getPixelRatio(); 466 466 this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); 467 467 } … … 475 475 this.setAttr('shadowColor', 'rgba(0,0,0,0)'); 476 476 } 477 varhasLinearGradient = shape.getStrokeLinearGradientColorStops();477 const hasLinearGradient = shape.getStrokeLinearGradientColorStops(); 478 478 if (hasLinearGradient) { 479 479 this._strokeLinearGradient(shape); … … 490 490 _applyShadow(shape) { 491 491 var _a, _b, _c; 492 varcolor = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {492 const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : { 493 493 x: 0, 494 494 y: 0, … … 524 524 if (!strokeScaleEnabled) { 525 525 this.save(); 526 varpixelRatio = this.getCanvas().getPixelRatio();526 const pixelRatio = this.getCanvas().getPixelRatio(); 527 527 this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); 528 528 } 529 529 this._applyLineCap(shape); 530 varhitStrokeWidth = shape.hitStrokeWidth();531 varstrokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth;530 const hitStrokeWidth = shape.hitStrokeWidth(); 531 const strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth; 532 532 this.setAttr('lineWidth', strokeWidth); 533 533 this.setAttr('strokeStyle', shape.colorKey);
Note:
See TracChangeset
for help on using the changeset viewer.