Changeset 0c6b92a for imaps-frontend/node_modules/konva/lib/Canvas.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/Canvas.js
rd565449 r0c6b92a 7 7 const Factory_1 = require("./Factory"); 8 8 const Validators_1 = require("./Validators"); 9 var_pixelRatio;9 let _pixelRatio; 10 10 function getDevicePixelRatio() { 11 11 if (_pixelRatio) { 12 12 return _pixelRatio; 13 13 } 14 varcanvas = Util_1.Util.createCanvasElement();15 varcontext = canvas.getContext('2d');14 const canvas = Util_1.Util.createCanvasElement(); 15 const context = canvas.getContext('2d'); 16 16 _pixelRatio = (function () { 17 vardevicePixelRatio = Global_1.Konva._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio ||17 const devicePixelRatio = Global_1.Konva._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio || 18 18 context.mozBackingStorePixelRatio || 19 19 context.msBackingStorePixelRatio || … … 32 32 this.height = 0; 33 33 this.isCache = false; 34 varconf = config || {};35 varpixelRatio = conf.pixelRatio || Global_1.Konva.pixelRatio || getDevicePixelRatio();34 const conf = config || {}; 35 const pixelRatio = conf.pixelRatio || Global_1.Konva.pixelRatio || getDevicePixelRatio(); 36 36 this.pixelRatio = pixelRatio; 37 37 this._canvas = Util_1.Util.createCanvasElement(); … … 51 51 } 52 52 setPixelRatio(pixelRatio) { 53 varpreviousRatio = this.pixelRatio;53 const previousRatio = this.pixelRatio; 54 54 this.pixelRatio = pixelRatio; 55 55 this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio); … … 58 58 this.width = this._canvas.width = width * this.pixelRatio; 59 59 this._canvas.style.width = width + 'px'; 60 varpixelRatio = this.pixelRatio, _context = this.getContext()._context;60 const pixelRatio = this.pixelRatio, _context = this.getContext()._context; 61 61 _context.scale(pixelRatio, pixelRatio); 62 62 } … … 64 64 this.height = this._canvas.height = height * this.pixelRatio; 65 65 this._canvas.style.height = height + 'px'; 66 varpixelRatio = this.pixelRatio, _context = this.getContext()._context;66 const pixelRatio = this.pixelRatio, _context = this.getContext()._context; 67 67 _context.scale(pixelRatio, pixelRatio); 68 68 }
Note:
See TracChangeset
for help on using the changeset viewer.