Changeset 0c6b92a for imaps-frontend/node_modules/konva/lib/Shape.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/Shape.js
rd565449 r0c6b92a 9 9 const Global_2 = require("./Global"); 10 10 const PointerEvents = require("./PointerEvents"); 11 varHAS_SHADOW = 'hasShadow';12 varSHADOW_RGBA = 'shadowRGBA';13 varpatternImage = 'patternImage';14 varlinearGradient = 'linearGradient';15 varradialGradient = 'radialGradient';11 const HAS_SHADOW = 'hasShadow'; 12 const SHADOW_RGBA = 'shadowRGBA'; 13 const patternImage = 'patternImage'; 14 const linearGradient = 'linearGradient'; 15 const radialGradient = 'radialGradient'; 16 16 let dummyContext; 17 17 function getDummyContext() { … … 105 105 __getFillPattern() { 106 106 if (this.fillPatternImage()) { 107 varctx = getDummyContext();107 const ctx = getDummyContext(); 108 108 const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat'); 109 109 if (pattern && pattern.setTransform) { … … 133 133 } 134 134 __getLinearGradient() { 135 varcolorStops = this.fillLinearGradientColorStops();135 const colorStops = this.fillLinearGradientColorStops(); 136 136 if (colorStops) { 137 varctx = getDummyContext();138 varstart = this.fillLinearGradientStartPoint();139 varend = this.fillLinearGradientEndPoint();140 vargrd = ctx.createLinearGradient(start.x, start.y, end.x, end.y);141 for ( varn = 0; n < colorStops.length; n += 2) {137 const ctx = getDummyContext(); 138 const start = this.fillLinearGradientStartPoint(); 139 const end = this.fillLinearGradientEndPoint(); 140 const grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y); 141 for (let n = 0; n < colorStops.length; n += 2) { 142 142 grd.addColorStop(colorStops[n], colorStops[n + 1]); 143 143 } … … 149 149 } 150 150 __getRadialGradient() { 151 varcolorStops = this.fillRadialGradientColorStops();151 const colorStops = this.fillRadialGradientColorStops(); 152 152 if (colorStops) { 153 varctx = getDummyContext();154 varstart = this.fillRadialGradientStartPoint();155 varend = this.fillRadialGradientEndPoint();156 vargrd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius());157 for ( varn = 0; n < colorStops.length; n += 2) {153 const ctx = getDummyContext(); 154 const start = this.fillRadialGradientStartPoint(); 155 const end = this.fillRadialGradientEndPoint(); 156 const grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius()); 157 for (let n = 0; n < colorStops.length; n += 2) { 158 158 grd.addColorStop(colorStops[n], colorStops[n + 1]); 159 159 } … … 168 168 return; 169 169 } 170 varrgba = Util_1.Util.colorToRGBA(this.shadowColor());170 const rgba = Util_1.Util.colorToRGBA(this.shadowColor()); 171 171 if (rgba) { 172 172 return ('rgba(' + … … 216 216 } 217 217 intersects(point) { 218 varstage = this.getStage();218 const stage = this.getStage(); 219 219 if (!stage) { 220 220 return false; … … 269 269 } 270 270 getSelfRect() { 271 varsize = this.size();271 const size = this.size(); 272 272 return { 273 273 x: this._centroid ? -size.width / 2 : 0, … … 318 318 } 319 319 drawScene(can, top, bufferCanvas) { 320 varlayer = this.getLayer();321 varcanvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext;322 varskipBuffer = canvas.isCache;323 varcachingSelf = top === this;320 const layer = this.getLayer(); 321 let canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext; 322 const skipBuffer = canvas.isCache; 323 const cachingSelf = top === this; 324 324 if (!this.isVisible() && !cachingSelf) { 325 325 return this; … … 327 327 if (cachedCanvas) { 328 328 context.save(); 329 varm = this.getAbsoluteTransform(top).getMatrix();329 const m = this.getAbsoluteTransform(top).getMatrix(); 330 330 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 331 331 this._drawCachedSceneCanvas(context); … … 348 348 drawFunc.call(this, bufferContext, this); 349 349 bufferContext.restore(); 350 varratio = bc.pixelRatio;350 const ratio = bc.pixelRatio; 351 351 if (hasShadow) { 352 352 context._applyShadow(this); … … 376 376 return this; 377 377 } 378 varlayer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;378 const layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit; 379 379 if (!this.colorKey) { 380 380 Util_1.Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()'); … … 382 382 if (cachedHitCanvas) { 383 383 context.save(); 384 varm = this.getAbsoluteTransform(top).getMatrix();384 const m = this.getAbsoluteTransform(top).getMatrix(); 385 385 context.transform(m[0], m[1], m[2], m[3], m[4], m[5]); 386 386 this._drawCachedHitCanvas(context); … … 395 395 const selfCache = this === top; 396 396 if (!selfCache) { 397 varo = this.getAbsoluteTransform(top).getMatrix();397 const o = this.getAbsoluteTransform(top).getMatrix(); 398 398 context.transform(o[0], o[1], o[2], o[3], o[4], o[5]); 399 399 } … … 403 403 } 404 404 drawHitFromCache(alphaThreshold = 0) { 405 varcachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;405 let cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha; 406 406 hitContext.clear(); 407 407 hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth, hitHeight);
Note:
See TracChangeset
for help on using the changeset viewer.