Changeset 0c6b92a for imaps-frontend/node_modules/konva/lib/shapes/Line.js
Legend:
- Unmodified
- Added
- Removed
-
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];
Note:
See TracChangeset
for help on using the changeset viewer.