@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 548 B
JavaScript
export default class s{x1;x2;y1;y2;constructor(t,x,y,h){this.x1=t,this.y1=x,this.x2=y,this.y2=h}static fromSvgLineElement(t){return new s(t.x1.baseVal.value,t.y1.baseVal.value,t.x2.baseVal.value,t.y2.baseVal.value)}static fromRect(t){return[new s(t.x1,t.y1,t.x2,t.y1),new s(t.x2,t.y1,t.x2,t.y2),new s(t.x2,t.y2,t.x1,t.y2),new s(t.x1,t.y2,t.x1,t.y1)]}intersects(t){const x=this.x1>this.x2||this.x1===this.x2&&this.y2<this.y1,y=x?this.x2:this.x1,h=x?this.x1:this.x2,a=x?this.y2:this.y1,e=x?this.y1:this.y2;return h>=t.x1&&y<=t.x2&&e>=t.y1&&a<=t.y2}}