{"version":3,"file":"WBAlignmentGuidelines.min.mjs","sources":["../../../../src/canvas/canvasx/WBAlignmentGuidelines.ts"],"sourcesContent":["//@ts-nocheck\nimport { Point } from '../../Point';\nimport { EventNames } from './EventNames';\n\n//**import Services */\n\nexport class alignmentGuideLines {\n  canvas: any = null;\n  ctx: any = null;\n  aligningLineOffset: number = 0;\n  masterMargin: number = 4;\n  margin: number = 4;\n  aligningLineWidth: number = 1;\n  aligningLineColor: any = '#3FB2FF';\n  viewportTransform: any = null;\n  zoom: number = 1;\n  verticalLines: any = [];\n  horizontalLines: any = [];\n  isScaling: any = null;\n  mouseDownPoint: any = null;\n  activeObject: any = null;\n  offsetX: number = 30;\n  offsetY: number = 30;\n  padding: number = 0;\n  candidateObjects: any = [];\n  hCandidateObjects: any = [];\n  vCandidateObjects: any = [];\n  horizontalInTheRange: boolean = false;\n  verticalInTheRange: boolean = false;\n  scalePoint: any = null;\n  debug: boolean = false;\n  mouseMovePoint: any = null;\n  timoutHandler: any;\n\n  constructor(canvas: any) {\n    this.canvas = canvas;\n    this.ctx = this.canvas.getSelectionContext();\n  }\n\n  onObjectMoving(e: any) {\n    this.isScaling = false;\n    this.moveHandler(e);\n  }\n\n  onObjectScaling(e: any) {\n    this.isScaling = true;\n    this.scaleHandler(e);\n  }\n\n  //todo: clear context caused the bug that the selection blue rect stop showing, there should be better way to clear the context\n  //as it clear verything including the selection rect\n  onBeforeRender() {\n    this.canvas.clearContext(this.ctx);\n    this.canvas.renderTopLayer(this.ctx);\n  }\n\n  onAfterRender() {\n    if (this.activeObject) {\n      this.ctx.font = '10px Arial';\n      if (this.isScaling && this.debug) {\n        const x = this.scalePoint.x * this.zoom + this.viewportTransform[4];\n        const y = this.scalePoint.y * this.zoom + this.viewportTransform[5];\n        this.ctx.fillText(\n          JSON.stringify(this.scalePoint) + JSON.stringify(this.activeObject),\n          x,\n          y\n        );\n        if (this.canvas.getActiveObject().parent)\n          this.ctx.fillText(JSON.stringify(this.activeObject), x, y + 20);\n      }\n      if (this.debug) {\n        const x =\n          this.activeObject.getCenterPoint().x * this.zoom +\n          this.viewportTransform[4];\n        const y =\n          this.activeObject.getCenterPoint().y * this.zoom +\n          this.viewportTransform[5];\n        this.ctx.fillText(\n          JSON.stringify(this.activeObject.getCenterPoint()),\n          x,\n          y\n        );\n      }\n    }\n\n    if (this.verticalLines)\n      this.verticalLines.forEach((vline: any) => {\n        this.drawVerticalLine(vline);\n      });\n    if (this.horizontalLines)\n      this.horizontalLines.forEach((hline: any) => {\n        this.drawHorizontalLine(hline);\n      });\n  }\n\n  onMouseUpRenderCanvas() {\n    this.verticalLines.length = this.horizontalLines.length = 0;\n    if (this.activeObject && !this.activeObject.isEditing)\n      this.activeObject.hasControls = true;\n\n    this.canvas.requestRenderAll();\n  }\n\n  onMouseDown({ pointer }: { pointer: any }) {\n    this.mouseDownPoint = { ...pointer };\n    this.zoom = this.canvas.getZoom();\n    this.viewportTransform = this.canvas.viewportTransform;\n  }\n\n  initializeEvents() {\n    // const esi = EventService.getInstance();\n    this.canvas.off(EventNames.OBJECT_MOVING, this.onObjectMoving.bind(this));\n    this.canvas.off(EventNames.OBJECT_SCALING, this.onObjectScaling.bind(this));\n    this.canvas.off(EventNames.BEFORE_RENDER, this.onBeforeRender.bind(this));\n    this.canvas.off(EventNames.AFTER_RENDER, this.onAfterRender.bind(this));\n    this.canvas.off('mouse:up', this.onMouseUpRenderCanvas.bind(this));\n    this.canvas.off('mouse:down', this.onMouseDown.bind(this));\n\n    // const esi = EventService.getInstance();\n    this.canvas.on(EventNames.OBJECT_MOVING, this.onObjectMoving.bind(this));\n    this.canvas.on(EventNames.OBJECT_SCALING, this.onObjectScaling.bind(this));\n    this.canvas.on(EventNames.BEFORE_RENDER, this.onBeforeRender.bind(this));\n    this.canvas.on(EventNames.AFTER_RENDER, this.onAfterRender.bind(this));\n    this.canvas.on('mouse:up', this.onMouseUpRenderCanvas.bind(this));\n\n    this.canvas.on('mouse:down', this.onMouseDown.bind(this));\n  }\n\n  snapLine(aLine: any) {\n    this.activeObject.setPositionByOrigin(\n      new Point(aLine.x, aLine.y),\n      aLine.xalign,\n      aLine.yalign\n    );\n  }\n\n  drawVerticalLine(coords: { x: any; y1: any; y2: any; type: string }) {\n    let padding: number = 0;\n    if (coords.type.substring(2, 3) === 'l') padding = -this.padding;\n    if (coords.type.substring(2, 3) === 'c') padding = 0;\n    if (coords.type.substring(2, 3) === 'r') padding = this.padding;\n    let x1 = coords.x! + this.padding,\n      y1 = coords.y1! > coords.y2! ? coords.y2! : coords.y1!,\n      x2 = coords.x! + this.padding,\n      y2 = coords.y2! > coords.y1! ? coords.y2! : coords.y1!;\n    this.zoom = this.canvas.getZoom();\n    this.viewportTransform = this.canvas.viewportTransform;\n    if (this.viewportTransform) {\n      x1 = x1 * this.zoom + this.viewportTransform[4];\n      y1 =\n        y1 * this.zoom + this.viewportTransform[5] - this.offsetY * this.zoom;\n      x2 = x2 * this.zoom + this.viewportTransform[4];\n      y2 =\n        y2 * this.zoom + this.viewportTransform[5] + this.offsetY * this.zoom;\n      const lineColorMap: any = { l: 'red', c: 'yellow', r: 'green' };\n      const lineColor = lineColorMap[coords.type.substring(1, 2)];\n      this.drawLine(x1, y1, x2, y2, lineColor);\n    }\n  }\n\n  drawHorizontalLine(coords: { x1: any; x2: any; y: any; type: string }) {\n    let padding: number = 0;\n    if (coords.type.substring(2, 3) === 't') padding = -this.padding;\n    if (coords.type.substring(2, 3) === 'c') padding = 0;\n    if (coords.type.substring(2, 3) === 'b') padding = this.padding;\n    let x1 = coords.x1! > coords.x2! ? coords.x2! : coords.x1!,\n      y1 = coords.y! + padding,\n      x2 = coords.x2! > coords.x1! ? coords.x2! : coords.x1!,\n      y2 = coords.y! + padding;\n    this.zoom = this.canvas.getZoom();\n    //let offset = this.canvas.getPositionOnCanvas(0, 0);\n    this.viewportTransform = this.canvas.viewportTransform;\n    if (this.viewportTransform) {\n      x1 =\n        x1 * this.zoom + this.viewportTransform[4] - this.offsetX * this.zoom;\n      y1 = y1 * this.zoom + this.viewportTransform[5];\n      x2 =\n        x2 * this.zoom + this.viewportTransform[4] + this.offsetX * this.zoom;\n      y2 = y2 * this.zoom + this.viewportTransform[5];\n      const lineColorMap: any = { t: 'red', c: 'yellow', b: 'green' };\n      const lineColor = lineColorMap[coords.type.substring(1, 2)];\n      this.drawLine(x1, y1, x2, y2, lineColor);\n    }\n  }\n\n  drawLine(x1: any, y1: any, x2: any, y2: any, lineColor: any) {\n    this.ctx.save();\n    this.ctx.lineWidth = this.aligningLineWidth;\n    this.ctx.strokeStyle = this.aligningLineColor;\n    this.ctx.beginPath();\n    this.ctx.moveTo(x1, y1);\n    this.ctx.lineTo(x2, y2);\n    this.ctx.stroke();\n    this.ctx.restore();\n  }\n\n  isInRange(value1: number, value2: number) {\n    return Math.abs(value1 - value2) <= this.margin * this.zoom;\n  }\n\n  skipActiveObject() {\n    this.viewportTransform = this.canvas.viewportTransform;\n    if (\n      !this.activeObject ||\n      !this.viewportTransform ||\n      this.activeObject.objType === 'WBRectPanel' ||\n      this.activeObject.objType === 'common' ||\n      this.activeObject.angle !== 0 ||\n      this.activeObject.isPanelTitle\n    )\n      return true;\n    else return false;\n  }\n\n  skipCandidateObject(currentObject: any) {\n    if (\n      !currentObject ||\n      !currentObject.visible ||\n      currentObject.objType === 'WBLine' ||\n      currentObject.objType === 'XConnector' ||\n      currentObject.objType === 'common' ||\n      currentObject.group ||\n      currentObject === this.activeObject ||\n      currentObject.id === this.activeObject.id ||\n      !currentObject.isOnScreen()\n    ) {\n      return true;\n    }\n    return false;\n  }\n\n  findCandidateObjects() {\n    this.zoom = this.canvas.getZoom();\n    this.margin = this.masterMargin / this.zoom;\n    var canvasObjects = this.canvas.getObjects();\n    this.candidateObjects = [];\n    for (let i = canvasObjects.length; i--; ) {\n      const candidateObject = canvasObjects[i];\n      if (this.skipCandidateObject(candidateObject)) continue;\n      this.candidateObjects.push(candidateObject);\n    }\n\n    const leftBoundary = this.activeObject.left - this.margin * this.zoom * 2,\n      rightBoundary =\n        this.activeObject.left +\n        this.activeObject.width +\n        this.margin * this.zoom * 2,\n      topBoundary = this.activeObject.top - this.margin * this.zoom * 2,\n      bottomBoundary =\n        this.activeObject.top +\n        this.activeObject.height +\n        this.margin * this.zoom * 2;\n\n    this.hCandidateObjects = this.candidateObjects;\n    this.vCandidateObjects = this.candidateObjects;\n  }\n\n  findUniqueGuideLines() {\n    const compareABS = (property: any) => (a: any, b: any) =>\n      Math.abs(a[property]) - Math.abs(b[property]);\n    const vLineIDs = ['vl', 'vc', 'vr', 'vs'];\n    const newVLines: any[] = [];\n    vLineIDs.map((id: string) => {\n      let Lines = this.verticalLines.filter(\n        (l: any) => l.type.substring(0, 2) === id\n      );\n      if (Lines.length > 0) {\n        const l = Lines.sort(compareABS('distance'))[0];\n        newVLines.push(l);\n      }\n    });\n    const hLineIDs = ['ht', 'hc', 'hb', 'hs'];\n    const newHLines: any[] = [];\n    hLineIDs.map((id: string) => {\n      let Lines = this.horizontalLines.filter(\n        (l: any) => l.type.substring(0, 2) === id\n      );\n      if (Lines.length > 0) {\n        const l = Lines.sort(compareABS('distance'))[0];\n        newHLines.push(l);\n      }\n    });\n\n    this.verticalLines = newVLines;\n    this.horizontalLines = newHLines;\n  }\n\n  snap() {\n    this.verticalLines.forEach((l: any) => {\n      this.snapLine(l);\n    });\n    this.horizontalLines.forEach((l: any) => {\n      this.snapLine(l);\n    });\n  }\n\n  scaleSnap() {\n    //to be done later\n  }\n\n  findGuideLines() {\n    this.verticalLines = [];\n    this.horizontalLines = [];\n    this.horizontalInTheRange = false;\n    this.verticalInTheRange = false;\n\n    for (let i = this.vCandidateObjects.length; i--; ) {\n      let cObject = this.vCandidateObjects[i];\n\n      const aOKeyPoints = [\n        {\n          yt: this.activeObject.aCoords.tl.y,\n          yb: this.activeObject.aCoords.bl.y,\n          yc: this.activeObject.getCenterPoint().y,\n          x: this.activeObject.getCenterPoint().x,\n          type: 'center',\n        },\n        {\n          yt: this.activeObject.aCoords.tl.y,\n          yb: this.activeObject.aCoords.bl.y,\n          yc: this.activeObject.getCenterPoint().y,\n          x: this.activeObject.aCoords.tl.x,\n          type: 'left',\n        },\n        {\n          yt: this.activeObject.aCoords.tl.y,\n          yb: this.activeObject.aCoords.bl.y,\n          yc: this.activeObject.getCenterPoint().y,\n          x: this.activeObject.aCoords.tr.x,\n          type: 'right',\n        },\n      ];\n      const cOKeyPoints = [\n        {\n          yt: cObject.aCoords.tl.y,\n          yb: cObject.aCoords.bl.y,\n          yc: cObject.getCenterPoint().y,\n          x: cObject.getCenterPoint().x,\n          type: 'center',\n        },\n        {\n          yt: cObject.aCoords.tl.y,\n          yb: cObject.aCoords.bl.y,\n          yc: cObject.getCenterPoint().y,\n          x: cObject.aCoords.tl.x,\n          type: 'left',\n        },\n        {\n          yt: cObject.aCoords.tl.y,\n          yb: cObject.aCoords.bl.y,\n          yc: cObject.getCenterPoint().y,\n          x: cObject.aCoords.tr.x,\n          type: 'right',\n        },\n      ];\n      for (let p1 in aOKeyPoints)\n        for (let p2 in cOKeyPoints) {\n          this.findVerticalLine(aOKeyPoints[p1], cOKeyPoints[p2], cObject);\n        }\n    }\n\n    for (let i = this.hCandidateObjects.length; i--; ) {\n      let cObject = this.hCandidateObjects[i];\n      const aOKeyPoints = [\n        {\n          xl: this.activeObject.aCoords.tl.x,\n          xr: this.activeObject.aCoords.tr.x,\n          xc: this.activeObject.getCenterPoint().x,\n          y: this.activeObject.getCenterPoint().y,\n          type: 'center',\n        },\n        {\n          xl: this.activeObject.aCoords.tl.x,\n          xr: this.activeObject.aCoords.tr.x,\n          xc: this.activeObject.getCenterPoint().x,\n          y: this.activeObject.aCoords.tl.y,\n          type: 'top',\n        },\n        {\n          xl: this.activeObject.aCoords.tl.x,\n          xr: this.activeObject.aCoords.tr.x,\n          xc: this.activeObject.getCenterPoint().x,\n          y: this.activeObject.aCoords.bl.y,\n          type: 'bottom',\n        },\n      ];\n      const cOKeyPoints = [\n        {\n          xl: cObject.aCoords.tl.x,\n          xr: cObject.aCoords.tr.x,\n          xc: cObject.getCenterPoint().x,\n          y: cObject.getCenterPoint().y,\n          type: 'center',\n        },\n        {\n          xl: cObject.aCoords.tl.x,\n          xr: cObject.aCoords.tr.x,\n          xc: cObject.getCenterPoint().x,\n          y: cObject.aCoords.tl.y,\n          type: 'top',\n        },\n        {\n          xl: cObject.aCoords.tl.x,\n          xr: cObject.aCoords.tr.x,\n          xc: cObject.getCenterPoint().x,\n          y: cObject.aCoords.bl.y,\n          type: 'bottom',\n        },\n      ];\n\n      for (let p1 in aOKeyPoints)\n        for (let p2 in cOKeyPoints) {\n          this.findHorizontalLine(aOKeyPoints[p1], cOKeyPoints[p2], cObject);\n        }\n    }\n    if (!this.horizontalInTheRange) {\n      this.horizontalLines.length = 0;\n    }\n    if (!this.verticalInTheRange) {\n      this.verticalLines.length = 0;\n    }\n  }\n\n  findScaleGuideLines(e: any) {\n    this.verticalLines = [];\n    this.horizontalLines = [];\n    this.horizontalInTheRange = false;\n    this.verticalInTheRange = false;\n\n    // Which point must be crossed\n    switch (e.transform.corner) {\n      case 'bl':\n        this.scalePoint = {\n          x: this.activeObject.aCoords.bl.x,\n          y: this.activeObject.aCoords.bl.y,\n        };\n        break;\n      case 'br':\n        this.scalePoint = {\n          x: this.activeObject.aCoords.br.x,\n          y: this.activeObject.aCoords.br.y,\n        };\n        break;\n      case 'tl':\n        this.scalePoint = {\n          x: this.activeObject.aCoords.tl.x,\n          y: this.activeObject.aCoords.tl.y,\n        };\n        break;\n      case 'tr':\n        this.scalePoint = {\n          x: this.activeObject.aCoords.tr.x,\n          y: this.activeObject.aCoords.tr.y,\n        };\n        break;\n    }\n\n    for (let i = this.vCandidateObjects.length; i--; ) {\n      let cObject = this.vCandidateObjects[i];\n      const aOKeyPoints = [\n        {\n          yt: this.activeObject.aCoords.tl.y,\n          yb: this.activeObject.aCoords.bl.y,\n          yc: this.activeObject.getCenterPoint().y,\n          x: this.scalePoint?.x,\n          type: 'scale',\n        },\n      ];\n      const cOKeyPoints = [\n        {\n          yt: cObject.aCoords.tl.y,\n          yb: cObject.aCoords.bl.y,\n          yc: cObject.getCenterPoint().y,\n          x: cObject.aCoords.tl.x,\n          type: 'left',\n        },\n        {\n          yt: cObject.aCoords.tl.y,\n          yb: cObject.aCoords.bl.y,\n          yc: cObject.getCenterPoint().y,\n          x: cObject.aCoords.tr.x,\n          type: 'right',\n        },\n        {\n          yt: cObject.aCoords.tl.y,\n          yb: cObject.aCoords.bl.y,\n          yc: cObject.getCenterPoint().y,\n          x: cObject.getCenterPoint().x,\n          type: 'center',\n        },\n      ];\n      for (let p1 in aOKeyPoints)\n        for (let p2 in cOKeyPoints) {\n          this.findVerticalLine(aOKeyPoints[p1], cOKeyPoints[p2], cObject);\n        }\n    }\n\n    for (let i = this.hCandidateObjects.length; i--; ) {\n      let cObject = this.hCandidateObjects[i];\n      const aOKeyPoints = [\n        {\n          xl: this.activeObject.aCoords.tl.x,\n          xr: this.activeObject.aCoords.tr.x,\n          xc: this.activeObject.getCenterPoint().x,\n          y: this.scalePoint?.y,\n          type: 'scale',\n        },\n      ];\n      const cOKeyPoints = [\n        {\n          xl: cObject.aCoords.tl.x,\n          xr: cObject.aCoords.tr.x,\n          xc: cObject.getCenterPoint().x,\n          y: cObject.aCoords.tl.y,\n          type: 'top',\n        },\n        {\n          xl: cObject.aCoords.tl.x,\n          xr: cObject.aCoords.tr.x,\n          xc: cObject.getCenterPoint().x,\n          y: cObject.aCoords.bl.y,\n          type: 'bottom',\n        },\n        {\n          xl: cObject.aCoords.tl.x,\n          xr: cObject.aCoords.tr.x,\n          xc: cObject.getCenterPoint().x,\n          y: cObject.getCenterPoint().y,\n          type: 'center',\n        },\n      ];\n\n      for (let p1 in aOKeyPoints)\n        for (let p2 in cOKeyPoints) {\n          this.findHorizontalLine(aOKeyPoints[p1], cOKeyPoints[p2], cObject);\n        }\n    }\n    if (!this.horizontalInTheRange) {\n      this.horizontalLines.length = 0;\n    }\n    if (!this.verticalInTheRange) {\n      this.verticalLines.length = 0;\n    }\n  }\n\n  findHorizontalLine(aO: any, cO: any, cObj: any) {\n    if (this.isInRange(aO.y, cO.y)) {\n      this.horizontalInTheRange = true;\n      const aLine = {\n        y: cO.y,\n        x1: cO.xl < aO.xl ? cO.xl : aO.xl,\n        x2: cO.xr < aO.xr ? aO.xr : cO.xr,\n        x: aO.xc,\n        xalign: 'center',\n        yalign: aO.type,\n        type: 'h' + aO.type.substring(0, 1) + cO.type.substring(0, 1),\n        difference: cO.y - aO.y,\n        distance: cO.xc - aO.xc,\n        obj: cObj,\n      };\n      const el = this.horizontalLines.find((l: any) => {\n        l.type.substring(0, 2) === aLine.type.substring(0, 2);\n      });\n      if (!el) {\n        this.horizontalLines.push(aLine);\n      } else if (Math.abs(el.distance) > Math.abs(aLine.distance)) {\n        this.horizontalLines = this.horizontalLines.filter(function (l: any) {\n          return l.type.substring(0, 2) !== aLine.type.substring(0, 2);\n        });\n        this.horizontalLines.push(aLine);\n      } else if (\n        Math.abs(el.distance) === Math.abs(aLine.distance) &&\n        Math.abs(el.difference) >= Math.abs(aLine.difference)\n      ) {\n        this.horizontalLines = this.horizontalLines.filter(function (l: any) {\n          return l.type.substring(0, 2) !== aLine.type.substring(0, 2);\n        });\n        this.horizontalLines.push(aLine);\n      }\n    }\n  }\n\n  findVerticalLine(aO: any, cO: any, cObj: any) {\n    if (this.isInRange(aO.x, cO.x)) {\n      this.verticalInTheRange = true;\n      const aLine = {\n        x: cO.x,\n        y1: cO.yt < aO.yt ? cO.yt : aO.yt,\n        y2: cO.yb < aO.yb ? aO.yb : cO.yb,\n        y: aO.yc,\n        xalign: aO.type,\n        yalign: 'center',\n        type: 'v' + aO.type.substring(0, 1) + cO.type.substring(0, 1),\n        difference: cO.x - aO.x,\n        distance: cO.yc - aO.yc,\n        obj: cObj,\n      };\n\n      const el = this.verticalLines.find((l: any) => {\n        l.type.substring(0, 2) === aLine.type.substring(0, 2);\n      });\n      if (!el) {\n        this.verticalLines.push(aLine);\n      } else if (\n        Math.abs(el.distance) > Math.abs(aLine.distance) ||\n        (Math.abs(el.distance) === Math.abs(aLine.distance) &&\n          Math.abs(el.difference) >= Math.abs(aLine.difference))\n      ) {\n        this.verticalLines = this.verticalLines.filter(function (l: any) {\n          return l.type.substring(0, 2) !== aLine.type.substring(0, 2);\n        });\n        this.verticalLines.push(aLine);\n      }\n    }\n  }\n\n  scaleHandler(e: any) {\n    this.activeObject = e.target;\n    //this.activeObject.dirty = true;\n    //this.canvas.requestRenderAll();\n    if (this.skipActiveObject()) return;\n    this.activeObject.setCoords();\n    //let offset = this.canvas.getPositionOnCanvas(0, 0);\n    this.findCandidateObjects();\n    this.findScaleGuideLines(e);\n    this.findUniqueGuideLines();\n    //this.scaleSnap();\n  }\n\n  moveHandler(e: any) {\n    this.activeObject = e.target;\n    if (this.skipActiveObject()) return;\n    //this.activeObject.dirty = true;\n    //this.canvas.requestRenderAll();\n    //let offset = this.canvas.getPositionOnCanvas(0, 0);\n    this.activeObject.hasControls = false;\n    this.activeObject.setCoords();\n    this.findCandidateObjects();\n    this.findGuideLines();\n    this.findUniqueGuideLines();\n    this.snap();\n  }\n}\n"],"names":["alignmentGuideLines","constructor","canvas","_defineProperty","this","ctx","getSelectionContext","onObjectMoving","e","isScaling","moveHandler","onObjectScaling","scaleHandler","onBeforeRender","clearContext","renderTopLayer","onAfterRender","activeObject","font","debug","x","scalePoint","zoom","viewportTransform","y","fillText","JSON","stringify","getActiveObject","parent","getCenterPoint","verticalLines","forEach","vline","drawVerticalLine","horizontalLines","hline","drawHorizontalLine","onMouseUpRenderCanvas","length","isEditing","hasControls","requestRenderAll","onMouseDown","_ref","pointer","mouseDownPoint","_objectSpread","getZoom","initializeEvents","off","EventNames","OBJECT_MOVING","bind","OBJECT_SCALING","BEFORE_RENDER","AFTER_RENDER","on","snapLine","aLine","setPositionByOrigin","Point","xalign","yalign","coords","type","substring","padding","x1","y1","y2","x2","offsetY","lineColor","l","c","r","drawLine","offsetX","t","b","save","lineWidth","aligningLineWidth","strokeStyle","aligningLineColor","beginPath","moveTo","lineTo","stroke","restore","isInRange","value1","value2","Math","abs","margin","skipActiveObject","objType","angle","isPanelTitle","skipCandidateObject","currentObject","visible","group","id","isOnScreen","findCandidateObjects","masterMargin","canvasObjects","getObjects","candidateObjects","i","candidateObject","push","left","width","top","height","hCandidateObjects","vCandidateObjects","findUniqueGuideLines","compareABS","property","a","newVLines","map","Lines","filter","sort","newHLines","snap","scaleSnap","findGuideLines","horizontalInTheRange","verticalInTheRange","cObject","aOKeyPoints","yt","aCoords","tl","yb","bl","yc","tr","cOKeyPoints","p1","p2","findVerticalLine","xl","xr","xc","findHorizontalLine","findScaleGuideLines","transform","corner","br","_this$scalePoint","_this$scalePoint2","aO","cO","cObj","difference","distance","obj","el","find","target","setCoords"],"mappings":"sMAMO,MAAMA,EA4BXC,WAAAA,CAAYC,GAAaC,gBA3BX,MAAIA,aACP,MAAIA,4BACc,GAACA,sBACP,GAACA,gBACP,GAACA,2BACU,GAACA,2BACJ,WAASA,2BACT,MAAIA,cACd,GAACA,uBACK,IAAEA,yBACA,IAAEA,mBACR,MAAIA,wBACC,MAAIA,sBACN,MAAIA,iBACN,IAAEA,iBACF,IAAEA,iBACF,GAACA,0BACK,IAAEA,2BACD,IAAEA,2BACF,IAAEA,+BACK,GAAKA,6BACP,GAAKA,oBACjB,MAAIA,gBACL,GAAKA,wBACA,MAAIA,EAAAC,KAAA,qBAAA,GAIxBA,KAAKF,OAASA,EACdE,KAAKC,IAAMD,KAAKF,OAAOI,qBACzB,CAEAC,cAAAA,CAAeC,GACbJ,KAAKK,WAAY,EACjBL,KAAKM,YAAYF,EACnB,CAEAG,eAAAA,CAAgBH,GACdJ,KAAKK,WAAY,EACjBL,KAAKQ,aAAaJ,EACpB,CAIAK,cAAAA,GACET,KAAKF,OAAOY,aAAaV,KAAKC,KAC9BD,KAAKF,OAAOa,eAAeX,KAAKC,IAClC,CAEAW,aAAAA,GACE,GAAIZ,KAAKa,aAAc,C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