Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/konva/lib/shapes/Line.js

    rd565449 r0c6b92a  
    33exports.Line = void 0;
    44const Factory_1 = require("../Factory");
     5const Global_1 = require("../Global");
    56const Shape_1 = require("../Shape");
    67const Validators_1 = require("../Validators");
    7 const Global_1 = require("../Global");
    88function getControlPoints(x0, y0, x1, y1, x2, y2, t) {
    9     var 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);
     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);
    1010    return [p1x, p1y, p2x, p2y];
    1111}
    1212function expandPoints(p, tension) {
    13     var len = p.length, allPoints = [], n, cp;
    14     for (n = 2; n < len - 2; n += 2) {
    15         cp = 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);
    1616        if (isNaN(cp[0])) {
    1717            continue;
     
    3434    }
    3535    _sceneFunc(context) {
    36         var points = 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;
    3737        if (!length) {
    3838            return;
     
    8585    }
    8686    _getTensionPointsClosed() {
    87         var 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]]
     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]]
    8888            .concat(middle)
    8989            .concat([
     
    108108    }
    109109    getSelfRect() {
    110         var points = this.points();
     110        let points = this.points();
    111111        if (points.length < 4) {
    112112            return {
     
    129129            points = this.points();
    130130        }
    131         var minX = points[0];
    132         var maxX = points[0];
    133         var minY = points[1];
    134         var maxY = points[1];
    135         var x, y;
    136         for (var i = 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++) {
    137137            x = points[i * 2];
    138138            y = points[i * 2 + 1];
Note: See TracChangeset for help on using the changeset viewer.