Changeset 0c6b92a for imaps-frontend/node_modules/konva/lib/shapes
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- Location:
- imaps-frontend/node_modules/konva/lib/shapes
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/konva/lib/shapes/Arc.js
rd565449 r0c6b92a 9 9 class Arc extends Shape_1.Shape { 10 10 _sceneFunc(context) { 11 varangle = Global_1.Konva.getAngle(this.angle()), clockwise = this.clockwise();11 const angle = Global_1.Konva.getAngle(this.angle()), clockwise = this.clockwise(); 12 12 context.beginPath(); 13 13 context.arc(0, 0, this.outerRadius(), 0, angle, clockwise); -
imaps-frontend/node_modules/konva/lib/shapes/Arrow.js
rd565449 r0c6b92a 10 10 _sceneFunc(ctx) { 11 11 super._sceneFunc(ctx); 12 varPI2 = Math.PI * 2;13 varpoints = this.points();14 vartp = points;15 varfromTension = this.tension() !== 0 && points.length > 4;12 const PI2 = Math.PI * 2; 13 const points = this.points(); 14 let tp = points; 15 const fromTension = this.tension() !== 0 && points.length > 4; 16 16 if (fromTension) { 17 17 tp = this.getTensionPoints(); 18 18 } 19 varlength = this.pointerLength();20 varn = points.length;21 vardx, dy;19 const length = this.pointerLength(); 20 const n = points.length; 21 let dx, dy; 22 22 if (fromTension) { 23 23 const lp = [ … … 38 38 dy = points[n - 1] - points[n - 3]; 39 39 } 40 varradians = (Math.atan2(dy, dx) + PI2) % PI2;41 varwidth = this.pointerWidth();40 const radians = (Math.atan2(dy, dx) + PI2) % PI2; 41 const width = this.pointerWidth(); 42 42 if (this.pointerAtEnding()) { 43 43 ctx.save(); … … 74 74 } 75 75 __fillStroke(ctx) { 76 varisDashEnabled = this.dashEnabled();76 const isDashEnabled = this.dashEnabled(); 77 77 if (isDashEnabled) { 78 78 this.attrs.dashEnabled = false; -
imaps-frontend/node_modules/konva/lib/shapes/Ellipse.js
rd565449 r0c6b92a 8 8 class Ellipse extends Shape_1.Shape { 9 9 _sceneFunc(context) { 10 varrx = this.radiusX(), ry = this.radiusY();10 const rx = this.radiusX(), ry = this.radiusY(); 11 11 context.beginPath(); 12 12 context.save(); -
imaps-frontend/node_modules/konva/lib/shapes/Image.js
rd565449 r0c6b92a 79 79 } 80 80 _hitFunc(context) { 81 varwidth = this.width(), height = this.height(), cornerRadius = this.cornerRadius();81 const width = this.width(), height = this.height(), cornerRadius = this.cornerRadius(); 82 82 context.beginPath(); 83 83 if (!cornerRadius) { … … 99 99 } 100 100 static fromURL(url, callback, onError = null) { 101 varimg = Util_1.Util.createImageElement();101 const img = Util_1.Util.createImageElement(); 102 102 img.onload = function () { 103 varimage = new Image({103 const image = new Image({ 104 104 image: img, 105 105 }); -
imaps-frontend/node_modules/konva/lib/shapes/Label.d.ts
rd565449 r0c6b92a 30 30 height: number; 31 31 }; 32 pointerDirection: GetSet<'left' | 'top' | 'right' | 'bottom' , this>;32 pointerDirection: GetSet<'left' | 'top' | 'right' | 'bottom' | 'up' | 'down', this>; 33 33 pointerWidth: GetSet<number, this>; 34 34 pointerHeight: GetSet<number, this>; -
imaps-frontend/node_modules/konva/lib/shapes/Label.js
rd565449 r0c6b92a 7 7 const Validators_1 = require("../Validators"); 8 8 const Global_1 = require("../Global"); 9 varATTR_CHANGE_LIST = [9 const ATTR_CHANGE_LIST = [ 10 10 'fontFamily', 11 11 'fontSize', … … 35 35 } 36 36 _addListeners(text) { 37 varthat = this, n;38 varfunc = function () {37 let that = this, n; 38 const func = function () { 39 39 that._sync(); 40 40 }; … … 50 50 } 51 51 _sync() { 52 vartext = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight;52 let text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight; 53 53 if (text && tag) { 54 54 width = text.width(); … … 95 95 class Tag extends Shape_1.Shape { 96 96 _sceneFunc(context) { 97 varwidth = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();97 const width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius(); 98 98 let topLeft = 0; 99 99 let topRight = 0; … … 147 147 } 148 148 getSelfRect() { 149 varx = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height();149 let x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height(); 150 150 if (direction === UP) { 151 151 y -= pointerHeight; -
imaps-frontend/node_modules/konva/lib/shapes/Line.d.ts
rd565449 r0c6b92a 1 1 import { Shape, ShapeConfig } from '../Shape.js'; 2 import { Context } from '../Context.js'; 2 3 import { GetSet } from '../types.js'; 3 import { Context } from '../Context.js';4 4 export interface LineConfig extends ShapeConfig { 5 5 points?: number[] | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; -
imaps-frontend/node_modules/konva/lib/shapes/Line.js
rd565449 r0c6b92a 3 3 exports.Line = void 0; 4 4 const Factory_1 = require("../Factory"); 5 const Global_1 = require("../Global"); 5 6 const Shape_1 = require("../Shape"); 6 7 const Validators_1 = require("../Validators"); 7 const Global_1 = require("../Global");8 8 function getControlPoints(x0, y0, x1, y1, x2, y2, t) { 9 vard01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);9 const d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0); 10 10 return [p1x, p1y, p2x, p2y]; 11 11 } 12 12 function expandPoints(p, tension) { 13 var len = p.length, allPoints = [], n, cp;14 for ( n = 2; n < len - 2; n += 2) {15 c p = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension);13 const len = p.length, allPoints = []; 14 for (let n = 2; n < len - 2; n += 2) { 15 const cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension); 16 16 if (isNaN(cp[0])) { 17 17 continue; … … 34 34 } 35 35 _sceneFunc(context) { 36 varpoints = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n;36 let points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n; 37 37 if (!length) { 38 38 return; … … 85 85 } 86 86 _getTensionPointsClosed() { 87 varp = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]]87 const p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]] 88 88 .concat(middle) 89 89 .concat([ … … 108 108 } 109 109 getSelfRect() { 110 varpoints = this.points();110 let points = this.points(); 111 111 if (points.length < 4) { 112 112 return { … … 129 129 points = this.points(); 130 130 } 131 varminX = points[0];132 varmaxX = points[0];133 varminY = points[1];134 varmaxY = points[1];135 varx, y;136 for ( vari = 0; i < points.length / 2; i++) {131 let minX = points[0]; 132 let maxX = points[0]; 133 let minY = points[1]; 134 let maxY = points[1]; 135 let x, y; 136 for (let i = 0; i < points.length / 2; i++) { 137 137 x = points[i * 2]; 138 138 y = points[i * 2 + 1]; -
imaps-frontend/node_modules/konva/lib/shapes/Path.d.ts
rd565449 r0c6b92a 18 18 getLength(): number; 19 19 getPointAtLength(length: any): { 20 x: any;21 y: any;20 x: number; 21 y: number; 22 22 } | null; 23 23 data: GetSet<string, this>; 24 24 static getLineLength(x1: any, y1: any, x2: any, y2: any): number; 25 25 static getPathLength(dataArray: PathSegment[]): number; 26 static getPointAtLengthOfDataArray(length: number, dataArray: any): {27 x: any;28 y: any;26 static getPointAtLengthOfDataArray(length: number, dataArray: PathSegment[]): { 27 x: number; 28 y: number; 29 29 } | null; 30 static getPointOnLine(dist: any, P1x: any, P1y: any, P2x: any, P2y: any, fromX?: any, fromY?: any): {31 x: any;32 y: any;30 static getPointOnLine(dist: number, P1x: number, P1y: number, P2x: number, P2y: number, fromX?: number, fromY?: number): { 31 x: number; 32 y: number; 33 33 }; 34 34 static getPointOnCubicBezier(pct: any, P1x: any, P1y: any, P2x: any, P2y: any, P3x: any, P3y: any, P4x: any, P4y: any): { -
imaps-frontend/node_modules/konva/lib/shapes/Path.js
rd565449 r0c6b92a 21 21 } 22 22 _sceneFunc(context) { 23 varca = this.dataArray;23 const ca = this.dataArray; 24 24 context.beginPath(); 25 varisClosed = false;26 for ( varn = 0; n < ca.length; n++) {27 varc = ca[n].command;28 varp = ca[n].points;25 let isClosed = false; 26 for (let n = 0; n < ca.length; n++) { 27 const c = ca[n].command; 28 const p = ca[n].points; 29 29 switch (c) { 30 30 case 'L': … … 67 67 } 68 68 getSelfRect() { 69 varpoints = [];69 let points = []; 70 70 this.dataArray.forEach(function (data) { 71 71 if (data.command === 'A') { 72 varstart = data.points[4];73 vardTheta = data.points[5];74 varend = data.points[4] + dTheta;75 varinc = Math.PI / 180.0;72 const start = data.points[4]; 73 const dTheta = data.points[5]; 74 const end = data.points[4] + dTheta; 75 let inc = Math.PI / 180.0; 76 76 if (Math.abs(start - end) < inc) { 77 77 inc = Math.abs(start - end); … … 100 100 } 101 101 }); 102 varminX = points[0];103 varmaxX = points[0];104 varminY = points[1];105 varmaxY = points[1];106 varx, y;107 for ( vari = 0; i < points.length / 2; i++) {102 let minX = points[0]; 103 let maxX = points[0]; 104 let minY = points[1]; 105 let maxY = points[1]; 106 let x, y; 107 for (let i = 0; i < points.length / 2; i++) { 108 108 x = points[i * 2]; 109 109 y = points[i * 2 + 1]; … … 135 135 static getPathLength(dataArray) { 136 136 let pathLength = 0; 137 for ( vari = 0; i < dataArray.length; ++i) {137 for (let i = 0; i < dataArray.length; ++i) { 138 138 pathLength += dataArray[i].pathLength; 139 139 } … … 141 141 } 142 142 static getPointAtLengthOfDataArray(length, dataArray) { 143 var point, i = 0, ii = dataArray.length;143 let points, i = 0, ii = dataArray.length; 144 144 if (!ii) { 145 145 return null; … … 150 150 } 151 151 if (i === ii) { 152 point = dataArray[i - 1].points.slice(-2);152 points = dataArray[i - 1].points.slice(-2); 153 153 return { 154 x: point [0],155 y: point [1],154 x: points[0], 155 y: points[1], 156 156 }; 157 157 } 158 158 if (length < 0.01) { 159 point = dataArray[i].points.slice(0, 2);159 points = dataArray[i].points.slice(0, 2); 160 160 return { 161 x: point [0],162 y: point [1],161 x: points[0], 162 y: points[1], 163 163 }; 164 164 } 165 varcp = dataArray[i];166 varp = cp.points;165 const cp = dataArray[i]; 166 const p = cp.points; 167 167 switch (cp.command) { 168 168 case 'L': … … 221 221 return (1 - t) * (1 - t) * (1 - t); 222 222 } 223 varx = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);224 vary = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);223 const x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct); 224 const y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct); 225 225 return { 226 226 x: x, … … 238 238 return (1 - t) * (1 - t); 239 239 } 240 varx = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);241 vary = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);240 const x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct); 241 const y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct); 242 242 return { 243 243 x: x, … … 246 246 } 247 247 static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) { 248 varcosPsi = Math.cos(psi), sinPsi = Math.sin(psi);249 varpt = {248 const cosPsi = Math.cos(psi), sinPsi = Math.sin(psi); 249 const pt = { 250 250 x: rx * Math.cos(theta), 251 251 y: ry * Math.sin(theta), … … 260 260 return []; 261 261 } 262 varcs = data;263 varcc = [262 let cs = data; 263 const cc = [ 264 264 'm', 265 265 'M', … … 287 287 cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]); 288 288 } 289 vararr = cs.split('|');290 varca = [];291 varcoords = [];292 varcpx = 0;293 varcpy = 0;294 varre = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;295 varmatch;289 const arr = cs.split('|'); 290 const ca = []; 291 const coords = []; 292 let cpx = 0; 293 let cpy = 0; 294 const re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi; 295 let match; 296 296 for (n = 1; n < arr.length; n++) { 297 varstr = arr[n];298 varc = str.charAt(0);297 let str = arr[n]; 298 let c = str.charAt(0); 299 299 str = str.slice(1); 300 300 coords.length = 0; … … 302 302 coords.push(match[0]); 303 303 } 304 varp = [];305 for ( varj = 0, jlen = coords.length; j < jlen; j++) {304 const p = []; 305 for (let j = 0, jlen = coords.length; j < jlen; j++) { 306 306 if (coords[j] === '00') { 307 307 p.push(0, 0); 308 308 continue; 309 309 } 310 varparsed = parseFloat(coords[j]);310 const parsed = parseFloat(coords[j]); 311 311 if (!isNaN(parsed)) { 312 312 p.push(parsed); … … 320 320 break; 321 321 } 322 varcmd = '';323 varpoints = [];324 varstartX = cpx, startY = cpy;322 let cmd = ''; 323 let points = []; 324 const startX = cpx, startY = cpy; 325 325 var prevCmd, ctlPtx, ctlPty; 326 326 var rx, ry, psi, fa, fs, x1, y1; … … 344 344 cmd = 'M'; 345 345 if (ca.length > 2 && ca[ca.length - 1].command === 'z') { 346 for ( varidx = ca.length - 2; idx >= 0; idx--) {346 for (let idx = ca.length - 2; idx >= 0; idx--) { 347 347 if (ca[idx].command === 'M') { 348 348 cpx = ca[idx].points[0] + dx; … … 511 511 } 512 512 static calcLength(x, y, cmd, points) { 513 varlen, p1, p2, t;514 varpath = Path;513 let len, p1, p2, t; 514 const path = Path; 515 515 switch (cmd) { 516 516 case 'L': … … 551 551 } 552 552 static convertEndpointToCenterParameterization(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) { 553 varpsi = psiDeg * (Math.PI / 180.0);554 varxp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0;555 varyp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 +553 const psi = psiDeg * (Math.PI / 180.0); 554 const xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0; 555 const yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 + 556 556 (Math.cos(psi) * (y1 - y2)) / 2.0; 557 varlambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);557 const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry); 558 558 if (lambda > 1) { 559 559 rx *= Math.sqrt(lambda); 560 560 ry *= Math.sqrt(lambda); 561 561 } 562 varf = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) /562 let f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) / 563 563 (rx * rx * (yp * yp) + ry * ry * (xp * xp))); 564 564 if (fa === fs) { … … 568 568 f = 0; 569 569 } 570 varcxp = (f * rx * yp) / ry;571 varcyp = (f * -ry * xp) / rx;572 varcx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;573 varcy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;574 varvMag = function (v) {570 const cxp = (f * rx * yp) / ry; 571 const cyp = (f * -ry * xp) / rx; 572 const cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp; 573 const cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp; 574 const vMag = function (v) { 575 575 return Math.sqrt(v[0] * v[0] + v[1] * v[1]); 576 576 }; 577 varvRatio = function (u, v) {577 const vRatio = function (u, v) { 578 578 return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)); 579 579 }; 580 varvAngle = function (u, v) {580 const vAngle = function (u, v) { 581 581 return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v)); 582 582 }; 583 vartheta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);584 varu = [(xp - cxp) / rx, (yp - cyp) / ry];585 varv = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];586 vardTheta = vAngle(u, v);583 const theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]); 584 const u = [(xp - cxp) / rx, (yp - cyp) / ry]; 585 const v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry]; 586 let dTheta = vAngle(u, v); 587 587 if (vRatio(u, v) <= -1) { 588 588 dTheta = Math.PI; -
imaps-frontend/node_modules/konva/lib/shapes/Rect.js
rd565449 r0c6b92a 9 9 class Rect extends Shape_1.Shape { 10 10 _sceneFunc(context) { 11 varcornerRadius = this.cornerRadius(), width = this.width(), height = this.height();11 const cornerRadius = this.cornerRadius(), width = this.width(), height = this.height(); 12 12 context.beginPath(); 13 13 if (!cornerRadius) { -
imaps-frontend/node_modules/konva/lib/shapes/RegularPolygon.js
rd565449 r0c6b92a 11 11 context.beginPath(); 12 12 context.moveTo(points[0].x, points[0].y); 13 for ( varn = 1; n < points.length; n++) {13 for (let n = 1; n < points.length; n++) { 14 14 context.lineTo(points[n].x, points[n].y); 15 15 } … … 21 21 const radius = this.attrs.radius || 0; 22 22 const points = []; 23 for ( varn = 0; n < sides; n++) {23 for (let n = 0; n < sides; n++) { 24 24 points.push({ 25 25 x: radius * Math.sin((n * 2 * Math.PI) / sides), … … 31 31 getSelfRect() { 32 32 const points = this._getPoints(); 33 varminX = points[0].x;34 varmaxX = points[0].y;35 varminY = points[0].x;36 varmaxY = points[0].y;33 let minX = points[0].x; 34 let maxX = points[0].y; 35 let minY = points[0].x; 36 let maxY = points[0].y; 37 37 points.forEach((point) => { 38 38 minX = Math.min(minX, point.x); -
imaps-frontend/node_modules/konva/lib/shapes/Ring.js
rd565449 r0c6b92a 6 6 const Validators_1 = require("../Validators"); 7 7 const Global_1 = require("../Global"); 8 varPIx2 = Math.PI * 2;8 const PIx2 = Math.PI * 2; 9 9 class Ring extends Shape_1.Shape { 10 10 _sceneFunc(context) { -
imaps-frontend/node_modules/konva/lib/shapes/Sprite.js
rd565449 r0c6b92a 12 12 this._updated = true; 13 13 this.anim = new Animation_1.Animation(() => { 14 varupdated = this._updated;14 const updated = this._updated; 15 15 this._updated = false; 16 16 return updated; … … 31 31 } 32 32 _sceneFunc(context) { 33 varanim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();33 const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image(); 34 34 if (this.hasFill() || this.hasStroke()) { 35 35 context.beginPath(); … … 40 40 if (image) { 41 41 if (offsets) { 42 varoffset = offsets[anim], ix2 = index * 2;42 const offset = offsets[anim], ix2 = index * 2; 43 43 context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height); 44 44 } … … 49 49 } 50 50 _hitFunc(context) { 51 varanim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];51 const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3]; 52 52 context.beginPath(); 53 53 if (offsets) { 54 varoffset = offsets[anim];55 varix2 = index * 2;54 const offset = offsets[anim]; 55 const ix2 = index * 2; 56 56 context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height); 57 57 } … … 66 66 } 67 67 _setInterval() { 68 varthat = this;68 const that = this; 69 69 this.interval = setInterval(function () { 70 70 that._updateIndex(); … … 75 75 return; 76 76 } 77 varlayer = this.getLayer();77 const layer = this.getLayer(); 78 78 this.anim.setLayers(layer); 79 79 this._setInterval(); … … 88 88 } 89 89 _updateIndex() { 90 varindex = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;90 const index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4; 91 91 if (index < len - 1) { 92 92 this.frameIndex(index + 1); -
imaps-frontend/node_modules/konva/lib/shapes/Star.js
rd565449 r0c6b92a 8 8 class Star extends Shape_1.Shape { 9 9 _sceneFunc(context) { 10 varinnerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();10 const innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints(); 11 11 context.beginPath(); 12 12 context.moveTo(0, 0 - outerRadius); 13 for ( varn = 1; n < numPoints * 2; n++) {14 varradius = n % 2 === 0 ? outerRadius : innerRadius;15 varx = radius * Math.sin((n * Math.PI) / numPoints);16 vary = -1 * radius * Math.cos((n * Math.PI) / numPoints);13 for (let n = 1; n < numPoints * 2; n++) { 14 const radius = n % 2 === 0 ? outerRadius : innerRadius; 15 const x = radius * Math.sin((n * Math.PI) / numPoints); 16 const y = -1 * radius * Math.cos((n * Math.PI) / numPoints); 17 17 context.lineTo(x, y); 18 18 } -
imaps-frontend/node_modules/konva/lib/shapes/Text.d.ts
rd565449 r0c6b92a 38 38 getTextWidth(): number; 39 39 getTextHeight(): number; 40 measureSize(text: any): {41 actualBoundingBoxAscent: any;42 actualBoundingBoxDescent: any;43 actualBoundingBoxLeft: any;44 actualBoundingBoxRight: any;45 alphabeticBaseline: any;46 emHeightAscent: any;47 emHeightDescent: any;48 fontBoundingBoxAscent: any;49 fontBoundingBoxDescent: any;50 hangingBaseline: any;51 ideographicBaseline: any;52 width: any;40 measureSize(text: string): { 41 actualBoundingBoxAscent: number; 42 actualBoundingBoxDescent: number; 43 actualBoundingBoxLeft: number; 44 actualBoundingBoxRight: number; 45 alphabeticBaseline: number; 46 emHeightAscent: number; 47 emHeightDescent: number; 48 fontBoundingBoxAscent: number; 49 fontBoundingBoxDescent: number; 50 hangingBaseline: number; 51 ideographicBaseline: number; 52 width: number; 53 53 height: number; 54 54 }; -
imaps-frontend/node_modules/konva/lib/shapes/Text.js
rd565449 r0c6b92a 1 1 "use strict"; 2 2 Object.defineProperty(exports, "__esModule", { value: true }); 3 exports.Text = exports.stringToArray = void 0; 3 exports.Text = void 0; 4 exports.stringToArray = stringToArray; 4 5 const Util_1 = require("../Util"); 5 6 const Factory_1 = require("../Factory"); … … 9 10 const Global_2 = require("../Global"); 10 11 function stringToArray(string) { 11 return Array.from(string); 12 } 13 exports.stringToArray = stringToArray; 14 var AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', LTR = 'ltr', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST = [ 12 return [...string].reduce((acc, char, index, array) => { 13 if (/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(char)) { 14 acc.push(char); 15 } 16 else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) { 17 acc.push(char + array[index + 1]); 18 } 19 else if (index > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(char)) { 20 acc[acc.length - 1] += char; 21 } 22 else { 23 acc.push(char); 24 } 25 return acc; 26 }, []); 27 } 28 const AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST = [ 15 29 'direction', 16 30 'fontFamily', … … 43 57 .join(', '); 44 58 } 45 vardummyContext;59 let dummyContext; 46 60 function getDummyContext() { 47 61 if (dummyContext) { … … 72 86 this._partialTextX = 0; 73 87 this._partialTextY = 0; 74 for ( varn = 0; n < attrChangeListLen; n++) {88 for (let n = 0; n < attrChangeListLen; n++) { 75 89 this.on(ATTR_CHANGE_LIST[n] + CHANGE_KONVA, this._setTextData); 76 90 } … … 78 92 } 79 93 _sceneFunc(context) { 80 vartextArr = this.textArr, textArrLen = textArr.length;94 const textArr = this.textArr, textArrLen = textArr.length; 81 95 if (!this.text()) { 82 96 return; 83 97 } 84 varpadding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;98 let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n; 85 99 direction = direction === INHERIT ? context.direction : direction; 86 vartranslateY = lineHeightPx / 2;87 varbaseline = MIDDLE;100 let translateY = lineHeightPx / 2; 101 let baseline = MIDDLE; 88 102 if (Global_1.Konva._fixTextRendering) { 89 varmetrics = this.measureSize('M');103 const metrics = this.measureSize('M'); 90 104 baseline = 'alphabetic'; 91 105 translateY = … … 122 136 context.save(); 123 137 context.beginPath(); 124 let yOffset = Global_1.Konva._fixTextRendering138 const yOffset = Global_1.Konva._fixTextRendering 125 139 ? Math.round(fontSize / 4) 126 140 : Math.round(fontSize / 2); … … 142 156 context.save(); 143 157 context.beginPath(); 144 let yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;158 const yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0; 145 159 context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset); 146 160 spacesNumber = text.split(' ').length - 1; … … 159 173 if (direction !== RTL && (letterSpacing !== 0 || align === JUSTIFY)) { 160 174 spacesNumber = text.split(' ').length - 1; 161 vararray = stringToArray(text);162 for ( varli = 0; li < array.length; li++) {163 varletter = array[li];175 const array = stringToArray(text); 176 for (let li = 0; li < array.length; li++) { 177 const letter = array[li]; 164 178 if (letter === ' ' && !lastLine && align === JUSTIFY) { 165 179 lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber; … … 188 202 } 189 203 _hitFunc(context) { 190 varwidth = this.getWidth(), height = this.getHeight();204 const width = this.getWidth(), height = this.getHeight(); 191 205 context.beginPath(); 192 206 context.rect(0, 0, width, height); … … 195 209 } 196 210 setText(text) { 197 varstr = Util_1.Util._isString(text)211 const str = Util_1.Util._isString(text) 198 212 ? text 199 213 : text === null || text === undefined … … 204 218 } 205 219 getWidth() { 206 varisAuto = this.attrs.width === AUTO || this.attrs.width === undefined;220 const isAuto = this.attrs.width === AUTO || this.attrs.width === undefined; 207 221 return isAuto ? this.getTextWidth() + this.padding() * 2 : this.attrs.width; 208 222 } 209 223 getHeight() { 210 varisAuto = this.attrs.height === AUTO || this.attrs.height === undefined;224 const isAuto = this.attrs.height === AUTO || this.attrs.height === undefined; 211 225 return isAuto 212 226 ? this.fontSize() * this.textArr.length * this.lineHeight() + … … 223 237 measureSize(text) { 224 238 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; 225 var_context = getDummyContext(), fontSize = this.fontSize(), metrics;239 let _context = getDummyContext(), fontSize = this.fontSize(), metrics; 226 240 _context.save(); 227 241 _context.font = this._getContextFont(); … … 258 272 line = line.trim(); 259 273 } 260 varwidth = this._getTextWidth(line);274 const width = this._getTextWidth(line); 261 275 return this.textArr.push({ 262 276 text: line, … … 266 280 } 267 281 _getTextWidth(text) { 268 varletterSpacing = this.letterSpacing();269 varlength = text.length;282 const letterSpacing = this.letterSpacing(); 283 const length = text.length; 270 284 return (getDummyContext().measureText(text).width + 271 285 (length ? letterSpacing * (length - 1) : 0)); 272 286 } 273 287 _setTextData() { 274 varlines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();288 let lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis(); 275 289 this.textArr = []; 276 290 getDummyContext().font = this._getContextFont(); 277 varadditionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;278 for ( vari = 0, max = lines.length; i < max; ++i) {279 varline = lines[i];280 varlineWidth = this._getTextWidth(line);291 const additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0; 292 for (let i = 0, max = lines.length; i < max; ++i) { 293 let line = lines[i]; 294 let lineWidth = this._getTextWidth(line); 281 295 if (fixedWidth && lineWidth > maxWidth) { 282 296 while (line.length > 0) { 283 varlow = 0, high = line.length, match = '', matchWidth = 0;297 let low = 0, high = line.length, match = '', matchWidth = 0; 284 298 while (low < high) { 285 varmid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;299 const mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth; 286 300 if (substrWidth <= maxWidth) { 287 301 low = mid + 1; … … 296 310 if (wrapAtWord) { 297 311 var wrapIndex; 298 varnextChar = line[match.length];299 varnextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;312 const nextChar = line[match.length]; 313 const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH; 300 314 if (nextIsSpaceOrDash && matchWidth <= maxWidth) { 301 315 wrapIndex = match.length; … … 316 330 textWidth = Math.max(textWidth, matchWidth); 317 331 currentHeightPx += lineHeightPx; 318 varshouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);332 const shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx); 319 333 if (shouldHandleEllipsis) { 320 334 this._tryToAddEllipsisToLastLine(); … … 357 371 } 358 372 _shouldHandleEllipsis(currentHeightPx) { 359 varfontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;373 const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE; 360 374 return (!shouldWrap || 361 375 (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx)); 362 376 } 363 377 _tryToAddEllipsisToLastLine() { 364 varwidth = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();365 varlastLine = this.textArr[this.textArr.length - 1];378 const width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis(); 379 const lastLine = this.textArr[this.textArr.length - 1]; 366 380 if (!lastLine || !shouldAddEllipsis) { 367 381 return; 368 382 } 369 383 if (fixedWidth) { 370 varhaveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;384 const haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth; 371 385 if (!haveSpace) { 372 386 lastLine.text = lastLine.text.slice(0, lastLine.text.length - 3); -
imaps-frontend/node_modules/konva/lib/shapes/TextPath.d.ts
rd565449 r0c6b92a 29 29 _getTextPathLength(): number; 30 30 _getPointAtLength(length: number): { 31 x: any;32 y: any;31 x: number; 32 y: number; 33 33 } | null; 34 34 _readDataAttribute(): void; -
imaps-frontend/node_modules/konva/lib/shapes/TextPath.js
rd565449 r0c6b92a 9 9 const Validators_1 = require("../Validators"); 10 10 const Global_1 = require("../Global"); 11 varEMPTY_STRING = '', NORMAL = 'normal';11 const EMPTY_STRING = '', NORMAL = 'normal'; 12 12 function _fillFunc(context) { 13 13 context.fillText(this.partialText, 0, 0); … … 51 51 context.setAttr('textAlign', 'left'); 52 52 context.save(); 53 vartextDecoration = this.textDecoration();54 varfill = this.fill();55 varfontSize = this.fontSize();56 varglyphInfo = this.glyphInfo;53 const textDecoration = this.textDecoration(); 54 const fill = this.fill(); 55 const fontSize = this.fontSize(); 56 const glyphInfo = this.glyphInfo; 57 57 if (textDecoration === 'underline') { 58 58 context.beginPath(); 59 59 } 60 for ( vari = 0; i < glyphInfo.length; i++) {60 for (let i = 0; i < glyphInfo.length; i++) { 61 61 context.save(); 62 varp0 = glyphInfo[i].p0;62 const p0 = glyphInfo[i].p0; 63 63 context.translate(p0.x, p0.y); 64 64 context.rotate(glyphInfo[i].rotation); … … 82 82 _hitFunc(context) { 83 83 context.beginPath(); 84 varglyphInfo = this.glyphInfo;84 const glyphInfo = this.glyphInfo; 85 85 if (glyphInfo.length >= 1) { 86 varp0 = glyphInfo[0].p0;86 const p0 = glyphInfo[0].p0; 87 87 context.moveTo(p0.x, p0.y); 88 88 } 89 for ( vari = 0; i < glyphInfo.length; i++) {90 varp1 = glyphInfo[i].p1;89 for (let i = 0; i < glyphInfo.length; i++) { 90 const p1 = glyphInfo[i].p1; 91 91 context.lineTo(p1.x, p1.y); 92 92 } … … 109 109 } 110 110 _getTextSize(text) { 111 vardummyCanvas = this.dummyCanvas;112 var_context = dummyCanvas.getContext('2d');111 const dummyCanvas = this.dummyCanvas; 112 const _context = dummyCanvas.getContext('2d'); 113 113 _context.save(); 114 114 _context.font = this._getContextFont(); 115 varmetrics = _context.measureText(text);115 const metrics = _context.measureText(text); 116 116 _context.restore(); 117 117 return { … … 141 141 const charArr = (0, Text_1.stringToArray)(this.text()); 142 142 let offsetToGlyph = offset; 143 for ( vari = 0; i < charArr.length; i++) {143 for (let i = 0; i < charArr.length; i++) { 144 144 const charStartPoint = this._getPointAtLength(offsetToGlyph); 145 145 if (!charStartPoint) … … 188 188 }; 189 189 } 190 varpoints = [];190 const points = []; 191 191 this.glyphInfo.forEach(function (info) { 192 192 points.push(info.p0.x); … … 195 195 points.push(info.p1.y); 196 196 }); 197 varminX = points[0] || 0;198 varmaxX = points[0] || 0;199 varminY = points[1] || 0;200 varmaxY = points[1] || 0;201 varx, y;202 for ( vari = 0; i < points.length / 2; i++) {197 let minX = points[0] || 0; 198 let maxX = points[0] || 0; 199 let minY = points[1] || 0; 200 let maxY = points[1] || 0; 201 let x, y; 202 for (let i = 0; i < points.length / 2; i++) { 203 203 x = points[i * 2]; 204 204 y = points[i * 2 + 1]; … … 208 208 maxY = Math.max(maxY, y); 209 209 } 210 varfontSize = this.fontSize();210 const fontSize = this.fontSize(); 211 211 return { 212 212 x: minX - fontSize / 2, -
imaps-frontend/node_modules/konva/lib/shapes/Transformer.d.ts
rd565449 r0c6b92a 95 95 attrs: any; 96 96 className: string; 97 children?: any[] | undefined;97 children?: Array<any>; 98 98 }; 99 99 clone(obj?: any): this; -
imaps-frontend/node_modules/konva/lib/shapes/Transformer.js
rd565449 r0c6b92a 11 11 const Validators_1 = require("../Validators"); 12 12 const Global_2 = require("../Global"); 13 varEVENTS_NAME = 'tr-konva';14 varATTR_CHANGE_LIST = [13 const EVENTS_NAME = 'tr-konva'; 14 const ATTR_CHANGE_LIST = [ 15 15 'resizeEnabledChange', 16 16 'rotateAnchorOffsetChange', … … 31 31 .map((e) => e + `.${EVENTS_NAME}`) 32 32 .join(' '); 33 varNODES_RECT = 'nodesRect';34 varTRANSFORM_CHANGE_STR = [33 const NODES_RECT = 'nodesRect'; 34 const TRANSFORM_CHANGE_STR = [ 35 35 'widthChange', 36 36 'heightChange', … … 45 45 'strokeWidthChange', 46 46 ]; 47 varANGLES = {47 const ANGLES = { 48 48 'top-left': -45, 49 49 'top-center': 0, … … 61 61 } 62 62 rad += Util_1.Util.degToRad(ANGLES[anchorName] || 0); 63 varangle = ((Util_1.Util.radToDeg(rad) % 360) + 360) % 360;63 const angle = ((Util_1.Util.radToDeg(rad) % 360) + 360) % 360; 64 64 if (Util_1.Util._inRange(angle, 315 + 22.5, 360) || Util_1.Util._inRange(angle, 0, 22.5)) { 65 65 return 'ns-resize'; … … 91 91 } 92 92 } 93 varANCHORS_NAMES = [93 const ANCHORS_NAMES = [ 94 94 'top-left', 95 95 'top-center', … … 101 101 'bottom-right', 102 102 ]; 103 varMAX_SAFE_INTEGER = 100000000;103 const MAX_SAFE_INTEGER = 100000000; 104 104 function getCenter(shape) { 105 105 return { … … 208 208 }); 209 209 this._resetTransformCache(); 210 varelementsCreated = !!this.findOne('.top-left');210 const elementsCreated = !!this.findOne('.top-left'); 211 211 if (elementsCreated) { 212 212 this.update(); … … 270 270 } 271 271 __getNodeShape(node, rot = this.rotation(), relative) { 272 varrect = node.getClientRect({272 const rect = node.getClientRect({ 273 273 skipTransform: true, 274 274 skipShadow: true, 275 275 skipStroke: this.ignoreStroke(), 276 276 }); 277 varabsScale = node.getAbsoluteScale(relative);278 varabsPos = node.getAbsolutePosition(relative);279 vardx = rect.x * absScale.x - node.offsetX() * absScale.x;280 vardy = rect.y * absScale.y - node.offsetY() * absScale.y;277 const absScale = node.getAbsoluteScale(relative); 278 const absPos = node.getAbsolutePosition(relative); 279 const dx = rect.x * absScale.x - node.offsetX() * absScale.x; 280 const dy = rect.y * absScale.y - node.offsetY() * absScale.y; 281 281 const rotation = (Global_1.Konva.getAngle(node.getAbsoluteRotation()) + Math.PI * 2) % 282 282 (Math.PI * 2); … … 294 294 } 295 295 __getNodeRect() { 296 varnode = this.getNode();296 const node = this.getNode(); 297 297 if (!node) { 298 298 return { … … 311 311 skipStroke: this.ignoreStroke(), 312 312 }); 313 varpoints = [313 const points = [ 314 314 { x: box.x, y: box.y }, 315 315 { x: box.x + box.width, y: box.y }, … … 317 317 { x: box.x, y: box.y + box.height }, 318 318 ]; 319 vartrans = node.getAbsoluteTransform();319 const trans = node.getAbsoluteTransform(); 320 320 points.forEach(function (point) { 321 vartransformed = trans.point(point);321 const transformed = trans.point(point); 322 322 totalPoints.push(transformed); 323 323 }); … … 325 325 const tr = new Util_1.Transform(); 326 326 tr.rotate(-Global_1.Konva.getAngle(this.rotation())); 327 varminX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;327 let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity; 328 328 totalPoints.forEach(function (point) { 329 vartransformed = tr.point(point);329 const transformed = tr.point(point); 330 330 if (minX === undefined) { 331 331 minX = maxX = transformed.x; … … 367 367 } 368 368 _createAnchor(name) { 369 varanchor = new Rect_1.Rect({369 const anchor = new Rect_1.Rect({ 370 370 stroke: 'rgb(0, 161, 255)', 371 371 fill: 'white', … … 376 376 hitStrokeWidth: TOUCH_DEVICE ? 10 : 'auto', 377 377 }); 378 varself = this;378 const self = this; 379 379 anchor.on('mousedown touchstart', function (e) { 380 380 self._handleMouseDown(e); … … 388 388 }); 389 389 anchor.on('mouseenter', () => { 390 varrad = Global_1.Konva.getAngle(this.rotation());391 varrotateCursor = this.rotateAnchorCursor();392 varcursor = getCursor(name, rad, rotateCursor);390 const rad = Global_1.Konva.getAngle(this.rotation()); 391 const rotateCursor = this.rotateAnchorCursor(); 392 const cursor = getCursor(name, rad, rotateCursor); 393 393 anchor.getStage().content && 394 394 (anchor.getStage().content.style.cursor = cursor); … … 403 403 } 404 404 _createBack() { 405 varback = new Shape_1.Shape({405 const back = new Shape_1.Shape({ 406 406 name: 'back', 407 407 width: 0, … … 409 409 draggable: true, 410 410 sceneFunc(ctx, shape) { 411 vartr = shape.getParent();412 varpadding = tr.padding();411 const tr = shape.getParent(); 412 const padding = tr.padding(); 413 413 ctx.beginPath(); 414 414 ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2); … … 423 423 return; 424 424 } 425 varpadding = this.padding();425 const padding = this.padding(); 426 426 ctx.beginPath(); 427 427 ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2); … … 449 449 } 450 450 this._movingAnchorName = e.target.name().split(' ')[0]; 451 varattrs = this._getNodeRect();452 varwidth = attrs.width;453 varheight = attrs.height;454 varhypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));451 const attrs = this._getNodeRect(); 452 const width = attrs.width; 453 const height = attrs.height; 454 const hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); 455 455 this.sin = Math.abs(height / hypotenuse); 456 456 this.cos = Math.abs(width / hypotenuse); … … 462 462 } 463 463 this._transforming = true; 464 varap = e.target.getAbsolutePosition();465 varpos = e.target.getStage().getPointerPosition();464 const ap = e.target.getAbsolutePosition(); 465 const pos = e.target.getStage().getPointerPosition(); 466 466 this._anchorDragOffset = { 467 467 x: pos.x - ap.x, … … 475 475 } 476 476 _handleMouseMove(e) { 477 varx, y, newHypotenuse;478 varanchorNode = this.findOne('.' + this._movingAnchorName);479 varstage = anchorNode.getStage();477 let x, y, newHypotenuse; 478 const anchorNode = this.findOne('.' + this._movingAnchorName); 479 const stage = anchorNode.getStage(); 480 480 stage.setPointersPositions(e); 481 481 const pp = stage.getPointerPosition(); … … 494 494 } 495 495 if (this._movingAnchorName === 'rotater') { 496 varattrs = this._getNodeRect();496 const attrs = this._getNodeRect(); 497 497 x = anchorNode.x() - attrs.width / 2; 498 498 y = -anchorNode.y() + attrs.height / 2; … … 501 501 delta -= Math.PI; 502 502 } 503 varoldRotation = Global_1.Konva.getAngle(this.rotation());503 const oldRotation = Global_1.Konva.getAngle(this.rotation()); 504 504 const newRotation = oldRotation + delta; 505 505 const tol = Global_1.Konva.getAngle(this.rotationSnapTolerance()); … … 510 510 return; 511 511 } 512 varshiftBehavior = this.shiftBehavior();513 varkeepProportion;512 const shiftBehavior = this.shiftBehavior(); 513 let keepProportion; 514 514 if (shiftBehavior === 'inverted') { 515 515 keepProportion = this.keepRatio() && !e.shiftKey; … … 630 630 var centeredScaling = this.centeredScaling() || e.altKey; 631 631 if (centeredScaling) { 632 vartopLeft = this.findOne('.top-left');633 varbottomRight = this.findOne('.bottom-right');634 vartopOffsetX = topLeft.x();635 vartopOffsetY = topLeft.y();636 varbottomOffsetX = this.getWidth() - bottomRight.x();637 varbottomOffsetY = this.getHeight() - bottomRight.y();632 const topLeft = this.findOne('.top-left'); 633 const bottomRight = this.findOne('.bottom-right'); 634 const topOffsetX = topLeft.x(); 635 const topOffsetY = topLeft.y(); 636 const bottomOffsetX = this.getWidth() - bottomRight.x(); 637 const bottomOffsetY = this.getHeight() - bottomRight.y(); 638 638 bottomRight.move({ 639 639 x: -topOffsetX, … … 645 645 }); 646 646 } 647 varabsPos = this.findOne('.top-left').getAbsolutePosition();647 const absPos = this.findOne('.top-left').getAbsolutePosition(); 648 648 x = absPos.x; 649 649 y = absPos.y; 650 varwidth = this.findOne('.bottom-right').x() - this.findOne('.top-left').x();651 varheight = this.findOne('.bottom-right').y() - this.findOne('.top-left').y();650 const width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x(); 651 const height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y(); 652 652 this._fitNodesInto({ 653 653 x: x, … … 674 674 window.removeEventListener('touchend', this._handleMouseUp, true); 675 675 } 676 varnode = this.getNode();676 const node = this.getNode(); 677 677 activeTransformersCount--; 678 678 this._fire('transformend', { evt: e, target: node }); … … 689 689 } 690 690 _fitNodesInto(newAttrs, evt) { 691 varoldAttrs = this._getNodeRect();691 const oldAttrs = this._getNodeRect(); 692 692 const minSize = 1; 693 693 if (Util_1.Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize)) { … … 699 699 return; 700 700 } 701 vart = new Util_1.Transform();701 const t = new Util_1.Transform(); 702 702 t.rotate(Global_1.Konva.getAngle(this.rotation())); 703 703 if (this._movingAnchorName && … … 816 816 update() { 817 817 var _a; 818 varattrs = this._getNodeRect();818 const attrs = this._getNodeRect(); 819 819 this.rotation(Util_1.Util._getRotation(attrs.rotation)); 820 varwidth = attrs.width;821 varheight = attrs.height;822 varenabledAnchors = this.enabledAnchors();823 varresizeEnabled = this.resizeEnabled();824 varpadding = this.padding();825 varanchorSize = this.anchorSize();820 const width = attrs.width; 821 const height = attrs.height; 822 const enabledAnchors = this.enabledAnchors(); 823 const resizeEnabled = this.resizeEnabled(); 824 const padding = this.padding(); 825 const anchorSize = this.anchorSize(); 826 826 const anchors = this.find('._anchor'); 827 827 anchors.forEach((node) => { … … 918 918 if (this._transforming) { 919 919 this._removeEvents(); 920 varanchorNode = this.findOne('.' + this._movingAnchorName);920 const anchorNode = this.findOne('.' + this._movingAnchorName); 921 921 if (anchorNode) { 922 922 anchorNode.stopDrag(); … … 937 937 } 938 938 clone(obj) { 939 varnode = Node_1.Node.prototype.clone.call(this, obj);939 const node = Node_1.Node.prototype.clone.call(this, obj); 940 940 return node; 941 941 }
Note:
See TracChangeset
for help on using the changeset viewer.