/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{subtract as e,add as t,exactEquals as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VerticalPlaneConstraint as s}from"../../sketch/constraints.js";import{fromVec3 as n}from"../../sketch/normalizedPoint.js";import{SnappingCandidate as a}from"./SnappingCandidate.js";import{LineSnappingHint as f}from"../hints/LineSnappingHint.js";import{ParallelSnappingHint as d}from"../hints/ParallelSnappingHint.js";class h extends a{constructor({referenceLine:i,lineStart:a,targetPoint:f,isDraped:d}){const h=r(a),{left:o,right:g}=i;e(h,t(h,h,g),o),super(f,new s(a,n(h)),d,2),this._referenceLines=[{edge:i,fadeLeft:!0,fadeRight:!0}]}get hints(){return[new f(0,this.constraint.start,this.targetPoint,this.isDraped,this.domain),new d(this.constraint.start,this.targetPoint,this.isDraped,this.domain),...this._referenceLines.map(e=>new f(1,e.edge.left,e.edge.right,this.isDraped,this.domain,e.fadeLeft,e.fadeRight))]}addReferenceLine(e){const t={edge:e,fadeLeft:!0,fadeRight:!0};this._referenceLines.forEach(r=>{i(e.right,r.edge.left)&&(r.fadeLeft=!1,t.fadeRight=!1),i(e.right,r.edge.right)&&(r.fadeRight=!1,t.fadeRight=!1),i(e.left,r.edge.right)&&(r.fadeRight=!1,t.fadeLeft=!1),i(e.left,r.edge.left)&&(r.fadeLeft=!1,t.fadeLeft=!1)}),this._referenceLines.push(t)}}export{h as ParallelLineSnappingCandidate};
