From f67d5094038c0315f57324f8b51dd15b091d64b3 Mon Sep 17 00:00:00 2001 From: dre Date: Thu, 24 Aug 2023 16:05:48 +0200 Subject: [PATCH] For testing: ERK-45, ERK-41,ERK-28 --- .../SSG/shapes/palettes/c_Parts.xml | 2 + .../SSG/shapes/props/s_Kreisel.txt | 2 +- .../SSG/shapes/props/s_weiche_aktiv.txt | 32 + .../SSG/shapes/props/s_weiche_passiv.txt | 32 + .../SSG/shapes/svg/s_weiche_aktiv.xml | 11 + .../SSG/shapes/svg/s_weiche_passiv.xml | 11 + .../SSG/theme/images/e2d/icon_add_grid_24.png | Bin 0 -> 703 bytes .../theme/images/e2d/icon_dwg_import_24.png | Bin 0 -> 922 bytes .../theme/images/e2d/icon_export_csv_24.png | Bin 0 -> 810 bytes .../SSG/theme/jquery-ui-custom.css | 6 +- MAIN_SSG.rdx | 1996 ++++++++++++----- SVGs/Weiche_aktiv.svg | 61 + SVGs/Weiche_passiv.svg | 61 + SVGs/icon_add_grid_32.png | Bin 0 -> 469 bytes SVGs/icon_add_grid_64x64.svg | 13 + SVGs/icon_dwg_import_32.png | Bin 0 -> 1094 bytes SVGs/icon_dwg_import_64x64.svg | 62 + SVGs/icon_export_csv_32.png | Bin 0 -> 978 bytes SVGs/icon_export_csv_64x64.svg | 43 + main.min.js | 2 +- 20 files changed, 1743 insertions(+), 591 deletions(-) create mode 100644 Editor2DLibrary/SSG/shapes/props/s_weiche_aktiv.txt create mode 100644 Editor2DLibrary/SSG/shapes/props/s_weiche_passiv.txt create mode 100644 Editor2DLibrary/SSG/shapes/svg/s_weiche_aktiv.xml create mode 100644 Editor2DLibrary/SSG/shapes/svg/s_weiche_passiv.xml create mode 100644 Editor2DLibrary/SSG/theme/images/e2d/icon_add_grid_24.png create mode 100644 Editor2DLibrary/SSG/theme/images/e2d/icon_dwg_import_24.png create mode 100644 Editor2DLibrary/SSG/theme/images/e2d/icon_export_csv_24.png create mode 100644 SVGs/Weiche_aktiv.svg create mode 100644 SVGs/Weiche_passiv.svg create mode 100644 SVGs/icon_add_grid_32.png create mode 100644 SVGs/icon_add_grid_64x64.svg create mode 100644 SVGs/icon_dwg_import_32.png create mode 100644 SVGs/icon_dwg_import_64x64.svg create mode 100644 SVGs/icon_export_csv_32.png create mode 100644 SVGs/icon_export_csv_64x64.svg diff --git a/Editor2DLibrary/SSG/shapes/palettes/c_Parts.xml b/Editor2DLibrary/SSG/shapes/palettes/c_Parts.xml index 519f20c..0ff8e7d 100644 --- a/Editor2DLibrary/SSG/shapes/palettes/c_Parts.xml +++ b/Editor2DLibrary/SSG/shapes/palettes/c_Parts.xml @@ -6,4 +6,6 @@
Spannstation links
StandardBand
Pin-Band
+
Weiche aktiv
+
Weiche passiv
\ No newline at end of file diff --git a/Editor2DLibrary/SSG/shapes/props/s_Kreisel.txt b/Editor2DLibrary/SSG/shapes/props/s_Kreisel.txt index 0bca878..fcbc4fc 100644 --- a/Editor2DLibrary/SSG/shapes/props/s_Kreisel.txt +++ b/Editor2DLibrary/SSG/shapes/props/s_Kreisel.txt @@ -8,6 +8,6 @@ "width": 14362.2047, "height": 3023.622, "depth": 1897.3228, - "behaviour": "(NOSTRETCH)(NOSTRETCHONVIEW)(NOROTATE)(NOROTATEONVIEW)(ORIGIN=CENTER)", + "behaviour": "(NOSTRETCH)(NOSTRETCHONVIEW)(NOROTATE)(NOROTATEONVIEW)(HIDEDIMENSIONS)(HIDEROTATION)(HIDEPIN)(HIDEUPDATEBUTTON)(SHOWCONFIGUREBUTTON)(ORIGIN=CENTER)", "eventClass": "OnDoubleclick,OnInserted,OnLinked,OnPasted" } \ No newline at end of file diff --git a/Editor2DLibrary/SSG/shapes/props/s_weiche_aktiv.txt b/Editor2DLibrary/SSG/shapes/props/s_weiche_aktiv.txt new file mode 100644 index 0000000..b622f4c --- /dev/null +++ b/Editor2DLibrary/SSG/shapes/props/s_weiche_aktiv.txt @@ -0,0 +1,32 @@ +{ + "shapeMode": 0, + "name": "Weiche aktiv", + "family": "Weiche", + "icon": "SSG/shapes/img/", + "srcSVG": "SSG/shapes/svg/s_weiche_aktiv.xml", + "width": 377.9528, + "height": 377.9528, + "depth": 377.9528, + "behaviour": "(NOSTRETCH)(NOROTATE)(NOROTATEONVIEW)(ALWAYSFRONT)(ORIGIN=CENTER)", + "connectionPoints": [ + { + "id": "cp0", + "x": 500.0, + "y": 500.0, + "z": 0.0, + "xMin": "", + "xMax": "", + "xStep": "", + "yMin": "", + "yMax": "", + "yStep": "", + "zMin": "", + "zMax": "", + "zStep": "", + "direction": 0.0, + "label": "", + "isDimension": true + } + ], + "eventClass": "OnDoubleclick,OnPasted,OnLinked,OnInserted" +} \ No newline at end of file diff --git a/Editor2DLibrary/SSG/shapes/props/s_weiche_passiv.txt b/Editor2DLibrary/SSG/shapes/props/s_weiche_passiv.txt new file mode 100644 index 0000000..53d551e --- /dev/null +++ b/Editor2DLibrary/SSG/shapes/props/s_weiche_passiv.txt @@ -0,0 +1,32 @@ +{ + "shapeMode": 0, + "name": "Weiche passiv", + "family": "Weiche", + "icon": "SSG/shapes/img/", + "srcSVG": "SSG/shapes/svg/s_weiche_passiv.xml", + "width": 377.9528, + "height": 377.9528, + "depth": 377.9528, + "behaviour": "(NOSTRETCH)(NOROTATE)(NOROTATEONVIEW)(ALWAYSFRONT)(ORIGIN=CENTER)", + "connectionPoints": [ + { + "id": "cp0", + "x": 500.0, + "y": 500.0, + "z": 0.0, + "xMin": "", + "xMax": "", + "xStep": "", + "yMin": "", + "yMax": "", + "yStep": "", + "zMin": "", + "zMax": "", + "zStep": "", + "direction": 0.0, + "label": "", + "isDimension": true + } + ], + "eventClass": "OnDoubleclick,OnPasted,OnLinked,OnInserted" +} \ No newline at end of file diff --git a/Editor2DLibrary/SSG/shapes/svg/s_weiche_aktiv.xml b/Editor2DLibrary/SSG/shapes/svg/s_weiche_aktiv.xml new file mode 100644 index 0000000..0af0b6e --- /dev/null +++ b/Editor2DLibrary/SSG/shapes/svg/s_weiche_aktiv.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Editor2DLibrary/SSG/shapes/svg/s_weiche_passiv.xml b/Editor2DLibrary/SSG/shapes/svg/s_weiche_passiv.xml new file mode 100644 index 0000000..e708554 --- /dev/null +++ b/Editor2DLibrary/SSG/shapes/svg/s_weiche_passiv.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Editor2DLibrary/SSG/theme/images/e2d/icon_add_grid_24.png b/Editor2DLibrary/SSG/theme/images/e2d/icon_add_grid_24.png new file mode 100644 index 0000000000000000000000000000000000000000..941003fcfcdcd9d013801ae263b33cdfca7a61a6 GIT binary patch literal 703 zcmV;w0zmzVP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TA{B|HgfBpRB0I6R$CiZHup;b`NRwKSF4~0F{Tj6OJd^XQ zF{$0(#xHr!ob%2*@60Xm zYZ!x{pnoj~x*3jxos{10!2wv;aRwa8MOXzJJ9fZ#xCy&qJvf*e+aHAcFzd)<2BzRs z$45{G`v&hj-oSEjl)mftuEF+`Fb#uA-O}`<*xU4DSG9jD>xyq3XjxaPG)}$W;^>w3 z_*>Te5zB{jZMrU|i>92*!(gh?wO*TK0}F02chc~20_ zJ@6Hre_EW?cd5eW6o!8P2I*(-cujN-ukz)u1sqJxI>(;72r-;3CedJ9g&ndMYaFx z25r`rooM4SPyb5k;3YhUAKkY*!0qT3eF}A^r{NVm0{zQWRI zMd=iK$|ydqe=FPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TO+@#@5hxFiub21QgB^}Sc$TRI|Uq7yIh8h22Q zaX5i`7?W`m$HQ3^m7pD4FdCcjA3oq6PT|J^dW zc#nB_g}-nFHafrtQZUwFFD%b5*pGi>;z^ceX~qng z>@mkAc~DqbXtJL%9p39R$@9awY9ZzS63I6ibF$O`v@Dz6`?Z8I>)}ILi;p^U?~Gx!_kTGY543atcC;JZ{%yhy8cZ?c5)n6Qc@Bz zu;GX7(GT~b1DNZD{vuxk?m>tAQdwCURaI3*MMaJ`BUoM@)ztW6AzaCgycvbC}DVVK=SA0=Rd) w$zJ=Gu;ebx#c)TB+-}doAHJuvQ4~%6A9pbY#LWr~RsaA107*qoM6N<$f+3otMgRZ+ literal 0 HcmV?d00001 diff --git a/Editor2DLibrary/SSG/theme/images/e2d/icon_export_csv_24.png b/Editor2DLibrary/SSG/theme/images/e2d/icon_export_csv_24.png new file mode 100644 index 0000000000000000000000000000000000000000..197899f205ad98eb3209c81706df0b0c2aa46251 GIT binary patch literal 810 zcmV+_1J(SAP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGbzW@LSzX765EqDL`0>4Q_K~zXft<_72 zPf-BJ@jHM1%ouNFjK_pf7RF=Jlt&iItBkS}%1RN1Y}o#r6$_-)WPFEjtfe`4lWpZTAA?!D)nd(J&~0x}m@5e_ihtSsWsb<99B zz95DEq!Yui4o|GGw-XiyIJOxkqx~BHCMm-_IDHeWAR{mb)=k1pOhorghO=RQx9Jlc z=_&?;upM{s4)1XpKJIC}hV^&Rh+C+DvBMiU6&-c8Y1=(I*npqNq8iJv250dBo3Q}v z*G5Nw>EJdVVS04*CtKjt+`~qU$7o!`eK=K)-ttJ8sDu1BW-vY@e@#xp zkveq;(26lQgW1@FML3F&=#lPEkUDOiG0a6r4@H9O$QAHy~tB3WS5>lBT{ zIlM$0-onMah*x+4>#txc%pur@gX^BC12>u{eKg-5lg47qijIQd0bJmPaDMI7De`SH zKE+bpM9zvhcCgKY9UQhWz_HEf30zd)fW7#JWZ~WN&+#3ugX)?&$sZ`1}XovH!cIqzi>-2by*Lsil+JRfV}+E?$8!Y-?)^tE;P>A{~pb{jd1w#}U@m)rFm% zolytbY&L1!Z@*LZ|4FCQ!}+O4SYKZsHZ(LOjW=-44`BaOTwLs@*?&4o - + @@ -17,9 +17,9 @@ - + - + @@ -35,10 +35,12 @@ + + - + @@ -46,11 +48,17 @@ + + + + + + @@ -65,366 +73,366 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - - + + - + - - - - - - + + + + + + - + - + - - - - - - - - + + + + + + + + - + - - - + + + - + - - - + + + - + - - - - - - - - - - - + + + + + + + + + + + - + - + - + - + - + @@ -637,18 +645,22 @@ - + - + - + + + + + @@ -663,6 +675,7 @@ + @@ -684,6 +697,7 @@ + @@ -697,6 +711,10 @@ + + + + @@ -745,13 +763,22 @@ + - + + + + + + + + + @@ -776,10 +803,18 @@ + + + + + + + + @@ -925,6 +960,10 @@ + + + + @@ -1061,19 +1100,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Shape_Prototype.KreiselDefinition.Drehung]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1469,6 +1238,222 @@ me.x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1613,6 +1598,225 @@ me.x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2597,6 +2801,9 @@ me.x + + + @@ -2670,8 +2877,6 @@ me.x - - @@ -3229,7 +3434,7 @@ KreiselData.AbstandMS+(KreiselData.Durchmesser/2) - + @@ -3599,7 +3804,7 @@ KreiselData.AbstandMS+(KreiselData.Durchmesser/2) - + @@ -3631,7 +3836,7 @@ KreiselData.AbstandMS+(KreiselData.Durchmesser/2) - + Shape_Prototype.rotation,Shape_Prototype.rotation,Shape_Prototype.KreiselDefinition.OrientierungHV)]]> @@ -3881,6 +4086,10 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + @@ -4136,7 +4345,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) ]]> - + @@ -4149,7 +4358,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + @@ -4275,6 +4484,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + @@ -4318,7 +4528,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + @@ -4345,7 +4555,9 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + + + @@ -4369,7 +4581,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + @@ -4406,6 +4618,50 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4474,23 +4730,6 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - - - - - - - - - - - - - - - - - @@ -4699,6 +4938,23 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + @@ -5539,6 +5795,75 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5547,6 +5872,72 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6184,6 +6575,38 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6802,6 +7225,59 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7240,6 +7716,61 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7268,7 +7799,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + @@ -7396,7 +7927,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + @@ -7437,7 +7968,9 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + + + @@ -7456,8 +7989,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) (ACTION=DELETE_CPs_M,icon:delete,Gewählte Verbindungspunkte entfernen) (ROWACTION=DELETE_CP_M,icon:delete,Verbindungspunkt entfernen) (ENABLESELECTALL) -(SELECTION=MULTIPLE) -]]> +(ENABLESELECTIONASYNC)]]> @@ -8133,6 +8665,298 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8244,7 +9068,7 @@ ShapeTotalLength-SSGConnectionPoint.x_S-(KreiselData.Durchmesser/2) - + diff --git a/SVGs/Weiche_aktiv.svg b/SVGs/Weiche_aktiv.svg new file mode 100644 index 0000000..3fe8bab --- /dev/null +++ b/SVGs/Weiche_aktiv.svg @@ -0,0 +1,61 @@ + + + + + + + + + + diff --git a/SVGs/Weiche_passiv.svg b/SVGs/Weiche_passiv.svg new file mode 100644 index 0000000..ab24502 --- /dev/null +++ b/SVGs/Weiche_passiv.svg @@ -0,0 +1,61 @@ + + + + + + + + + + diff --git a/SVGs/icon_add_grid_32.png b/SVGs/icon_add_grid_32.png new file mode 100644 index 0000000000000000000000000000000000000000..5e1614f166af6d1cdb16de3f29e8462380161099 GIT binary patch literal 469 zcmV;`0V@89P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10b)r+ zK~z|U?boqt8$l2T;BSQt>J0%yz>vy~Q5CCjiZqb|s?(}Sp~jtEq;;Lb58%$7Ti2;W zVizWPfE0l|LSl(HXkBQ}IxcrYMWjn{KMXg=?Ck&FvOBjU#s~vkV~V(Do8mJDiQ8+; zHb7jo8Tuiq>ERpB@W%psc$@rF-1!^t)AJIyCGjHKIKi{TZITp?V~p~KVNUUOF`mX` z@ljd4B4?a(CM|T5vgr!y{}nQ>PHTgtrDy~M^UVNX@uLubg6GNqfZru^4433r;VHUB z0kxo=^KbCI5Z}RzPGt@{jPdWR8m^`BgYH|0ScT1C4-2KqKHk5b$_M-yrW}FVZ%@O!n|Dgs_GC+`#>u zKMEoIS~BU&5W*@Sv1L)-zcBBN>uOG4Wwp7FPZoXRI&G4;`Y}ci3`lPI@63I%00000 LNkvXXu0mjf6C2T4 literal 0 HcmV?d00001 diff --git a/SVGs/icon_add_grid_64x64.svg b/SVGs/icon_add_grid_64x64.svg new file mode 100644 index 0000000..484e70a --- /dev/null +++ b/SVGs/icon_add_grid_64x64.svg @@ -0,0 +1,13 @@ + + + Layer 1 + + + + + + + + + + \ No newline at end of file diff --git a/SVGs/icon_dwg_import_32.png b/SVGs/icon_dwg_import_32.png new file mode 100644 index 0000000000000000000000000000000000000000..66108b231942b30942622a662fa7ac7b92597e4a GIT binary patch literal 1094 zcmV-M1iAZ(P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H11Jg-F zK~z|U#n)SiR#g-S@ZX+`T@(eyX`-UE0h6ScvLGm_hoC4E!b0sv_Ry0LSw?}-L$?R% zg3v?IMW)o3NFwY4^)gfl88~87l!jVfX0UNa#~EkT-NRXDIF0koj1z+k4&S%`XRZJG z@3q(7-~QyBVK@G&Jnh(o8{_>8=*0UuXMx>?L)e45!0PZ@;I{_$0KUf&oQTieSd(*B zlJ%kwheN;#3_CD|67jkr4lyDfZrF%9p<`~Hg9LowbkQb0Er$M_PwiIX^v zt11F+Lqp&LA)+)P_Y-6;u?I6(|8C^p%HJRD|}Yq%2>MXn1?g?5mHKbrZpDWo=AHQ5n{)1tsy2jp_y@aiFe=kn&a~DNtW-2( z59SBfLUasJO z1U7({z-9!`kYWpehPUu_Ozb}by2CLmn(nw_%Pb$!z1N4RJ}juSzlS# z1LOFXr|J3$@GfsqG!R9XZmFSoPvv_fEM2-(b93`B*xK5vzrTO@JwC;+HTYKH!7}$? zs98AHky)w0VdS>9wp_KQrlxXMw@-j$VfYT#RTK}^P&*Y?=4u@8D4ue==mHuh;*?T) z9*@Lu&N%KLq?Ar7cFW50!1-SS6hFT=RDqc@XBs)~?CgXE0o{!2)ZPihR(5a87+rg> z_^p^bcW&Oid2=3VJ9qBPOO`CD?(uiW;A<)UCe#Bt=P&ULbai!UZ*M=(r?0QijvYJ7 z;dZQ<2=|04P*MI$>A!K~#^Kp_badp|vuBq)KVil=JS~;H7bGCzBjoz}`n+x1w%pm- znOj;~N{)TFVgfvq6A;1E@GbK6>C^L~MT^S#V=8xqDH9L`vlM?W%GiF~aRKoc)`aIZ zP0l^I4}UAJ>QCgH+a|*`(Q{xl5eHLBwG~gH9 zg!L( + + + + Layer 1 + + + + + + + + + + + diff --git a/SVGs/icon_export_csv_32.png b/SVGs/icon_export_csv_32.png new file mode 100644 index 0000000000000000000000000000000000000000..c8068e3115d65bbfb2522a28ad1c4828727994b8 GIT binary patch literal 978 zcmV;@11Vl&|00009a7bBm000NT z000NT0q~#qRR9108FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H117Ar* zK~zYI#nxYJ-cuL{@Xu*W;!ngjF$A@QSh^rHvLQ{VZBlM3blF`K5ew6>gc8?+3oa0K zhYKRIyGc53tZ_9eaV28*htXKDwN|Zaw>>V-dF!{WZ{K#Tdy+;0G>mW^064Cr;fga{aAq~vD4X?`|&3BC!9dSWf5`sY%`~nmf?3qQz0gY zVlkw~lUnK_QcCyW3EWr|_Tn83U=y}rIga8pT!>roT14!q*trR><7f2D=1E{_M35u# z5yml5l!oya2Js>$F@_&-1k-rAV7`wCwSnz8jHc|74snki5{K|7I_69MdGY?~*~lwKE|n8<7*psg>mL{WT_tA@ zBF&e4TS=T>adSoK3bdjNmsHkYlJAOl%Y1DijpD@CQ=FcY{Je7d2|4k8DUM9aH`A0{ zUc)7?1H_5g9A-*Z=%M0-iyc!XEDrUB! zPfon?Q#opq{Cndpi-;rjfd7}Il$PQ!rLCPSX_89?u3jY0Ys&9P3qHkW>`EzpZT1H9 zctq??DP4y*aKS8?Nx3}trIfD6+p}O2R+sOcEN_X3 zLn);@um;!G3Dtq}+YIgP?RtBAXEyu$`wb2b&g>WbraHC`;;V=_-U1PE3}2MdP+D7C zb$55q%m)SrPTG%%QMsGVDd#-f&zaPH$rF=6r$0f!pOC9bH{rF+DvUJv}`&;&I%yAbSe|7YEkM_js&axw1z5cM0{v zY%NrwIM6LWkwSj4Y(679XQEUbcvLQ@EoW-uA1xKfKRg>(s{jB107*qoM6N<$g3J2N AssI20 literal 0 HcmV?d00001 diff --git a/SVGs/icon_export_csv_64x64.svg b/SVGs/icon_export_csv_64x64.svg new file mode 100644 index 0000000..68fe461 --- /dev/null +++ b/SVGs/icon_export_csv_64x64.svg @@ -0,0 +1,43 @@ + + + + + + + + + + diff --git a/main.min.js b/main.min.js index 48e3fb4..2f057c9 100644 --- a/main.min.js +++ b/main.min.js @@ -1 +1 @@ -function SVGRenderer(){this.svgRoot=null,this.svgPage=null,this.SVG_ROOT_ID="SVG_ROOT",this.SVG_PAGE_ID="SVG_PAGE",this.SVG_PAGE_GRID_ID="SVG_PAGE_GRID",this.TRACKER_COLOR="#63afda",this.BACKGROUND_ID="usrBackground",this.MULTIPLE_SELECTOR_TRACKER_ID="multiple-select-tracker",this.MULTIPLE_SELECTOR_DUMMY_ID="multiple-select-dummy",this.TRACKER_GROUP_ID="tracker-group",this.LINE_TRACKER_GROUP_ID="line-tracker",this.QUOTE_A="quoteA",this.QUOTE_B="quoteB",this.QUOTE_STACK=10,this.QUOTE_TYPE=0,this.QUOTE_DRIVING=!1,this.MAX_WIDTH=1e5,this.MAX_HEIGHT=1e5,this.COORD_X=1e3,this.COORD_Y=1e3,this.COORD_Z=1e3,this.LINE_DELIMITER="\n",this.lastSnapLineOrientation=null,this.shapeFolder="/shapes/svg/",this.propsFolder="/shapes/props/",this.svgNamespace="http://www.w3.org/2000/svg",this.xlinkNamespace="http://www.w3.org/1999/xlink",this.cachedObjects=new E2DCache,this.cachedProperties=new E2DCache,this.snapLine=null,this.polyQuote=null,this.isSnapLineShowing=!1,this.isPolyQuoteShowing=!1,this.textDataHash=[],this.zoom=1,this.enableFloor=!1,this.floorDefinition=null}function E2DEditor(e,t){this.container=e,this.SURROUND_ID="E2DSurround",this.ORIGIN_ID="origin",this.CUSTOM_ORIGIN_ID="customOrigin",this.CONNECTION_POINT_CLASS="connectionPoint",this.unit="mm",this.language="en",this.numberOfDecimal=2,this.width="420mm",this.height="297mm",this.DEFAULT_PAGE_WIDTH="420mm",this.DEFAULT_PAGE_HEIGHT="297mm",this.DPI=96,this.conversionFactor=1/this.DPI*25.4,this.scale=1,this.orientation="LANDSCAPE",this.showGrid=!0,this.GRID_ROTATE=5,this.GRID_SIZE_IN=24,this.GRID_SIZE_MM=this.DPI/25.4*5,this.GRID_SIZE=this.GRID_SIZE_MM,this.zoom=1,this.zoomStep=.1,this.needRefresh=!1,this.prevRect={},this.prevMode="",this.mode="select",this.resizeMode="",this.selectConnectorMode=!1,this.selected=null,this.selectedBehaviour=null,this.includeConnectionPoints=!0,this.checkInclusions=!0,this.checkCollisions=!0,this.checkBackgroundCollisions=!0,this.checkQuotes=!0,this.persistentInclusions=!1,this.persistentCollisions=!1,this.activeBackground=!0,this.textEditMode=!1,this.textToolBeginNew=!0,this.groupInfo={},this.groupProp=null,this.groupPropID=null,this.collidingGhosts=[],this.externalGhosts=[],this.overlappingGhosts=[],this.origin={x:0,y:0,z:0,signX:1,signY:1,signZ:1,position:"tl",background:!1},this.customOrigin=null,this.quotesOff=!1,this.highlightEqualShapes=!1,this.connectorToolsEnabled=!0,this.drawToolsEnabled=!0,this.textToolsEnabled=!0,this.gridPatternToolsEnabled=!0,this.zIndexToolsEnabled=!0,this.showHelpEnabled=!0,this.showHelpPopupEnabled=!0,this.showActionsEnabled=!0,this.polyLinePropertiesEnabled=!0,this.quotePropertiesEnabled=!0,this.shapePropertiesEnabled=!0,this.quoteUOMEnabled=!0,this.snapToObject=!1,this.snapToPolyline=!1,this.snapToShapeCenter=!1,this.snapToThreshold=this.GRID_SIZE,this.clearCacheCount=0,this.connectionPointToolsEnabled=!1,this.zoomFit=!1,this.quickPickIgnoreThreshold=0,this.enterBehaviour="close",this.polyLineProps={table:"polyLineProperties",units:$("#_dpUnits"),length:$("#_dpLength"),rotation:$("#_dpRotation")},this.quoteProps={table:"quoteProperties",units:$("#_qUnits"),value:$("#_qValue"),type:$("#_qType"),driving:$("#_qDriving")},this.shapeProps={table:"shapeProperties",name:$("#_shapeName"),units:$("#_shapeUnits"),image:$("#_shapeImage"),x:$("#_x"),y:$("#_y"),z:$("#_z"),width:$("#_width"),height:$("#_height"),depth:$("#_depth"),rotation:$("#_rotation"),layer:$("#_layer"),pin:$("#_pinShape")},this.events={inserted:!1,pasted:!1,removed:!1,linked:!1,stretched:!1,rotated:!1,regrouped:!1,doubleclick:!1,polyinserted:!1,editconnectionpoints:!1},this.clipboard=null,this.iClipboard=null,this.selectedBounds={x:0,y:0,z:0,width:0,height:0,depth:0},this.multipleSelectShapes=new SelectedShapes(t),this.insertedShapes=new InsertedShapes,this.libraryCategories=[],this.libraryCategoriesTree=null,this.libraryClasses={},this.libraryLanguage={},this.libraryProperties={},this.libraryLayers={},this.shapeLibraryList=["DefaultLibrary"],this.shapeLibraryHideList=[],this.shapeLibraryOpenList=[],this.libraryLoaded=$.Deferred(),this.preferencesLoaded=$.Deferred(),this.viewportLoaded=$.Deferred(),this.shapesLoaded=$.Deferred(),this.onselect=E2DEvents.onSelect,this.onunselect=E2DEvents.onUnselect,this.enable3d=!1,this.enable3dDinamicLights=!1,this.enable3dGround=!0,this.enable3dViewStyle="TOP",this.enable3dFloor=!1,this.enable3dFloorDefinition={color:"#75673f",image:null,thickness:.5},this.enable3dWalls=!1,this.show3dWalls=!0,this.show3dShadows=!0,this.enable3dWallDimensions="3000|1",this.image2DExported=null,this.image3DExported=null,this.exportImage2D=!1,this.exportImage3D=!1,this.renderer=t,this.renderer.init(this.container[0]),this.renderer3d=null,this.undoManager=new E2DUndoManager,this.undoManager.init(10,this.updateUndoRedoButtons),this.attachEditorEvents()}function E2DCache(){var e={};return{get:function(t){return e[t]},contains:function(t){return t in e},remove:function(t){delete e[t]},set:function(t,i){e[t]=i},values:function(){return e},getSet:function(e,t){return this.contains(e)||this.set(e,"function"==typeof t?t():t),this.get(e)}}}function InsertedShape(){this.source=null,this.sourceLibrary=null,this.signature=null,this.id=null,this.group=null,this.name=null,this.family=null,this.description=null,this.layer=null,this.x=0,this.y=0,this.z=0,this.width=0,this.height=0,this.depth=0,this.rotation=0,this.text=null,this.behaviour=null,this.collisionClass=null,this.containerClass=null,this.eventClass=null,this.linkClass=null,this.snapClass=null,this.links=[],this.lineConnections={from:{shapeID:"",pointID:""},to:{shapeID:"",pointID:""}},this.shapeConnections=[],this.connectionPoints=null,this.path="",this.ctrl1x=-1,this.ctrl1y=-1,this.ctrl2x=-1,this.ctrl2y=-1,this.shapeFromId=null,this.shapeFromPointIndex=null,this.shapeToId=null,this.shapeToPointIndex=null,this.dimStack=10,this.dimType=0,this.dimDriving=!1,this.dimValue=0,this.color=null,this.colorOpacity=null,this.lineColor=null,this.lineWidth=null,this.lineOpacity=null,this.color3D=null,this.colorOpacity3D=null,this.lineColor3D=null,this.lineOpacity3D=null,this.image=null,this.imageSVG=null,this.pinned=!1,this.includeInBOM=!1,this.modified=!1,this.selected=!1,this.custom={},this.calculatedBehaviour=null,this.calculatedPinned=null}function InsertedShapes(){this.insertedShapeMap={},this.alwaysInBack={},this.alwaysInFront={},this.origin=null,this.customOrigin=null,E2DEventBus.addEventListener("shapeSelected",this.onShapeSelected,this),E2DEventBus.addEventListener("shapeMultiSelected",this.onShapeSelected,this)}function SelectedShapes(e){this.bbox={x:null,y:null,width:null,height:null,depth:null,right:null,bottom:null,ceiling:null},this.selectedShapeMap={},this.selectedShapeBounds={},this.renderer=e,this.idHighest=null,this.idLowest=null,this.idLowestZ=null,this.idHighestZ=null,this.prevSelected=null,this.firstSelectionGhostID=null}function E2DEventArgument(e,t,i,n,o,s){this.class=e,this.handler=t,this.connectionPointID=i,this.shapeID=n,this.group=o,this.options=s}SVGRenderer.prototype.init=function(e){this.container=e,this.svgRoot=this.createElement("svg"),this.svgRoot.setAttribute("xmlns",this.svgNamespace),this.svgRoot.setAttribute("xmlns:xlink",this.xlinkNamespace),this.svgRoot.setAttribute("xml:space","preserve"),this.svgRoot.id=this.SVG_ROOT_ID,this.svgRoot.style.position="absolute",this.svgRoot.style.zIndex=10,this.svgRoot.style.opacity="1.0",this.svgRoot.style.MozUserSelect="none",this.svgRoot.setAttributeNS(null,"x","0"),this.svgRoot.setAttributeNS(null,"y","0"),this.svgRoot.setAttributeNS(null,"width",this.MAX_WIDTH),this.svgRoot.setAttributeNS(null,"height",this.MAX_HEIGHT);var t=this.container.firstChild;this.container.insertBefore(this.svgRoot,t),this.addSVGRootDefinitions();var i=this.createElement("g");i.id=this.SVG_PAGE_ID,this.svgPage=this.createElement("rect"),this.svgPage.id=this.SVG_PAGE_GRID_ID,this.svgPage.setAttributeNS(null,"x","0"),this.svgPage.setAttributeNS(null,"y","0"),this.svgPage.setAttributeNS(null,"width","500"),this.svgPage.setAttributeNS(null,"height","500"),this.svgPage.setAttributeNS(null,"stroke-width","0"),this.svgPage.setAttributeNS(null,"fill","url(#gridin)"),i.appendChild(this.svgPage),this.svgRoot.appendChild(i)},SVGRenderer.prototype.initFloor=function(e,t){if(this.enableFloor=e,this.floorDefinition=t,e&&t){const e=this.svgRoot.getElementsByTagName("defs")[0],t=this.createFloorPattern();e.appendChild(t)}},SVGRenderer.prototype.dispose=function(){this.removeSystemShapes()},SVGRenderer.prototype.initSystemShapes=function(e){this.loadShape(e[0],"link-line",this),this.loadShape(e[0],"quote-line",this),this.loadShape(e[0],"snap-line",this).done(this.setSnapLine.bind(this)),this.loadShape(e[0],"poly-quote",this).done(this.setPolyQuote.bind(this)),this.loadShape(e[0],this.TRACKER_GROUP_ID,this).done(this.createTracker.bind(this)),this.loadShape(e[0],this.LINE_TRACKER_GROUP_ID,this).done(this.createLineTracker.bind(this)),this.loadShape(e[0],this.MULTIPLE_SELECTOR_TRACKER_ID,this).done(this.createMultipleSelector.bind(this)),this.loadShape(e[0],this.MULTIPLE_SELECTOR_DUMMY_ID,this).done(this.createMultipleSelectorDummyShape.bind(this))},SVGRenderer.prototype.hideSystemShapes=function(){this.hideTracker(),this.hideLineTracker(),this.showMultipleSelector(!1),this.showMultipleSelectorDummyShape(!1)},SVGRenderer.prototype.removeSystemShapes=function(){this.removeTracker(),this.removeLineTracker(),this.removeMultipleSelector(),this.removeMultipleSelectorDummyShape()},SVGRenderer.prototype.setSVGRootSize=function(e,t){this.svgRoot.setAttributeNS(null,"width",e),this.svgRoot.setAttributeNS(null,"height",t)},SVGRenderer.prototype.setSVGRootZoom=function(e){"number"==typeof e&&(this.zoom=e,1===e?(this.setSVGRootSize(this.MAX_WIDTH,this.MAX_HEIGHT),this.svgRoot.removeAttributeNS(null,"viewBox")):(this.setSVGRootSize(this.MAX_WIDTH*this.zoom,this.MAX_HEIGHT*this.zoom),this.svgRoot.setAttributeNS(null,"viewBox","0 0 "+this.MAX_WIDTH+" "+this.MAX_HEIGHT)))},SVGRenderer.prototype.getSVGPageSize=function(){return{width:this.svgPage.width.baseVal.value,height:this.svgPage.height.baseVal.value}},SVGRenderer.prototype.setSVGPageSize=function(e,t){this.svgPage.setAttributeNS(null,"width",e),this.svgPage.setAttributeNS(null,"height",t)},SVGRenderer.prototype.setSVGPageGrid=function(e){var t=e?"url(#grid"+e+")":"#ffffff";this.svgPage.setAttributeNS(null,"fill",t)},SVGRenderer.prototype.cloneSVGRoot=function(e,t,i){var n=this.svgRoot.cloneNode(!0),o=n.getElementById(this.SVG_PAGE_ID);return o&&n.removeChild(o),i||n.removeAttributeNS(null,"viewBox"),e&&n.setAttributeNS(null,"width",e),t&&n.setAttributeNS(null,"height",t),n},SVGRenderer.prototype.addSVGRootDefinitions=function(){var e=this.createElement("defs"),t=this.createElement("marker");t.setAttributeNS(null,"id","markerQuote"),t.setAttributeNS(null,"viewBox","0 0 1 10"),t.setAttributeNS(null,"refX",0),t.setAttributeNS(null,"refY",5),t.setAttributeNS(null,"markerWidth",5),t.setAttributeNS(null,"markerHeight",5),t.setAttributeNS(null,"markerUnits","strokeWidth"),t.setAttributeNS(null,"orient","auto"),t.setAttributeNS(null,"vector-effect","non-scaling-stroke");var i=this.createElement("path");i.setAttributeNS(null,"d","M0,0 L0,10"),i.setAttributeNS(null,"stroke","#872828"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),t.appendChild(i),e.appendChild(t),(t=this.createElement("marker")).setAttributeNS(null,"id","markerStart"),t.setAttributeNS(null,"viewBox","0 0 10 10"),t.setAttributeNS(null,"refX",2),t.setAttributeNS(null,"refY",5),t.setAttributeNS(null,"markerWidth",5),t.setAttributeNS(null,"markerHeight",5),t.setAttributeNS(null,"markerUnits","strokeWidth"),t.setAttributeNS(null,"orient","auto"),t.setAttributeNS(null,"vector-effect","non-scaling-stroke"),(i=this.createElement("path")).setAttributeNS(null,"d","M10,0 L0,5 L10,10 z"),i.setAttributeNS(null,"stroke","#872828"),i.setAttributeNS(null,"fill","#872828"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),t.appendChild(i),e.appendChild(t),(t=this.createElement("marker")).setAttributeNS(null,"id","markerEnd"),t.setAttributeNS(null,"viewBox","0 0 10 10"),t.setAttributeNS(null,"refX",8),t.setAttributeNS(null,"refY",5),t.setAttributeNS(null,"markerWidth",5),t.setAttributeNS(null,"markerHeight",5),t.setAttributeNS(null,"markerUnits","strokeWidth"),t.setAttributeNS(null,"orient","auto"),t.setAttributeNS(null,"vector-effect","non-scaling-stroke"),(i=this.createElement("path")).setAttributeNS(null,"d","M0,0 L10,5 L0,10 z"),i.setAttributeNS(null,"stroke","#872828"),i.setAttributeNS(null,"fill","#872828"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),t.appendChild(i),e.appendChild(t);var n=this.createGridMMPattern();e.appendChild(n),n=this.createGridINPattern(),e.appendChild(n),this.svgRoot.appendChild(e)},SVGRenderer.prototype.createFloorPattern=function(){if(!this.enableFloor||!this.floorDefinition)return null;var e=this.createElement("pattern");e.setAttributeNS(null,"id","imgFloor"),e.setAttributeNS(null,"width","32px"),e.setAttributeNS(null,"height","32px"),e.setAttributeNS(null,"patternUnits","userSpaceOnUse");var t=this.createElement("image");return t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","32px"),t.setAttributeNS(null,"height","32px"),t.setAttributeNS("http://www.w3.org/1999/xlink","href",this.floorDefinition.image),e.appendChild(t),e},SVGRenderer.prototype.createGridINPattern=function(){var e=this.createElement("pattern");e.setAttributeNS(null,"id","gridin"),e.setAttributeNS(null,"width","0.5in"),e.setAttributeNS(null,"height","0.5in"),e.setAttributeNS(null,"patternUnits","userSpaceOnUse");var t=this.createElement("rect");t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","0.5in"),t.setAttributeNS(null,"height","0.5in"),t.setAttributeNS(null,"stroke","var(--baseColor)"),t.setAttributeNS(null,"stroke-width","0.3"),t.setAttributeNS(null,"fill","#ffffff"),t.setAttributeNS(null,"vector-effect","non-scaling-stroke"),e.appendChild(t);var i=this.createElement("line");return i.setAttributeNS(null,"x1","0.25in"),i.setAttributeNS(null,"y1","0"),i.setAttributeNS(null,"x2","0.25in"),i.setAttributeNS(null,"y2","0.5in"),i.setAttributeNS(null,"stroke","var(--baseColor)"),i.setAttributeNS(null,"stroke-width","0.15"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),e.appendChild(i),(i=this.createElement("line")).setAttributeNS(null,"x1","0"),i.setAttributeNS(null,"y1","0.25in"),i.setAttributeNS(null,"x2","0.5in"),i.setAttributeNS(null,"y2","0.25in"),i.setAttributeNS(null,"stroke","var(--baseColor)"),i.setAttributeNS(null,"stroke-width","0.15"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),e.appendChild(i),e},SVGRenderer.prototype.createGridMMPattern=function(){var e=this.createElement("pattern");e.setAttributeNS(null,"id","gridmm"),e.setAttributeNS(null,"width","25mm"),e.setAttributeNS(null,"height","25mm"),e.setAttributeNS(null,"patternUnits","userSpaceOnUse");var t=this.createElement("rect");t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","25mm"),t.setAttributeNS(null,"height","25mm"),t.setAttributeNS(null,"stroke","var(--baseColor)"),t.setAttributeNS(null,"stroke-width","0.3"),t.setAttributeNS(null,"fill","#ffffff"),t.setAttributeNS(null,"vector-effect","non-scaling-stroke"),e.appendChild(t);for(var i=null,n=0,o=1;o<5;o++)n=5*o,(i=this.createElement("line")).setAttributeNS(null,"x1",n+"mm"),i.setAttributeNS(null,"y1","0"),i.setAttributeNS(null,"x2",n+"mm"),i.setAttributeNS(null,"y2","25mm"),i.setAttributeNS(null,"stroke","var(--baseColor)"),i.setAttributeNS(null,"stroke-width","0.15"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),e.appendChild(i),(i=this.createElement("line")).setAttributeNS(null,"x1","0"),i.setAttributeNS(null,"y1",n+"mm"),i.setAttributeNS(null,"x2","25mm"),i.setAttributeNS(null,"y2",n+"mm"),i.setAttributeNS(null,"stroke","var(--baseColor)"),i.setAttributeNS(null,"stroke-width","0.15"),i.setAttributeNS(null,"vector-effect","non-scaling-stroke"),e.appendChild(i);return e},SVGRenderer.prototype.loadBASE=function(e,t){return $.ajax({url:e,cache:!1,data:"e2drequest",dataType:"text",context:t}).done(function(e,t,i){}).fail(function(t,i,n){alert("Error while trying to retrieve BASE: "+e+"\n"+i+"\n"+n)})},SVGRenderer.prototype.loadJSON=function(e,t){return this.loadBASE(e,t).then(function(e){return e?$.parseJSON(e):""})},SVGRenderer.prototype.loadXML=function(e,t){return this.loadBASE(e,t).then(function(e){return e?$.parseXML(e):""})},SVGRenderer.prototype.loadProps=function(e,t,i){var n=this.cachedProperties.get(t);return n||(n=this.loadJSON(e+this.propsFolder+t+".txt",i),this.cachedProperties.set(t,n)),n},SVGRenderer.prototype.loadShape=function(e,t,i){var n=this.cachedObjects.get(t);return n||(n=this.loadXML(e+this.shapeFolder+t+".xml",i),this.cachedObjects.set(t,n)),n.then(function(e){return e?(e=e.getElementsByTagName("g")[0]).cloneNode(!0):null})},SVGRenderer.prototype.loadShapeAndProps=function(e,t,i){var n=$.Deferred();return $.when(this.loadShape(e,t,i),this.loadProps(e,t,i)).done(function(e,t){n.resolve(e,t)}).fail(function(){n.reject()}),n},SVGRenderer.prototype.remove=function(e){e&&e.parentNode&&e.parentNode.removeChild(e)},SVGRenderer.prototype.importAndAppendChild=function(e,t){if(e&&t){var i=e.ownerDocument.importNode(t,!0);return e.appendChild(i),i}},SVGRenderer.prototype.setBackground=function(e,t,i){var n=$.parseXML(e).getElementsByTagName("svg")[0],o=$.map(n.attributes,function(e){return e.name});$.each(o,function(e,t){n.removeAttribute(t)}),n.setAttribute("position","absolute"),n.setAttribute("overflow","visible"),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox","0 0 100 100");var s=this.createElement("g");s.setAttribute("id",this.BACKGROUND_ID),s.setAttribute("transform","rotate(0,0,0)"),s.appendChild(n);var r=this.importAndAppendChild(this.svgRoot,s);this.setPosition(r,0,0,0),this.setDimensions(r,t,i,0)},SVGRenderer.prototype.getNamespacedElement=function(e,t,i){var n=e.getElementsByTagName(t+":"+i);return n&&0!==n.length||(n=e.getElementsByTagName(i)),n},SVGRenderer.prototype.bounds=function(e){if(e){var t={id:e.id,type:"",x:0,y:0,z:0,width:0,height:0,depth:0,rotation:0,x2:0,y2:0,controlX:0,controlY:0,controlX2:0,controlY2:0,length:0,points:[]};if(this.isConnector(e)){var i=this.getConnectorFrom(e),n=this.getConnectorTo(e);if(t.x=i.x,t.y=i.y,t.x2=n.x,t.y2=n.y,t.width=n.x,t.height=n.y,t.type=this.getConnectorType(e),"curve-line"===t.type){var o=this.getControl1(e),s=this.getControl2(e);t.controlX=o.x,t.controlY=o.y,t.controlX2=s.x,t.controlY2=s.y}else if("quote-line"===t.type){var r=this.getQuoteStackPosition(e);t.stackX=r[0].x,t.stackY=r[0].y,t.stackX2=r[1].x,t.stackY2=r[1].y,t.dimStack=this.getQuoteStack(e),t.dimType=this.getQuoteType(e),t.dimDriving=this.getQuoteDriving(e),t.dimValue=this.getQuoteValue(e)}else if("poly-line"===t.type){var a=this.getPolylinePoints(e),l=a[0],h=a[1],d=a[a.length-2],c=a[a.length-1];t.lengthFrom=0,t.rotationFrom=0,l&&h&&(t.lengthFrom=E2DUtils.getSegmentLength(l.x,l.y,h.x,h.y),t.rotationFrom=(E2DUtils.getSegmentRotation(l.x,l.y,h.x,h.y)+180)%360),t.lengthTo=0,t.rotationTo=0,d&&c&&(t.lengthTo=E2DUtils.getSegmentLength(d.x,d.y,c.x,c.y),t.rotationTo=E2DUtils.getSegmentRotation(d.x,d.y,c.x,c.y)),t.points=a}}else{t.rotation=this.getRotation(e),t.rotation||(t.rotation=0);var u=this.getPosition(e),p=this.getDimensions(e);t.x=u.x,t.y=u.y,t.z=u.z,t.width=p.width,t.height=p.height,t.depth=p.depth}return t}},SVGRenderer.prototype.getBoundingBox=function(e,t){if(!e)return null;var i={};if(this.isConnector(e)){var n=this.bounds(e);"quote-line"!==n.type||t?(i.x=Math.min(n.x,n.x2),i.y=Math.min(n.y,n.y2),i.x2=Math.max(n.x,n.x2),i.y2=Math.max(n.y,n.y2)):(i.x=Math.min(n.x,n.x2,n.stackX,n.stackX2),i.y=Math.min(n.y,n.y2,n.stackY,n.stackY2),i.x2=Math.max(n.x,n.x2,n.stackX,n.stackX2),i.y2=Math.max(n.y,n.y2,n.stackY,n.stackY2)),i.z=0,i.z2=0,i.width=Math.abs(i.x2-i.x),i.height=Math.abs(i.y2-i.y),i.depth=0}else if(0===(i=this.bounds(e)).rotation)i.x2=i.x+i.width,i.y2=i.y+i.height,i.z2=i.z+i.depth;else{var o=this.getRotatedVerticesFromRect(i,0,0),s=Math.min(Math.min(o[0].x,o[3].x),Math.min(o[1].x,o[2].x)),r=Math.min(Math.min(o[0].y,o[3].y),Math.min(o[1].y,o[2].y)),a=Math.max(Math.max(o[0].x,o[3].x),Math.max(o[1].x,o[2].x)),l=Math.max(Math.max(o[0].y,o[3].y),Math.max(o[1].y,o[2].y));i.x=s,i.y=r,i.z=parseInt(i.z),i.width=a-s,i.height=l-r,i.depth=parseInt(i.depth),i.x2=a,i.y2=l,i.z2=i.z+i.depth}return i},SVGRenderer.prototype.getGlobalBoundingBox=function(e){var t=$.merge(this.getAllShapes(this.container),this.getAllConnectors(this.container));if(!t)return null;for(var i=this.MAX_WIDTH,n=-this.MAX_WIDTH,o=this.MAX_HEIGHT,s=-this.MAX_HEIGHT,r=0,a=t.length;rn&&(n=l.x2),l.ys&&(s=l.y2)):(l.x+Math.abs(l.x2-l.x)/2,l.y+Math.abs(l.y2-l.y)/2)}return{x:i,y:o,x2:n,y2:s,width:Math.abs(n-i),height:Math.abs(s-o)}},SVGRenderer.prototype.hasSameRotation=function(e,t){return!(!e||!t)&&e.rotation===t.rotation},SVGRenderer.prototype.hasSameDimensions=function(e,t){return!(!e||!t)&&(Math.abs(e.width-t.width)<1e-6&&Math.abs(e.height-t.height)<1e-6&&Math.abs(e.depth-t.depth)<1e-6)},SVGRenderer.prototype.createLine=function(e,t,i,n){return this.loadShape(e,t,this).then(function(e){if(!e)return null;var o=this.importAndAppendChild(this.svgRoot,e);return"line"!==t&&"curve-line"!==t&&"link-line"!==t&&"quote-line"!==t&&"smart-line"!==t||(this.setLineFrom(o,i,n),this.setLineTo(o,i,n)),"curve-line"===t&&(this.setControl1(o,i,n),this.setControl2(o,i,n)),"poly-line"===t&&this.startPolyline(o,i,n),o}.bind(this))},SVGRenderer.prototype.create=function(e,t,i,n,o,s,r,a){return this.loadShape(e,t,this).then(function(e){var t=this.importAndAppendChild(this.svgRoot,e);return this.setPosition(t,i,n,o),this.setDimensions(t,s,r,a),t}.bind(this))},SVGRenderer.prototype.createElement=function(e){return this.container.ownerDocument.createElementNS(this.svgNamespace,e)},SVGRenderer.prototype.getAttribute=function(e,t){return e.getAttributeNS(null,t)},SVGRenderer.prototype.copy=function(e){if(!e)return null;var t=e.cloneNode(!0);return t.classList.remove("collidingghost"),t.classList.remove("externalghost"),t.classList.remove("firstselectionghost"),t.classList.remove("selectionghost"),t},SVGRenderer.prototype.paste=function(e,t,i){if(e){var n=t||"number"==typeof t?t:10,o=i||"number"==typeof i?i:10,s=e.cloneNode(!0);if(s.id=(this.isConnector(e)?"connector_":"shape_")+E2DUtils.createUUID(),this.isConnector(s)){var r=this.getLineStyle(s);r&&this.setLineStyle(s,r),this.moveCompleteLine(s,this.bounds(s),n,o)}else{var a=this.getPosition(s);this.setPosition(s,a.x+n,a.y+o,a.z),this.updateRotation(s)}this.svgRoot.appendChild(s);var l=this.getTextData(e),h=E2DUtils.cloneObject(l);return this.addTextData(s,h),s}},SVGRenderer.prototype.isMultipleSelect=function(e){return!!e&&("string"==typeof e?e:e.id)===this.MULTIPLE_SELECTOR_TRACKER_ID},SVGRenderer.prototype.isImage=function(e){return!!e&&e.getElementsByTagName("image").length>0},SVGRenderer.prototype.isConnector=function(e){return!!e&&("number"!=typeof e&&("string"==typeof e&&(e=document.getElementById(e)),e.classList.contains("connector")))},SVGRenderer.prototype.isLine=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("line"))},SVGRenderer.prototype.isSmartLine=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("smart-line"))},SVGRenderer.prototype.isSnapLine=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("snap-line"))},SVGRenderer.prototype.isSmartLineHub=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),!!e&&e.classList.contains("smart-line-hub"))},SVGRenderer.prototype.isPolyline=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("poly-line"))},SVGRenderer.prototype.isPolyquote=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("poly-quote"))},SVGRenderer.prototype.isLinkLine=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("link-line"))},SVGRenderer.prototype.isQuoteLine=function(e){return!!e&&("string"==typeof e&&(e=document.getElementById(e)),this.isConnector(e)&&e.classList.contains("quote-line"))},SVGRenderer.prototype.testInclusion=function(e,t){if(!e||!t)return!1;if(E2DUtils.isRectFarAway(e,t))return!1;for(var i=this.getRotatedVerticesFromRect(e),n=this.getRotatedVerticesFromRect(t),o=0,s=i.length;oparseInt(e.x)&&parseInt(t.y)>parseInt(e.y)&&parseInt(t.x)+parseInt(t.width)>0,h=r.length%t,d=0;for(d=0;d0&&(a=r.substr(d*t,h),s.text=a,s.type=0===l?"newline":"normal",i[i.length]=s)}}return i},SVGRenderer.prototype.createTextSet=function(e){var t=[];return e&&0!==e.length?t=e.split(this.LINE_DELIMITER):t},SVGRenderer.prototype.createTextShape=function(e,t,i,n,o,s){var r=this.createElement("text");return r.classList.add(e.type),r.setAttribute("xml:space","preserve"),o?(r.setAttributeNS(null,"x",o.x),r.setAttributeNS(null,"y",o.y)):(r.setAttributeNS(null,"x",i),r.setAttributeNS(null,"y",t)),isNaN(1*s)||(o?r.setAttributeNS(null,"transform","rotate("+s+","+o.x+","+o.y+")"):r.setAttributeNS(null,"transform","rotate("+s+","+i+","+t+")")),n.color&&r.setAttributeNS(null,"fill",n.color),n.size&&r.setAttributeNS(null,"font-size",n.size),n.family&&(r.style.fontFamily=n.family),r.setAttributeNS(null,"text-anchor","middle"),r.textContent=e.text,r},SVGRenderer.prototype.getShapeText=function(e){var t="";if(!e||!e.id)return t;var i=this.getTextData(e);return i&&i.text&&(t=i.text),t},SVGRenderer.prototype.setShapeText=function(e,t,i,n,o){var s=null;if(i)s=i;else{var r=this.getTextData(e);r?(s=r.font,n=n||r.position,o=isNaN(1*o)?r.rotation:o):s=this.getFont(e)}var a=this.getTextBounds(e,t,s);a.width=a.width<25?25:a.width,a.height=0===a.height?1:a.height;var l=Math.ceil(a.width/s.size*2),h=t.wordWrap(l,this.LINE_DELIMITER,!1),d=this.createTextSet(h);if(0===d.length)return!1;for(var c=this.createTextLines(d,l),u=Math.ceil(c.length/2),p=this.handleTextLinePositioning(a,u,c,s,n,o),g=0,y=p.length;g0){o=this.getConnectorTextSize(e,t,i);var a=r[0],l=this.getAttribute(a,"fromX"),h=this.getAttribute(a,"fromY"),d=l*n.width/this.COORD_X+1*n.x,c=h*n.height/this.COORD_Y+1*n.y;n.x=n.left=d,n.y=n.top=c,n.width=o.width,n.height=o.height}}return n},SVGRenderer.prototype.getConnectorTextSize=function(e,t,i){var n=t;n||(n=this.getShapeText(e));var o=i;o||(o=this.getFont(e)),0===o.size.length&&(o=E2DFont.mergeWithDefault(o));for(var s=n.split("\n"),r=(s.length+1)*o.size*1.2,a=50,l=0,h=s.length;la&&(a=s[l].length*o.size/2);return{width:a*=1.2,height:r}},SVGRenderer.prototype.getConnectorCenterPoint=function(e){var t=this.bounds(e),i=this.getConnectorType(e),n={};if("line"===i||"link-line"===i||"smart-line"===i||"poly-line"===i)n=E2DUtils.midpointOfLine(t.x,t.y,t.x2,t.y2);else if("curve-line"===i){var o=E2DUtils.midpointOfLine(1*t.controlX,1*t.controlY,1*t.controlX2,1*t.controlY2),s=E2DUtils.midpointOfLine(t.x,t.y,t.x2,t.y2);n=E2DUtils.midpointOfLineEx(o,s)}else if("quote-line"===i){var r=this.getShapeSubject(e);if(r||5===r.length){var a=1*r[1].getAttributeNS(null,"x1"),l=1*r[1].getAttributeNS(null,"y1"),h=1*r[1].getAttributeNS(null,"x2"),d=1*r[1].getAttributeNS(null,"y2");n=E2DUtils.midpointOfLine(a,l,h,d)}}else"ortho-line"===i&&(t=this.getOrthoLineCenterSegment(e),n=E2DUtils.midpointOfLine(t.x,t.y,t.x2,t.y2));return n},SVGRenderer.prototype.sendToBack=function(e){if(e){var t=e.cloneNode(!0);this.remove(e);var i=this.svgRoot.getElementsByTagName("g");return i.length>1?this.svgRoot.insertBefore(t,i[1]):this.svgRoot.appendChild(t),t}},SVGRenderer.prototype.bringToFront=function(e){if(e){var t=e.cloneNode(!0);return this.remove(e),t=this.importAndAppendChild(this.svgRoot,t)}},SVGRenderer.prototype.setLineFrom=function(e,t,i){var n=this.getShapeSubject(e),o=this.getConnectorType(e);if("line"===o||"smart-line"===o||"snap-line"===o)n.setAttributeNS(null,"x1",t),n.setAttributeNS(null,"y1",i);else if("link-line"===o)n.setAttributeNS(null,"x1",t),n.setAttributeNS(null,"y1",i);else if("curve-line"===o){var s=n.getPathData(),r=s[0];r.values[0]=Math.round(1*t),r.values[1]=Math.round(1*i),s[0]=r,n.setPathData(s)}else if("quote-line"===o&&n&&5===n.length){var a=this.getQuoteType(e);switch(n[0].setAttributeNS(null,"x1",t),n[0].setAttributeNS(null,"y1",i),a){case 0:var l=this.getQuoteStack(e),h=1*n[2].getAttributeNS(null,"x1"),d=1*n[2].getAttributeNS(null,"y1"),c=E2DUtils.getPerpendicularPointsAtDistanceFromSegmentEndpoints(t,i,h,d,l);n[0].setAttributeNS(null,"x2",c[0].x),n[0].setAttributeNS(null,"y2",c[0].y),n[1].setAttributeNS(null,"x1",c[0].x),n[1].setAttributeNS(null,"y1",c[0].y),n[1].setAttributeNS(null,"x2",c[1].x),n[1].setAttributeNS(null,"y2",c[1].y),n[2].setAttributeNS(null,"x2",c[1].x),n[2].setAttributeNS(null,"y2",c[1].y);break;case 1:n[0].setAttributeNS(null,"x2",t),n[1].setAttributeNS(null,"x1",t);break;case 2:n[0].setAttributeNS(null,"y2",i),n[1].setAttributeNS(null,"y1",i);break;default:return}const o=n[1].getAttributeNS(null,"x1"),s=n[1].getAttributeNS(null,"y1");n[3].setAttributeNS(null,"cx",o),n[3].setAttributeNS(null,"cy",s),this.updateQuoteStack(e),this.updateQuoteValue(e)}},SVGRenderer.prototype.setLineTo=function(e,t,i){var n=this.getShapeSubject(e),o=this.getConnectorType(e);if("line"===o||"smart-line"===o||"snap-line"===o)n.setAttributeNS(null,"x2",t),n.setAttributeNS(null,"y2",i);else if("link-line"===o)n.setAttributeNS(null,"x2",t),n.setAttributeNS(null,"y2",i);else if("curve-line"===o){var s=n.getPathData(),r=s[1];r.values[4]=Math.round(1*t),r.values[5]=Math.round(1*i),s[1]=r,n.setPathData(s)}else if("quote-line"===o&&n&&5===n.length){var a=this.getQuoteType(e);switch(n[2].setAttributeNS(null,"x1",t),n[2].setAttributeNS(null,"y1",i),a){case 0:var l=this.getQuoteStack(e),h=1*n[0].getAttributeNS(null,"x1"),d=1*n[0].getAttributeNS(null,"y1"),c=E2DUtils.getPerpendicularPointsAtDistanceFromSegmentEndpoints(h,d,t,i,l);n[0].setAttributeNS(null,"x2",c[0].x),n[0].setAttributeNS(null,"y2",c[0].y),n[1].setAttributeNS(null,"x1",c[0].x),n[1].setAttributeNS(null,"y1",c[0].y),n[1].setAttributeNS(null,"x2",c[1].x),n[1].setAttributeNS(null,"y2",c[1].y),n[2].setAttributeNS(null,"x2",c[1].x),n[2].setAttributeNS(null,"y2",c[1].y);break;case 1:n[1].setAttributeNS(null,"x2",t),n[2].setAttributeNS(null,"x2",t);break;case 2:n[1].setAttributeNS(null,"y2",i),n[2].setAttributeNS(null,"y2",i);break;default:return}const o=n[1].getAttributeNS(null,"x2"),s=n[1].getAttributeNS(null,"y2");n[4].setAttributeNS(null,"cx",o),n[4].setAttributeNS(null,"cy",s),this.updateQuoteValue(e)}},SVGRenderer.prototype.setControl1=function(e,t,i){var n=this.getShapeSubject(e),o=n.getPathData(),s=o[1];s.values[0]=Math.round(1*t),s.values[1]=Math.round(1*i),o[1]=s,n.setPathData(o)},SVGRenderer.prototype.getControl1=function(e){var t=this.getShapeSubject(e).getPathData()[1];return{x:1*t.values[0],y:1*t.values[1]}},SVGRenderer.prototype.setControl2=function(e,t,i){var n=this.getShapeSubject(e),o=n.getPathData(),s=o[1];s.values[2]=Math.round(1*t),s.values[3]=Math.round(1*i),o[1]=s,n.setPathData(o)},SVGRenderer.prototype.getControl2=function(e){var t=this.getShapeSubject(e).getPathData()[1];return{x:1*t.values[2],y:1*t.values[3]}},SVGRenderer.prototype.getQuoteStackPosition=function(e){var t=[],i=this.getShapeSubject(e);i&&5===i.length&&(t=[{x:1*i[1].getAttributeNS(null,"x1"),y:1*i[1].getAttributeNS(null,"y1")},{x:1*i[1].getAttributeNS(null,"x2"),y:1*i[1].getAttributeNS(null,"y2")}]);return t},SVGRenderer.prototype.getQuoteStack=function(e){var t=this.getShapeSubject(e);return t&&5===t.length?1*t[1].getAttributeNS(null,"dimStack"):this.QUOTE_STACK},SVGRenderer.prototype.setQuoteStack=function(e,t,i,n){var o=this.getShapeSubject(e);if(t&&o&&5===o.length){var s=1*o[0].getAttributeNS(null,"x1"),r=1*o[0].getAttributeNS(null,"y1"),a=1*o[2].getAttributeNS(null,"x1"),l=1*o[2].getAttributeNS(null,"y1");if(t*=1,t=isNaN(t)||"number"!=typeof t?this.QUOTE_STACK:t,i){const e=E2DGlobals.e2d;switch(t=e.convertGraphDataToUserData(t),n){case 1:t=r-(t=e.convertUserYToGraphY(t));break;case 2:t=e.convertUserXToGraphX(t),t-=s}}o[1].setAttributeNS(null,"dimStack",t);var h=E2DUtils.getPerpendicularPointsAtDistanceFromSegmentEndpoints(s,r,a,l,t);o[0].setAttributeNS(null,"x2",h[0].x),o[0].setAttributeNS(null,"y2",h[0].y),o[1].setAttributeNS(null,"x1",h[0].x),o[1].setAttributeNS(null,"y1",h[0].y),o[1].setAttributeNS(null,"x2",h[1].x),o[1].setAttributeNS(null,"y2",h[1].y),o[2].setAttributeNS(null,"x2",h[1].x),o[2].setAttributeNS(null,"y2",h[1].y),o[3].setAttributeNS(null,"cx",h[0].x),o[3].setAttributeNS(null,"cy",h[0].y),o[4].setAttributeNS(null,"cx",h[1].x),o[4].setAttributeNS(null,"cy",h[1].y),this.updateQuoteValue(e)}},SVGRenderer.prototype.getQuoteType=function(e){var t=this.getShapeSubject(e);return t&&5===t.length?1*t[1].getAttributeNS(null,"dimType"):this.QUOTE_TYPE},SVGRenderer.prototype.setQuoteType=function(e,t){var i=this.getShapeSubject(e);if(i&&5===i.length){t*=1,t=isNaN(t)||"number"!=typeof t?this.QUOTE_TYPE:t,i[1].setAttributeNS(null,"dimType",t);var n=1*i[0].getAttributeNS(null,"x1"),o=1*i[0].getAttributeNS(null,"y1"),s=1*i[2].getAttributeNS(null,"x1"),r=1*i[2].getAttributeNS(null,"y1"),a=this.getQuoteStack(e),l=[];switch(t){case 0:l=E2DUtils.getPerpendicularPointsAtDistanceFromSegmentEndpoints(n,o,s,r,a);break;case 1:l[0]={x:n,y:o-a},l[1]={x:s,y:o-a};break;case 2:l[0]={x:n+a,y:o},l[1]={x:n+a,y:r};break;default:return}i[0].setAttributeNS(null,"x2",l[0].x),i[0].setAttributeNS(null,"y2",l[0].y),i[1].setAttributeNS(null,"x1",l[0].x),i[1].setAttributeNS(null,"y1",l[0].y),i[1].setAttributeNS(null,"x2",l[1].x),i[1].setAttributeNS(null,"y2",l[1].y),i[2].setAttributeNS(null,"x2",l[1].x),i[2].setAttributeNS(null,"y2",l[1].y),i[3].setAttributeNS(null,"cx",l[0].x),i[3].setAttributeNS(null,"cy",l[0].y),i[4].setAttributeNS(null,"cx",l[1].x),i[4].setAttributeNS(null,"cy",l[1].y),this.updateQuoteValue(e)}},SVGRenderer.prototype.getQuoteDriving=function(e){var t=this.getShapeSubject(e);return t&&5===t.length?E2DUtils.toBoolean(t[1].getAttributeNS(null,"dimDriving")):this.QUOTE_DRIVING},SVGRenderer.prototype.setQuoteDriving=function(e,t,i){var n=this.getShapeSubject(e);if(n&&5===n.length){var o=E2DGlobals.e2d,s=o.insertedShapes.getConnectionShape(e.id,"from"),r=o.insertedShapes.getConnectionShape(e.id,"to");if(s.shapeID===r.shapeID&&(t=!1),n[1].setAttributeNS(null,"dimDriving",t),this.setFont(e,{color:t?"red":"black"}),t){var a=this.getConnectorFrom(e),l=document.getElementById(s.shapeID),h=o.insertedShapes.isPinned(s.shapeID,[e.id]),d=this.getConnectorTo(e),c=document.getElementById(r.shapeID),u=o.insertedShapes.isPinned(r.shapeID,[e.id]);if(h.pinnedX&&h.pinnedY&&u.pinnedX&&u.pinnedY)return!1;var p=i-this.getQuoteValue(e);if(Math.abs(p)<1e-6)return!1;var g=!0,y=null,f=null,v=1;switch(this.getQuoteType(e)){case 0:if(h.pinnedX||h.pinnedY){if(u.pinnedX||u.pinnedY)return!1;g=!1,y=c;var m=E2DUtils.getPointAtDistanceAlongSegment(a.x,a.y,d.x,d.y,i);f={x:m.x-d.x,y:m.y-d.y,z:0}}else{g=!0,y=l;var S=E2DUtils.getPointAtDistanceAlongSegment(d.x,d.y,a.x,a.y,i);f={x:S.x-a.x,y:S.y-a.y,z:0}}break;case 1:if(h.pinnedX){if(u.pinnedX)return!1;v=d.x1.2?(t=1,n=10):o<.8&&(t=2,n=10);var s=E2DGlobals.e2d,r=s.insertedShapes.getShapeById(e.id);if(r.dimType!==t){r.dimType=t,r.dimStack!==n&&(r.dimStack=n);var a=s.convertUserDataToGraphData(r.dimValue);this.updateQuote(e,r.dimStack,r.dimType,r.dimDriving,a)&&(this.updateTracker(e),s.updateShapeInfo(e))}},SVGRenderer.prototype.moveQuote=function(e,t,i,n,o){var s=this.getShapeSubject(e);s&&5===s.length&&(s[0].setAttributeNS(null,"x2",t),s[0].setAttributeNS(null,"y2",i),s[1].setAttributeNS(null,"x1",t),s[1].setAttributeNS(null,"y1",i),s[1].setAttributeNS(null,"x2",n),s[1].setAttributeNS(null,"y2",o),s[2].setAttributeNS(null,"x2",n),s[2].setAttributeNS(null,"y2",o),s[3].setAttributeNS(null,"cx",t),s[3].setAttributeNS(null,"cy",i),s[4].setAttributeNS(null,"cx",n),s[4].setAttributeNS(null,"cy",o),this.updateQuoteStack(e),this.updateQuoteValue(e))},SVGRenderer.prototype.updateQuote=function(e,t,i,n,o,s){return this.setQuoteStack(e,t,s,i),this.setQuoteType(e,i),this.setQuoteDriving(e,n,o)},SVGRenderer.prototype.setLayer=function(e,t){e&&(t&&!t.visible?e.classList.add("layer-hidden"):e.classList.remove("layer-hidden"))},SVGRenderer.prototype.setPinned=function(e,t){e&&(t?e.classList.add("pinned"):e.classList.remove("pinned"))},SVGRenderer.prototype.moveLine=function(e,t,i,n){if(e&&this.isConnector(e)){var o=this.getConnectorType(e);if("line"===o||"curve-line"===o||"link-line"===o||"quote-line"===o||"smart-line"===o)n?this.setLineFrom(e,t,i):this.setLineTo(e,t,i);else if("poly-line"===o)this.drawPolyline(e,t,i,n);else{var s,r,a=e.getElementsByTagName("polyline")[0].points,l=a.numberOfItems;n?(s=a.getItem(l-1).x,r=a.getItem(l-1).y,this.drawOrthoLine(e,t,i,s,r)):(s=a.getItem(0).x,r=a.getItem(0).y,this.drawOrthoLine(e,s,r,t,i))}}},SVGRenderer.prototype.moveCompleteLine=function(e,t,i,n,o,s){if(this.isConnector(e)){var r,a,l,h,d=t.type;if("poly-line"===d)this.movePolyline(e,t,i,n);else if("quote-line"===d){var c=this.getShapeSubject(e);if(c&&5===c.length)if("number"==typeof o&&"number"==typeof s||E2DEvents.autoScrollIntervalID){r=1*c[1].getAttributeNS(null,"x1"),a=1*c[1].getAttributeNS(null,"y1"),l=1*c[1].getAttributeNS(null,"x2"),h=1*c[1].getAttributeNS(null,"y2");var u=E2DUtils.midpointOfLine(r,a,l,h),p=E2DUtils.getPerpendicularPointAtDistanceFromSegmentPoint(r,a,l,h,u.x,u.y,10),g=("number"==typeof o?o:u.x)+i,y=("number"==typeof s?s:u.y)+n,f=E2DUtils.pointLineIntersection(g,y,u.x,u.y,p.x,p.y),v=f.x-u.x,m=f.y-u.y;this.moveQuote(e,r+v,a+m,l+v,h+m)}else r=1*t.x+i,a=1*t.y+n,l=1*t.x2+i,h=1*t.y2+n,this.moveLine(e,r,a,!0),this.moveLine(e,l,h,!1)}else if(r=1*t.x+i,a=1*t.y+n,l=1*t.x2+i,h=1*t.y2+n,this.moveLine(e,r,a,!0),this.moveLine(e,l,h,!1),"curve-line"===d){var S=1*t.controlX+i,E=1*t.controlY+n,D=1*t.controlX2+i,b=1*t.controlY2+n;this.setControl1(e,S,E),this.setControl2(e,D,b)}}},SVGRenderer.prototype.moveLineWithShape=function(e,t,i,n){if(e){var o=!1,s=E2DGlobals.e2d.insertedShapes.getShapeById(e.id);if(s&&s.shapeConnections&&s.shapeConnections.length>0)for(var r=s.shapeConnections,a=0,l=r.length;a0){var s=i.insertedShapes.getShapeById(o.shapeID);s&&s.removeShapeConnection(t,e.id,o.pointID)}o.shapeID="",o.pointID=""}}},SVGRenderer.prototype.getOrthoLineCenterSegment=function(e){var t=this.getShapeSubject(e).points,i=Math.round(t.numberOfItems/2-1),n=t.getItem(i),o=t.getItem(i-1),s=t.getItem(i+1),r=(n.y-o.y)*(n.y-o.y)+(n.x-o.x)*(n.x-o.x)>(n.y-s.y)*(n.y-s.y)+(n.x-s.x)*(n.x-s.x)?o:s;return{x:r.x,y:r.y,x2:n.x,y2:n.y}},SVGRenderer.prototype.drawOrthoLine=function(e,t,i,n,o){var s=this.calculateOrthoLinePath(e,t,i,n,o);this.getShapeSubject(e).setAttributeNS(null,"points",s)},SVGRenderer.prototype.calculateOrthoLinePath=function(e,t,i,n,o){var s=this.getClearancePoints(e,t,i,n,o,"from"),r=this.getClearancePoints(e,n,o,s[s.length-1].x,s[s.length-1].y,"to"),a=s[s.length-1].x,l=(s[s.length-1].y,r[r.length-1].x,r[r.length-1].y);s[s.length]={x:a,y:l};for(var h=r.length-1;h>=0;h--)s[s.length]=r[h];for(var d=[],c=0,u=s.length;c1*y[0].x-12?n:1*y[0].x-12:n<1*y[1].x+12?n:1*y[1].x+12,g.y=r.y,a[a.length]=g):2===p&&r.y>o?(g.x=n1*y[1].x-12?n:1*y[1].x-12:n<1*y[0].x+12?n:1*y[0].x+12,g.y=r.y,a[a.length]=g):1===p&&r.x>n?(g.y=o1*y[0].y-12?o:1*y[0].y-12:o<1*y[1].y+12?o:1*y[1].y+12,g.x=r.x,a[a.length]=g):3===p&&r.x1*y[1].y-12?o:1*y[1].y-12:o<1*y[0].y+12?o:1*y[0].y+12,g.x=r.x,a[a.length]=g),a},SVGRenderer.prototype.isPointInCorners=function(e,t){var i=this.getRotatedPoint(t.x,t.y,t);return!!E2DUtils.isPointTooClose(e,i,1)||(i=this.getRotatedPoint(t.x+t.width,t.y,t),!!E2DUtils.isPointTooClose(e,i,1)||(i=this.getRotatedPoint(t.x,t.y+t.height,t),!!E2DUtils.isPointTooClose(e,i,1)||(i=this.getRotatedPoint(t.x+t.width,t.y+t.height,t),!!E2DUtils.isPointTooClose(e,i,1))))},SVGRenderer.prototype.isConnectionPointWithXY=function(e){return this.isConnectionPointWithX(e)||this.isConnectionPointWithY(e)},SVGRenderer.prototype.isConnectionPointWithX=function(e){var t="number"==typeof e.xStep&&e.xStep>0||"string"==typeof e.xStep&&""!==e.xStep&&"0"!==e.xStep,i="number"==typeof e.xMin&&e.xMin>0||"string"==typeof e.xMin&&""!==e.xMin&&"0"!==e.xMin,n="number"==typeof e.xMax&&e.xMax>0||"string"==typeof e.xMax&&""!==e.xMax&&"0"!==e.xMax;return t||i||n},SVGRenderer.prototype.isConnectionPointWithY=function(e){var t="number"==typeof e.yStep&&e.yStep>0||"string"==typeof e.yStep&&""!==e.yStep&&"0"!==e.yStep,i="number"==typeof e.yMin&&e.yMin>0||"string"==typeof e.yMin&&""!==e.yMin&&"0"!==e.yMin,n="number"==typeof e.yMax&&e.yMax>0||"string"==typeof e.yMax&&""!==e.yMax&&"0"!==e.yMax;return t||i||n},SVGRenderer.prototype.isConnectionPointWithZ=function(e){var t="number"==typeof e.zSpot&&e.zSpot>0,i="number"==typeof e.zStep&&e.zStep>0||"string"==typeof e.zStep&&""!==e.zStep&&"0"!==e.zStep,n="number"==typeof e.zMin&&e.zMin>0||"string"==typeof e.zMin&&""!==e.zMin&&"0"!==e.zMin,o="number"==typeof e.zMax&&e.zMax>0||"string"==typeof e.zMax&&""!==e.zMax&&"0"!==e.zMax;return t||i||n||o},SVGRenderer.prototype.isCommonLinkClassWithXY=function(e,t){return this.isCommonLinkClassWithX(e,t)||this.isCommonLinkClassWithY(e,t)},SVGRenderer.prototype.isCommonLinkClassWithX=function(e,t){var i=E2DGlobals.e2d.getCommonLinkClassObj(e,t);if(!i)return!1;var n="number"==typeof i.xStep&&i.xStep>0||"string"==typeof i.xStep&&""!==i.xStep&&"0"!==i.xStep,o="number"==typeof i.xMin&&i.xMin>0||"string"==typeof i.xMin&&""!==i.xMin&&"0"!==i.xMin,s="number"==typeof i.xMax&&i.xMax>0||"string"==typeof i.xMax&&""!==i.xMax&&"0"!==i.xMax;return n||o||s},SVGRenderer.prototype.isCommonLinkClassWithY=function(e,t){var i=E2DGlobals.e2d.getCommonLinkClassObj(e,t);if(!i)return!1;var n="number"==typeof i.yStep&&i.yStep>0||"string"==typeof i.yStep&&""!==i.yStep&&"0"!==i.yStep,o="number"==typeof i.yMin&&i.yMin>0||"string"==typeof i.yMin&&""!==i.yMin&&"0"!==i.yMin,s="number"==typeof i.yMax&&i.yMax>0||"string"==typeof i.yMax&&""!==i.yMax&&"0"!==i.yMax;return n||o||s},SVGRenderer.prototype.isCommonLinkClassWithZ=function(e,t){var i=E2DGlobals.e2d.getCommonLinkClassObj(e,t);if(!i)return!1;var n="number"==typeof i.zStep&&i.zStep>0||"string"==typeof i.zStep&&""!==i.zStep&&"0"!==i.zStep,o="number"==typeof i.zMin&&i.zMin>0||"string"==typeof i.zMin&&""!==i.zMin&&"0"!==i.zMin,s="number"==typeof i.zMax&&i.zMax>0||"string"==typeof i.zMax&&""!==i.zMax&&"0"!==i.zMax;return n||o||s},SVGRenderer.prototype.getConnectionPointObj=function(e,t,i,n){var o=1*i.x+t.x/this.COORD_X*i.width,s=1*i.y+t.y/this.COORD_Y*i.height,r=1*i.z+t.z/this.COORD_Z*i.depth;if(n){var a=this.getSubConnectionPointPosition(o,s,r,t,i,n);o=a.x,s=a.y,r=a.z}var l=this.getRotatedPoint(o,s,i);return{id:e+"--"+t.id,shapeId:e,cpId:t.id,x:l.x,y:l.y,z:r,noRX:o,noRY:s,noRZ:r,xMin:t.xMin,xMax:t.xMax,xStep:t.xStep,yMin:t.yMin,yMax:t.yMax,yStep:t.yStep,zMin:t.zMin,zMax:t.zMax,zStep:t.zStep,zSpot:t.z,direction:t.direction,linkClass:t.linkClass,isDimension:t.isDimension,label:t.label}},SVGRenderer.prototype.getConnectionPointObjByPointId=function(e,t){if(this.isPolyline(e)){"from"===t?t=0:"to"===t?t=this.getPolylineNumberOfPoints(e)-1:t*=1;var i=this.getPolylinePoint(e,t);return i?{id:e.id+"--"+t,shapeId:e.id,cpId:t,x:i.x,y:i.y,z:0}:null}var n=E2DGlobals.e2d.getLibraryProperties(e.id);if(!n||!n.connectionPoints||0===n.connectionPoints.length)return null;for(var o=null,s=this.bounds(e),r=t.split("__"),a=0,l=n.connectionPoints.length;a=2&&(d=r[1]),c=this.getConnectionPointObj(e.id,o,s,d));return c},SVGRenderer.prototype.getConnectionPointObjs=function(e,t){var i=[],n=E2DGlobals.e2d.getLibraryProperties(e.id);if(!n||!n.connectionPoints||0===n.connectionPoints.length)return i;for(var o=this.bounds(e),s=0,r=n.connectionPoints.length;s0&&u>0)for(var v=Math.floor((l-a)/h),m=Math.floor((c-d)/u),S=0;S<=v;S++)for(var E=0;E<=m;E++)g={x:t.noRX+a+S*h,y:t.noRY+d+E*u},y=this.getSubConnectionPointObj(t.cpId+"__x"+S+"y"+E,g,t,r),f[f.length]=y;else if(h>0){o=Math.floor((l-a)/h);for(var D=0;D<=o;D++)g={x:t.noRX+a+D*h,y:t.noRY},y=this.getSubConnectionPointObj(t.cpId+"__x"+D,g,t,r),f[f.length]=y}else if(u>0){o=Math.floor((c-d)/u);for(var b=0;b<=o;b++)g={x:t.noRX,y:t.noRY+d+b*u},y=this.getSubConnectionPointObj(t.cpId+"__y"+b,g,t,r),f[f.length]=y}return f},SVGRenderer.prototype.getSubConnectionPointObj=function(e,t,i,n){var o=this.getRotatedPoint(t.x,t.y,n),s=E2DUtils.cloneObject(i);return s.id=i.shapeId+"--"+e,s.cpId=e,s.x=o.x,s.y=o.y,s},SVGRenderer.prototype.getSubConnectionPointPosition=function(e,t,i,n,o,s){const r={x:e,y:t,z:i},a=s.indexOf("x"),l=s.indexOf("y"),h=s.indexOf("z"),d=-1!==a?1*s.substring(a+1,-1!==l?l:void 0):0,c=-1!==l?1*s.substring(l+1,-1!==h?h:void 0):0,u=-1!==h?1*s.substring(h+1):0,p=E2DGlobals.e2d,g=p.getValueOrEvaluateFormula(n.xMin,o)*p.scale,y=p.getValueOrEvaluateFormula(n.xStep,o)*p.scale,f=p.getValueOrEvaluateFormula(n.yMin,o)*p.scale,v=p.getValueOrEvaluateFormula(n.yStep,o)*p.scale,m=p.getValueOrEvaluateFormula(n.zMin,o)*p.scale,S=p.getValueOrEvaluateFormula(n.zStep,o)*p.scale;return y>0&&(r.x+=g+d*y),v>0&&(r.y+=f+c*v),S>0&&(r.z+=m+u*S),r},SVGRenderer.prototype.getOverlappingConnectionPointObjs=function(e,t,i,n,o){n=n||1;var s=[],r=document.getElementById(e);if(!r)return s;var a=E2DGlobals.e2d.getLibraryProperties(e);if(!a||!a.connectionPoints||0===a.connectionPoints.length)return s;for(var l=null,h=[],d=this.bounds(r),c=t.split("__"),u=0,p=a.connectionPoints.length;u1*i.x+i.width/2?1:n.y<=i.y?0:2},SVGRenderer.prototype.getRotatedClearancePoints=function(e,t,i){var n=[{},{}];return 0===t?(n[0].x=e.x,n[0].y=e.y,n[1].x=1*e.x+1*e.width,n[1].y=e.y):1===t?(n[0].x=1*e.x+1*e.width,n[0].y=e.y,n[1].x=1*e.x+1*e.width,n[1].y=1*e.y+1*e.height):2===t?(n[0].x=1*e.x+1*e.width,n[0].y=1*e.y+1*e.height,n[1].x=1*e.x,n[1].y=1*e.y+1*e.height):(n[0].x=1*e.x,n[0].y=1*e.y+1*e.height,n[1].x=1*e.x,n[1].y=1*e.y),n},SVGRenderer.prototype.startPolyline=function(e,t,i){var n=this.getShapeSubject(e);n.setAttributeNS(null,"points",t+","+i+" "+t+","+i),this.enableFloor&&n.setAttributeNS(null,"fill",this.floorDefinition.color?this.floorDefinition.color:"url(#imgFloor)")},SVGRenderer.prototype.drawPolyline=function(e,t,i,n){var o=this.getShapeSubject(e),s=this.isPolylineClosed(e),r=o.points.numberOfItems-1,a=n?0:r,l=o.points.getItem(a);if(l.x=t,l.y=i,s&&a===r){var h=this.getPolylineFirstPoint(e);h.x=l.x,h.y=l.y}},SVGRenderer.prototype.closePolylineSegment=function(e,t,i,n){if(e){var o=this.getShapeSubject(e),s=o.points.getItem(o.points.numberOfItems-1);if(s.x=t,s.y=i,n){var r=o.ownerSVGElement.createSVGPoint();r.x=t,r.y=i,o.points.appendItem(r)}}},SVGRenderer.prototype.finishPolyline=function(e){var t=this.getShapeSubject(e);t.points.removeItem(t.points.numberOfItems-1)},SVGRenderer.prototype.undoPolylineLastSegment=function(e){var t=this.getShapeSubject(e);t.points.numberOfItems>=2&&t.points.removeItem(t.points.numberOfItems-2)},SVGRenderer.prototype.closePolyline=function(e){var t=this.getShapeSubject(e),i=t.points.getItem(0),n=t.points.getItem(t.points.numberOfItems-1);n.x=i.x,n.y=i.y},SVGRenderer.prototype.movePolyline=function(e,t,i,n){var o=this.getShapeSubject(e);o.points.clear();for(var s=0,r=t.points.length;s0&&this.updateTracker(e,[t-1,t]))},SVGRenderer.prototype.removePolylineSegment=function(e,t,i){t*=1,i*=1;var n=this.getShapeSubject(e).points;if(t0;c--)(a=r.ownerSVGElement.createSVGPoint()).x=o[c].x,a.y=o[c].y,l.appendItem(a);if(n)for(var u=0,p=s.length;u=0;g--)(a=r.ownerSVGElement.createSVGPoint()).x=s[g].x,a.y=s[g].y,l.appendItem(a)},SVGRenderer.prototype.reversePolylinePoints=function(e){var t=this.getPolylinePoints(e),i=this.getShapeSubject(e),n=i.points;n.clear();for(var o=t.length-1;o>=0;o--){var s=i.ownerSVGElement.createSVGPoint();s.x=t[o].x,s.y=t[o].y,n.appendItem(s)}},SVGRenderer.prototype.isPolylineClosed=function(e){var t=this.getShapeSubject(e).points;if(t.numberOfItems<3)return!1;var i=t.getItem(0),n=t.getItem(t.numberOfItems-1);return E2DUtils.isPointTooClose(i,n,1e-4)},SVGRenderer.prototype.isPolylineSegmentSelected=function(e){var t=document.getElementById("resize-from"),i=document.getElementById("resize-to"),n=t.hasAttributeNS(null,"plPoint"),o=i.hasAttributeNS(null,"plPoint");return n&&o},SVGRenderer.prototype.getPolylinePoints=function(e){var t=this.getShapeSubject(e).points,i=[];if(t&&t.numberOfItems>0)for(var n=0,o=t.numberOfItems;n0)for(var n=0,o=t.length;n0){var n=0;t[n]={id:e.id+"--from",x:i[n].x,y:i[n].y};var o=i.length-1;for(n=1;n0&&(t.x=1*s.getItem(0).x,t.y=1*s.getItem(0).y)}return isNaN(t.x)&&(t.x=0),isNaN(t.y)&&(t.y=0),t},SVGRenderer.prototype.getConnectorTo=function(e){var t={x:-1,y:-1},i=this.getConnectorType(e);if(!i)return t;var n=this.getShapeSubject(e);if(!n)return t;if("line"===i||"link-line"===i||"smart-line"===i)t.x=1*n.getAttributeNS(null,"x2"),t.y=1*n.getAttributeNS(null,"y2");else if("curve-line"===i){var o=n.getPathData()[1];t.x=1*o.values[4],t.y=1*o.values[5]}else if("quote-line"===i&&n&&5===n.length)t.x=1*n[2].getAttributeNS(null,"x1"),t.y=1*n[2].getAttributeNS(null,"y1");else{var s=n.points,r=s.numberOfItems;if(0===r)return null;t.x=1*s.getItem(r-1).x,t.y=1*s.getItem(r-1).y}return isNaN(t.x)&&(t.x=0),isNaN(t.y)&&(t.y=0),t},SVGRenderer.prototype.getAllShapes=function(e){for(var t=e.querySelectorAll("svg#SVG_ROOT > g"),i=[],n=0,o=t.length;n=0||t[n].id.indexOf("resize-")>=0||t[n].id.indexOf("control")>=0||(i[i.length]=t[n]);return i},SVGRenderer.prototype.getAllConnectors=function(e,t){for(var i=[],n=[],o=0,s=(i=t?e.querySelectorAll("g."+t):e.querySelectorAll("svg#SVG_ROOT > g")).length;o0)for(var n=i.shapeConnections,o=0,s=n.length;o0)for(var h=l.shapeConnection,d=0,c=h.length;d g"),i=[],n=0,o=t.length;n0?t[0].getAttributeNS(null,"stroke-opacity"):t.getAttributeNS(null,"stroke-opacity")},SVGRenderer.prototype.setLineOpacity=function(e,t){if(e&&t)if(this.isConnector(e)){var i=this.getShapeSubject(e);if(i.length>0)for(var n=0,o=i.length;n0?t[0].getAttributeNS(null,"stroke-width"):t.getAttributeNS(null,"stroke-width")},SVGRenderer.prototype.setLineWidth=function(e,t){if(e&&t)if(this.isConnector(e)){var i=this.getShapeSubject(e);if(i.length>0)for(var n=0,o=i.length;n0?t[0].getAttributeNS(null,"stroke"):t.getAttributeNS(null,"stroke")},SVGRenderer.prototype.setLineColor=function(e,t){if(e&&t)if(this.isConnector(e)){var i=this.getShapeSubject(e);if(i.length>0)for(var n=0,o=i.length;n0)this.getShapeSubject(e).setAttributeNS(null,"opacity",t);else for(var i=this.getAllSubShapes(e),n=0,o=i.length;n0?e.getElementsByTagName("image")[0]:e.getElementsByTagName("path").length>0?e.getElementsByTagName("path")[0]:e;var t=this.getConnectorType(e);return"line"===t||"link-line"===t||"smart-line"===t||"snap-line"===t?e.getElementsByTagName("line")[0]:"ortho-line"===t||"poly-line"===t||"poly-quote"===t?e.getElementsByTagName("polyline")[0]:"curve-line"===t?e.getElementsByTagName("path")[0]:"quote-line"===t?e.querySelectorAll("line, circle"):void 0},SVGRenderer.prototype.getAllSubShapes=function(e){return e?e.getElementsByTagName("path"):null},SVGRenderer.prototype.getPosition=function(e){var t={x:0,y:0,z:0};if(!e)return t;var i=e.getElementsByTagName("svg")[0];if(!i)return t;var n=i.x.baseVal.value;n&&(t.x=1*n);var o=i.y.baseVal.value;o&&(t.y=1*o);var s=i.getAttributeNS(null,"z");return s&&(t.z=1*s),t},SVGRenderer.prototype.setPosition=function(e,t,i,n){if(e){var o=e.getElementsByTagName("svg")[0];o&&(null!==t&&void 0!==t&&""!==t&&(o.x.baseVal.value=t),null!==i&&void 0!==i&&""!==i&&(o.y.baseVal.value=i),null!==n&&void 0!==n&&""!==n&&o.setAttributeNS(null,"z",n))}},SVGRenderer.prototype.getDimensions=function(e){var t={width:0,height:0,depth:0};if(!e)return t;var i=e.getElementsByTagName("svg")[0];if(!i)return t;var n=i.getAttributeNS(null,"width");n&&(t.width=1*n);var o=i.getAttributeNS(null,"height");o&&(t.height=1*o);var s=i.getAttributeNS(null,"depth");return s&&(t.depth=1*s),t},SVGRenderer.prototype.setDimensions=function(e,t,i,n){if(e){var o=e.getElementsByTagName("svg")[0];o&&(null!==t&&void 0!==t&&""!==t&&(t<0&&(t*=-1),0===t&&(t=1e-10),o.setAttributeNS(null,"width",t)),null!==i&&void 0!==i&&""!==i&&(i<0&&(i*=-1),0===i&&(i=1e-10),o.setAttributeNS(null,"height",i)),null!==n&&void 0!==n&&""!==n&&(n<0&&(n*=-1),0===n&&(n=1e-10),o.setAttributeNS(null,"depth",n)))}},SVGRenderer.prototype.resize=function(e,t,i,n,o){var s=n-t,r=o-i;if(this.isConnector(e)){var a=this.getConnectorType(e);"line"===a||"link-line"===a||"quote-line"===a||"smart-line"===a?this.setLineTo(e,n,o):"ortho-line"===a?this.drawOrthoLine(e,t,i,n,o):"curve-line"===a?this.drawCurveLine(e,t,i,n,o,!1):"poly-line"===a&&this.drawPolyline(e,n,o,!1)}else s<0?(this.setPosition(e,n,null,null),this.setDimensions(e,-s,null,null)):this.setDimensions(e,s,null,null),r<0?(this.setPosition(e,null,o,null),this.setDimensions(e,null,-r,null)):this.setDimensions(e,null,r,null),this.updateRotation(e)},SVGRenderer.prototype.resizeWidth=function(e,t,i,n,o,s,r){var a=this.bounds(e),l=a.rotation;l||(l=0),l%=360;var h=E2DUtils.deg2rad(-l),d=t*Math.cos(h)-i*Math.sin(h)-(n*Math.cos(h)-o*Math.sin(h));r||(d=-d);var c=1*s+d;if(c<1)return!1;var u=null;u=r?this.getRotatedPoint(a.x,a.y,a):this.getRotatedPoint(1*a.x+1*a.width,1*a.y+1*a.height,a),this.setDimensions(e,c,null,null);var p=this.bounds(e),g=null;g=r?this.getRotatedPoint(p.x,p.y,p):this.getRotatedPoint(1*p.x+1*p.width,1*p.y+1*p.height,p);var y=u.x-g.x,f=u.y-g.y;this.setPosition(e,1*p.x+y,1*p.y+f,1*p.z),this.updateRotation(e)},SVGRenderer.prototype.resizeHeight=function(e,t,i,n,o,s,r){var a=this.bounds(e),l=a.rotation;l||(l=0),l%=360;var h=E2DUtils.deg2rad(-l),d=i*Math.cos(h)+t*Math.sin(h)-(o*Math.cos(h)+n*Math.sin(h));r||(d=-d);var c=1*s+d;if(c<1)return!1;var u=null;u=r?this.getRotatedPoint(a.x,a.y,a):this.getRotatedPoint(1*a.x+1*a.width,1*a.y+1*a.height,a),this.setDimensions(e,null,c,null);var p=this.bounds(e),g=null;g=r?this.getRotatedPoint(p.x,p.y,p):this.getRotatedPoint(1*p.x+1*p.width,1*p.y+1*p.height,p);var y=u.x-g.x,f=u.y-g.y;this.setPosition(e,1*p.x+y,1*p.y+f,1*p.z),this.updateRotation(e)},SVGRenderer.prototype.resizeDepth=function(e,t,i,n,o,s){var r=this.bounds(e).rotation;r||(r=0),r%=360;var a=E2DUtils.deg2rad(-r),l=i*Math.cos(a)+t*Math.sin(a),h=1*s+(o*Math.cos(a)+n*Math.sin(a)-l);if(h<1)return!1;this.setDimensions(e,null,null,h)},SVGRenderer.prototype.resizeZ=function(e,t,i,n,o,s){var r=this.bounds(e).rotation;r||(r=0),r%=360;var a=E2DUtils.deg2rad(-r),l=i*Math.cos(a)+t*Math.sin(a),h=1*s+(o*Math.cos(a)+n*Math.sin(a)-l);if(h<1)return!1;this.setPosition(e,null,null,h)},SVGRenderer.prototype.adjustAspectRatioAfterHorizontalStretch=function(e,t,i,n){var o="right-stretch"===n,s=null;s=o?this.getRotatedPoint(e.x,e.y,e):this.getRotatedPoint(1*e.x+1*e.width,1*e.y+1*e.height,e);var r=this.bounds(t);this.setDimensions(t,null,r.width/i,null),r=this.bounds(t);var a=null;a=o?this.getRotatedPoint(r.x,r.y,r):this.getRotatedPoint(1*r.x+1*r.width,1*r.y+1*r.height,r);var l=s.x-a.x,h=s.y-a.y;this.setPosition(t,1*r.x+l,null,null),o?this.setPosition(t,null,1*r.y+h,null):this.setPosition(t,null,1*r.y,null)},SVGRenderer.prototype.adjustAspectRatioAfterVerticalStretch=function(e,t,i,n){var o="bottom-stretch"===n,s=null;s=o?this.getRotatedPoint(e.x,e.y,e):this.getRotatedPoint(1*e.x+1*e.width,1*e.y+1*e.height,e);var r=this.bounds(t);this.setDimensions(t,r.height*i,null,null),r=this.bounds(t);var a=null;a=o?this.getRotatedPoint(r.x,r.y,r):this.getRotatedPoint(1*r.x+1*r.width,1*r.y+1*r.height,r);var l=s.x-a.x,h=s.y-a.y;this.setPosition(t,1*r.x+l,1*r.y+h,1*r.z)},SVGRenderer.prototype.adjustAspectRatioAfterDiagonalStretch=function(e,t,i,n){var o=null;switch(n){case"bottom-right-stretch":o=this.getRotatedPoint(e.x,e.y,e);break;case"bottom-left-stretch":case"top-left-stretch":case"top-right-stretch":o=this.getRotatedPoint(1*e.x+1*e.width,1*e.y+1*e.height,e)}var s=this.bounds(t);this.setDimensions(t,s.height*i,null,null),s=this.bounds(t);var r=null;switch(n){case"bottom-right-stretch":r=this.getRotatedPoint(s.x,s.y,s);break;case"bottom-left-stretch":case"top-left-stretch":case"top-right-stretch":r=this.getRotatedPoint(1*s.x+1*s.width,1*s.y+1*s.height,s)}var a=o.x-r.x,l=o.y-r.y;switch(n){case"bottom-left-stretch":this.setPosition(t,1*s.x+a,1*s.y,1*s.z);break;case"bottom-right-stretch":case"top-left-stretch":this.setPosition(t,1*s.x+a,1*s.y+l,1*s.z);break;case"top-right-stretch":this.setPosition(t,1*s.x,1*s.y+l,1*s.z)}},SVGRenderer.prototype.getRotation=function(e){if(!e||e.id===this.TRACKER_GROUP_ID)return null;var t=null;try{t=e.transform.baseVal.getItem(0)}catch(e){return null}return 1*t.angle},SVGRenderer.prototype.setRotation=function(e,t){if(!e||e.transform.baseVal.numberOfItems<1)return null;var i=this.bounds(e),n="rotate("+t+","+(1*i.x+i.width/2*1)+","+(1*i.y+i.height/2*1)+")";e.setAttributeNS(null,"transform",n)},SVGRenderer.prototype.updateRotation=function(e){var t=this.getRotation(e);this.setRotation(e,t)},SVGRenderer.prototype.rotate=function(e,t){t||(t=0),(t%=360)<0&&(t=360+t),this.setRotation(e,t)},SVGRenderer.prototype.fineMove=function(e,t,i){if(e&&!this.isConnector(e)){var n=this.getPosition(e);this.setPosition(e,n.x+t,n.y+i,null),this.updateRotation(e)}},SVGRenderer.prototype.fineRotateSelection=function(e,t){if(this.isConnector(e))return 0;var i=this.getRotation(e);return i||(i=0),(i=(i+t)%360)<0&&(i=360+i),this.setRotation(e,i),i},SVGRenderer.prototype.move=function(e,t,i,n){this.setPosition(e,t,i,n),this.updateRotation(e)},SVGRenderer.prototype.drawCurveLine=function(e,t,i,n,o,s){if(this.setLineFrom(e,t,i),this.setLineTo(e,n,o),!s){var r=Math.abs(t-n),a=Math.abs(i-o),l=t0;u--)r=a+c*(u-t)+d,h[h.length]=this.createTextShape(i[u-1],r,l,n,o,s);for(var p=t;p=0&&i[t].y>=0);t++);for(n=t+1;n=0&&i[n].y>=0);n++);if(i[t]&&i[n]){var s=this.importAndAppendChild(this.svgRoot,this.snapLine);s.id="snap-line",this.setLineFrom(s,i[t].x,i[t].y),this.setLineTo(s,i[n].x,i[n].y)}this.isSnapLineShowing=!0},SVGRenderer.prototype.showSnapLineCoords=function(e){var t=this.importAndAppendChild(this.svgRoot,this.snapLine);t.id="snap-line",!0===e.showX&&!0===e.showY?(!1===this.lastSnapLineOrientation?(this.setLineFrom(t,e.x,0),this.setLineTo(t,e.x,this.MAX_WIDTH)):(this.setLineFrom(t,0,e.y),this.setLineTo(t,this.MAX_HEIGHT,e.y)),this.isSnapLineShowing=!0):!0===e.showX?(this.lastSnapLineOrientation=!0,this.setLineFrom(t,e.x,0),this.setLineTo(t,e.x,this.MAX_WIDTH),this.isSnapLineShowing=!0):!0===e.showY&&(this.lastSnapLineOrientation=!1,this.setLineFrom(t,0,e.y),this.setLineTo(t,this.MAX_HEIGHT,e.y),this.isSnapLineShowing=!0)},SVGRenderer.prototype.hideSnapLine=function(){if(this.isSnapLineShowing){var e=document.getElementById("snap-line");e&&this.remove(e),this.isSnapLineShowing=!1}},SVGInspector={points:[],svgNS:"http://www.w3.org/2000/svg",clear:function(){for(var e in SVGInspector.points)SVGInspector.points.hasOwnProperty(e)&&SVGInspector.removePoint(e);SVGInspector.points=[]},addPoint:function(e,t,i,n){SVGInspector.points[e]&&SVGInspector.removePoint(e),SVGInspector.points[e]={x:t,y:i};var o=document.getElementById("SVG_ROOT"),s=o.ownerDocument,r=s.createElementNS(SVGInspector.svgNS,"circle");r.setAttributeNS(null,"cx",t),r.setAttributeNS(null,"cy",i),r.setAttributeNS(null,"r",5),r.setAttributeNS(null,"fill",n),r.setAttributeNS(null,"stroke","#000000"),r.setAttributeNS(null,"stroke-width","1px");var a=s.createElementNS(SVGInspector.svgNS,"text");a.setAttributeNS(null,"x",t),a.setAttributeNS(null,"y",i),a.setAttributeNS(null,"dx","1em"),a.setAttributeNS(null,"dy","1em"),a.textContent=e;var l=s.createElementNS(SVGInspector.svgNS,"g");l.id=e,l.appendChild(r),l.appendChild(a),o.appendChild(l)},removePoint:function(e){if(SVGInspector.points[e]){delete SVGInspector.points[e];var t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}}},ThreeDRenderer=function(e,t,i,n,o){this.root=e,this.requestID=null,this.requestTimerID=null,this.camera=null,this.controls=null,this.transformControls=null,this.scene=null,this.ambientLight=null,this.directionalLight=null,this.directionalLightHelper=null,this.hemiLight=null,this.spotLight=null,this.renderer=null,this.raycaster=null,this.floorGrid=null,this.selectedItems=[],this.collidingItems=[],this.externalItems=[],this.multipleSelectorDummy=null,this.edgesBoxes=[],this.colorDefault=16733491,this.colorSelection=65280,this.colorCollision=16711680,this.colorExternal=16776960,this.colorWhite=16777215,this.colorWall=12237498,this.materials=[],this.objects=[],this.objectChildren=[],this.objectMaterials=[],this.objectLineMaterials=[],this.polylines=[],this.width=t||640,this.height=i||480,this.planeWidth=n||2e3,this.planeHeight=o||2e3,this.shapeFolder="/shapes/obj/",this.nearThreshold=1e-6,this.origin={x:0,y:0,z:0,signX:1,signY:1,signZ:1},this.scale=1,this.viewStyle="TOP",this.fieldOfView=50,this.renderLastMove=Date.now(),this.renderRunning=!0,this.renderStandByAfter=2e3,this.enableFloor=!1,this.floorDefinition=null,this.enableWalls=!1,this.enableDinamicLights=!1,this.showWalls=!0,this.wallHeight=3e3,this.wallThickness=1,this.objectCastShadows=!0,this.objectReceiveShadows=!0,this.DEFAULT_BACKGROUND_COLOR=16316664,this.DEFAULT_AMBIENT_LIGHT_COLOR=9342606,this.DEFAULT_DIRECTIONAL_LIGHT_COLOR=16711422,this.DEFAULT_HEMI_LIGHT_SKY_COLOR=268435455,this.DEFAULT_HEMI_LIGHT_GROUND_COLOR=14407628,this.DEFAULT_SPOT_LIGHT_COLOR=16777215},ThreeDRenderer.prototype={init:function(e,t,i,n,o,s,r,a,l,h,d){if(i&&(this.viewStyle=i),t&&(this.scale=t),this.enableFloor=r,this.floorDefinition=a,this.enableWalls=l,this.enableDinamicLights=n,"string"==typeof h&&h.length>0){var c=h.split("|");c.length>=1&&(this.wallHeight=1*c[0]),c.length>=2&&(this.wallThickness=1*c[1])}this.origin={x:e.x/t,y:e.y/t,z:e.z/t,signX:e.signX,signY:-1*e.signY,signZ:e.signZ},this.materials.default=new THREE.MeshPhongMaterial({color:this.colorDefault}),this.materials.multi=new THREE.MeshBasicMaterial({color:this.colorSelection,wireframe:!0}),this.materials.group=new THREE.MeshPhongMaterial({color:this.colorWhite,opacity:.05,transparent:!0}),this.materials.selection=new THREE.MeshPhongMaterial({color:this.colorSelection,opacity:.5,transparent:!0}),this.materials.collision=new THREE.MeshPhongMaterial({color:this.colorCollision,opacity:.5,transparent:!0}),this.materials.external=new THREE.MeshPhongMaterial({color:this.colorExternal,opacity:.5,transparent:!0}),this.materials.white=new THREE.MeshPhongMaterial({color:this.colorWhite}),this.materials.whiteopaque=new THREE.MeshPhongMaterial({color:this.colorWhite,opacity:.25,transparent:!0}),this.materials.edge=new THREE.LineBasicMaterial({color:16776960,linewidth:2}),this.materials.wall=new THREE.MeshPhongMaterial({color:this.colorWall,side:THREE.DoubleSide,opacity:.5,transparent:!0}),this.enableFloor&&(this.floorDefinition.color?this.materials.floor=new THREE.MeshPhongMaterial({color:this.floorDefinition.color,side:THREE.DoubleSide}):this.floorDefinition.image&&(this.materials.floor=new THREE.MeshBasicMaterial({map:null,transparent:!0}))),this.scene=new THREE.Scene,this.scene.background=new THREE.Color(this.DEFAULT_BACKGROUND_COLOR),this.scene.name="Scene";const u=new THREE.AxesHelper(100);switch(u.geometry.attributes.position.array[3]*=this.origin.signX,u.geometry.attributes.position.array[10]*=this.origin.signY,this.scene.add(u),this.renderer=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setSize(this.width,this.height),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=THREE.PCFSoftShadowMap,this.renderer.cachedObjects=new E2DCache,this.renderer.cachedTextures=new E2DCache,this.camera=new THREE.PerspectiveCamera(this.fieldOfView,1,1,1e4),this.camera.cachedCameraLookAt=null,this.camera.cachedCameraPosition=null,this.camera.aspect=this.width/this.heigth,this.camera.lookAt(this.scene.position),this.camera.up.set(0,0,1),this.viewStyle.toLowerCase()){case"front":this.camera.position.set(200*this.origin.signX,200*this.origin.signY,500*this.origin.signZ);break;default:this.camera.position.set(500*this.origin.signX,500*this.origin.signY,200*this.origin.signZ)}if(n?(this.hemiLight=new THREE.HemisphereLight(this.DEFAULT_HEMI_LIGHT_GROUND_COLOR,this.DEFAULT_HEMI_LIGHT_GROUND_COLOR,.7),this.scene.add(this.hemiLight),this.spotLight=new THREE.SpotLight(this.DEFAULT_SPOT_LIGHT_COLOR,.5),this.spotLight.castShadow=!0,this.spotLight.angle=Math.PI/2.5,this.spotLight.penumbra=.5,this.spotLight.decay=2,this.spotLight.shadow.bias=-1e-4,this.spotLight.shadow.mapSize.width=4096,this.spotLight.shadow.mapSize.height=4096,this.spotLight.shadow.camera.near=1,this.spotLight.shadow.camera.far=2e3,this.spotLight.shadow.camera.fov=60,this.scene.add(this.spotLight),this.scene.add(this.spotLight.target)):(this.ambientLight=new THREE.AmbientLight(this.DEFAULT_AMBIENT_LIGHT_COLOR,1),this.scene.add(this.ambientLight),this.directionalLight=new THREE.DirectionalLight(this.DEFAULT_DIRECTIONAL_LIGHT_COLOR,1),this.directionalLight.position.set(100,-500,1e3),this.directionalLight.castShadow=!0,this.directionalLight.shadow.camera.near=1,this.directionalLight.shadow.camera.far=2e3,this.directionalLight.shadow.camera.right=2500,this.directionalLight.shadow.camera.left=-2500,this.directionalLight.shadow.camera.top=2500,this.directionalLight.shadow.camera.bottom=-2500,this.directionalLight.shadow.mapSize.width=2048,this.directionalLight.shadow.mapSize.height=2048,this.scene.add(this.directionalLight)),o){const e=new THREE.Mesh(new THREE.PlaneGeometry(5e3,5e3,25,25),this.materials.white);e.position.set(0,0,-.1),e.castShadow=!1,e.receiveShadow=!0,this.scene.add(e),this.floorGrid=new THREE.GridHelper(5e3,200),this.floorGrid.rotation.x=-Math.PI/2,this.scene.add(this.floorGrid),s||(this.floorGrid.visible=!1)}this.raycaster=new THREE.Raycaster;const p=document.getElementById(this.root);p.appendChild(this.renderer.domElement),$(p).on("vclick",this.onClick.bind(this)),$(p).on("dblclick",this.onDblClick.bind(this)),this.controls=new THREE.OrbitControls(this.camera,p),this.controls.rotateSpeed=1,this.controls.zoomSpeed=1.2,this.controls.panSpeed=.8,this.controls.enablePan=!0,this.controls.enableZoom=!0,this.controls.enableDamping=!0,this.controls.dampingFactor=.3,this.controls.maxPolarAngle=Math.PI/2,this.controls.addEventListener("change",this.onControlsChange.bind(this)),this.transformControls=new THREE.TransformControls(this.camera,p),this.transformControls.setMode("translate"),this.transformControls.addEventListener("objectChange",this.onTransformControlsChange.bind(this)),this.transformControls.addEventListener("mouseDown",this.onTransformControlsMouseDown.bind(this)),this.transformControls.addEventListener("mouseUp",this.onTransformControlsMouseUp.bind(this)),this.scene.add(this.transformControls),E2DEventBus.addEventListener("shapeSelected",this.onShapeSelected,this),E2DEventBus.addEventListener("shapeMultiSelected",this.onShapeMultiSelected,this),E2DEventBus.addEventListener("shapeAddCollision",this.onShapeAddCollision,this),E2DEventBus.addEventListener("shapeClearCollisions",this.onShapeClearCollisions,this),E2DEventBus.addEventListener("shapeAddExternal",this.onShapeAddExternal,this),E2DEventBus.addEventListener("shapeClearExternals",this.onShapeClearExternals,this),this.renderON(d)},dispose:function(){this.requestID&&(cancelAnimationFrame(this.requestID),this.requestID=null);const e=document.getElementById(this.root);e.removeChild(this.renderer.domElement);const t=$(e);t.off("vclick"),t.off("vmousedown"),t.off("vmouseup"),t.off("vmousemove"),t.off("dblclick"),E2DEventBus.removeEventListener("shapeSelected",this.onShapeSelected,this),E2DEventBus.removeEventListener("shapeMultiSelected",this.onShapeMultiSelected,this),E2DEventBus.removeEventListener("shapeAddCollision",this.onShapeAddCollision,this),E2DEventBus.removeEventListener("shapeClearCollisions",this.onShapeClearCollisions,this),E2DEventBus.removeEventListener("shapeAddExternal",this.onShapeAddExternal,this),E2DEventBus.removeEventListener("shapeClearExternals",this.onShapeClearExternals,this),this.root=null,this.camera=null,this.controls=null,this.scene=null,this.renderer.dispose(),this.renderer=null,this.raycaster=null,this.selectedItems=null,this.collidingItems=null,this.externalItems=null,this.multipleSelectorDummy=null,this.edgesBoxes=[],this.objects=[],this.objectChildren=[],this.objectMaterials=[],this.objectLineMaterials=[],this.polylines=[];for(const e in this.materials)this.materials.hasOwnProperty(e)&&this.materials[e]&&this.materials[e].dispose&&"function"==typeof this.materials[e].dispose&&(this.materials[e].dispose(),this.materials[e]=null);this.materials=[]},initSystemShapes:function(){},disposeSystemShapes:function(){this.edgesBoxes=[],this.objects=[],this.objectChildren=[],this.objectMaterials=[],this.objectLineMaterials=[],this.polylines=[]},changeBias:function(e){this.directionalLight&&(this.directionalLight.shadow.bias=1*e)},changeNear:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.near=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeFar:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.far=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeRight:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.right=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeLeft:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.left=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeTop:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.top=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeBottom:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.bottom=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeWidth:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.width=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},changeHeight:function(e){this.directionalLight&&(this.directionalLight.shadow.camera.height=1*e,this.directionalLight.shadow.camera.updateProjectionMatrix())},onClick:function(e){e.preventDefault();const t=$(e.target).offset(),i=e.clientX-t.left,n=e.clientY-t.top,o=new THREE.Vector3;o.set(i/this.width*2-1,-n/this.height*2+1,.5),o.unproject(this.camera),this.raycaster.ray.set(this.camera.position,o.sub(this.camera.position).normalize());const s=this.raycaster.intersectObjects(E2DUtils.objectValues(this.objects),!0);if(s.length>0){const t=this.getParentObject3D(s[0].object);if(t){const i=E2DGlobals.e2d.insertedShapes.getShapeById(t.id);if(i&&i.hasBehaviour("(NOSELECT"))return;if(e.shiftKey)this.selectedItems[t.id]?this.removeSelection(t.id,!0,!0):this.addSelection(t.id,!0,!0);else{var r=E2DGlobals.e2d;Object.values(r.insertedShapes.insertedShapeMap).forEach(function(e){e.id!==t.id&&(e.selected=!1)}),this.select(t,!0)}}else this.unselect()}else this.unselect()},onDblClick:function(e){e.preventDefault();const t=this.raycaster.intersectObjects(E2DUtils.objectValues(this.objects),!0);if(t.length>0){if(this.getParentObject3D(t[0].object)){var i=E2DGlobals.e2d;if(!i.selected)return!1;if(!i.renderer.isPolyline(i.selected)){var n=i.insertedShapes.getShapeById(i.selected.id);if(n&&"text"!==n.source&&i.events.doubleclick){var o=null,s=[];if(i.renderer.isMultipleSelect(i.selected)){for(var r=i.multipleSelectShapes.getShapes(),a=0,l=r.length;a1&&evt&&evt.currentTarget&&evt.currentTarget.id&&!i.renderer.isMultipleSelect(evt.currentTarget)){for(var h=evt.currentTarget.id,d=null,c=-1,u=0,p=s.length;u0&&E2DEvents.doSubmitEvent("OnEditor2DDoubleClick",s,1,"urDoubleClick")}}}}},onControlsChange:function(){},onTransformControlsChange:function(){const e=this.transformControls.object;if(!e)return;let t=e.position.x/this.scale*this.origin.signX,i=e.position.y/this.scale*this.origin.signY,n=e.position.z/this.scale*this.origin.signZ;n<0&&(n=0,e.position.setZ(n)),e.updateMatrix(),E2DGlobals.e2d.updateById(e.id,t,i,n)},onTransformControlsMouseDown:function(){this.controls.enabled=!1},onTransformControlsMouseUp:function(){this.controls.enabled=!0},onShapeSelected:function(e,t){t?this.selectById(e.target):this.unselect()},onShapeMultiSelected:function(e,t){t?this.addSelection(e.target):this.removeSelection(e.target)},onShapeAddCollision:function(e){this.addCollision(e.target)},onShapeClearCollisions:function(e){this.clearCollisions()},onShapeAddExternal:function(e){this.addExternal(e.target)},onShapeClearExternals:function(e){this.clearExternals(e.target)},onObjectAdded:function(e,t,i,n){this.addObject(e.target,t,i,n)},onObjectRemoved:function(e){this.removeObject(e.target)},onObjectUpdated:function(e){this.updateObject(e.target)},onMultipleSelectorAdded:function(e){this.addMultipleSelector(e.target)},onMultipleSelectorRemoved:function(e){this.removeMultipleSelector()},onMultipleSelectorUpdated:function(e,t,i,n,o){this.updateMultipleSelector(t,i,n,o)},selectById:function(e){const t=this.scene.getObjectById(e);this.select(t,!1)},select:function(e,t){e&&(this.selectedItems[e.id]||(this.unselect(),e.material=this.materials.selection,e.updateMatrix(),this.selectedItems[e.id]=!0,"floor"===e.sourceType&&"wall"===e.sourceType||this.attachTransformControlsToObject(e),t&&E2DGlobals.e2d.selectById(e.id)))},unselect:function(){if(this.selectedItems){for(const t in this.selectedItems)if(this.selectedItems.hasOwnProperty(t)){var e=this.scene.getObjectById(t);e.material=this.materials[this.objectMaterials[t]],e.updateMatrix()}this.selectedItems=[],this.detachTransformControlsFromObject()}},addSelection:function(e,t,i){if(e){if(!this.selectedItems[e]){const t=this.scene.getObjectById(e);if(!t)return;t.material=this.materials.selection,t.updateMatrix(),this.selectedItems[t.id]=!0}this.detachTransformControlsFromObject(),t&&E2DGlobals.e2d.addSelectionById(e,i,!0)}},removeSelection:function(e,t,i){if(e){if(this.selectedItems[e]){const t=this.scene.getObjectById(e);t.material=this.materials[this.objectMaterials[e]],t.updateMatrix(),delete this.selectedItems[e]}t&&E2DGlobals.e2d.removeSelectionById(e,i,!0)}},addMultipleSelector:function(e){"number"!=typeof e.rotation&&(e.rotation=0);const t=e.x+e.width/2,i=e.y+e.height/2,n=t*this.scale*this.origin.signX,o=i*this.scale*this.origin.signY,s=e.z*this.scale*this.origin.signZ,r=e.width*this.scale,a=e.height*this.scale,l=e.depth*this.scale;let h=-E2DUtils.deg2rad(1*e.rotation);isNaN(h)&&(h=0);const d=new THREE.BoxGeometry(r,a,l);d.applyMatrix((new THREE.Matrix4).makeTranslation(0,0,l/2)),this.multipleSelectorDummy=new THREE.Mesh(d,this.materials.multi),this.multipleSelectorDummy.id="dsID",this.multipleSelectorDummy.name="dsNM",this.multipleSelectorDummy.sourceType="dsST",this.multipleSelectorDummy.userData={initSize:{width:r,height:a,depth:l}},this.multipleSelectorDummy.position.set(n,o,s),this.multipleSelectorDummy.rotation.set(0,0,h,"XYZ"),this.multipleSelectorDummy.castShadow=!1,this.multipleSelectorDummy.receiveShadow=!1,this.multipleSelectorDummy.matrixAutoUpdate=!1,this.multipleSelectorDummy.updateMatrix(),this.scene.add(this.multipleSelectorDummy)},removeMultipleSelector:function(){this.multipleSelectorDummy&&this.removeAndDisposeObject(this.multipleSelectorDummy)},updateMultipleSelector:function(e,t,i,n){if(!this.multipleSelectorDummy)return;const o=(e*this.scale+this.multipleSelectorDummy.userData.initSize.width/2)*this.origin.signX,s=(t*this.scale+this.multipleSelectorDummy.userData.initSize.height/2)*this.origin.signY,r=i*this.scale*this.origin.signZ;let a=-E2DUtils.deg2rad(1*n);isNaN(a)&&(a=0),this.multipleSelectorDummy.position.setX(o),this.multipleSelectorDummy.position.setY(s),this.multipleSelectorDummy.position.setZ(r),this.multipleSelectorDummy.rotation.set(0,0,a,"XYZ"),this.multipleSelectorDummy.updateMatrix()},addCollision:function(e){if(e&&!this.collidingItems[e]){const t=this.scene.getObjectById(e);if(!t)return;t.material=this.materials.collision,this.collidingItems[t.id]=!0}},clearCollisions:function(){if(this.collidingItems){for(const e in this.collidingItems)if(this.collidingItems.hasOwnProperty(e)){const t=this.scene.getObjectById(e);this.selectedItems[e]?t.material=this.materials.selection:t.material=this.materials[this.objectMaterials[e]]}this.collidingItems=[]}},addExternal:function(e){if(e&&!this.externalItems[e]){const t=this.scene.getObjectById(e);if(!t)return;t.material=this.materials.external,this.externalItems[t.id]=!0}},clearExternals:function(){if(this.externalItems){for(const e in this.externalItems)if(this.externalItems.hasOwnProperty(e)){this.scene.getObjectById(e).material=this.materials[this.objectMaterials[e]]}this.externalItems=[]}},changeViewMode:function(e){if(E2DUtils.objectSize(this.objects)<=0)return!1;this.camera.cachedCameraLookAt||this.camera.cachedCameraPosition||(this.camera.cachedCameraLookAt=this.getCameraLookAt(),this.camera.cachedCameraPosition=this.getCameraPosition());const t=this.getGlobalBoundingBox(),i=t.min,n=t.max,o=n.x-i.x,s=n.y-i.y,r=n.z-i.z,a=Math.sqrt(o*o+s*s+r*r);Math.abs(a/2/Math.tan(this.fieldOfView/2));let l=new THREE.Vector3(.5*(i.x+n.x),.5*(i.y+n.y),.5*(i.z+n.z));switch(e){case"1":this.camera.position.set(a*this.origin.signX+l.x,a*this.origin.signY+l.y,a*this.origin.signZ+l.z);break;case"2":this.camera.position.set(i.x-a,l.y,l.z);break;case"3":this.camera.position.set(n.x+a,l.y,l.z);break;case"4":this.camera.position.set(l.x,l.y,n.z+a);break;case"5":this.camera.position.set(l.x,n.y-1.25*a,l.z);break;default:this.camera.position.set(this.camera.cachedCameraPosition.x,this.camera.cachedCameraPosition.y,this.camera.cachedCameraPosition.z),l=new THREE.Vector3(this.camera.cachedCameraLookAt.x,this.camera.cachedCameraLookAt.y,this.camera.cachedCameraLookAt.z),this.camera.cachedCameraLookAt=null,this.camera.cachedCameraPosition=null}return this.camera.up.set(0,0,1),this.camera.lookAt(l),this.controls.target=l,this.controls.update(),!0},loadStlModel:function(e,t){const i=$.Deferred(),n=e+this.shapeFolder+t+".stl";return(new THREE.STLLoader).load(n,function(e){e.vertices&&0===e.vertices.length?i.resolve(null):i.resolve(e)}),i.promise()},loadTexture:function(e){const t=$.Deferred();return(new THREE.TextureLoader).load(e,function(e){e?t.resolve(e):t.resolve(null)}),t.promise()},_addGroup:function(e,t,i,n,o,s,r){const a=E2DGlobals.e2d;t=a.convertPixelsToUserData(t)*this.scale,i=a.convertPixelsToUserData(i)*this.scale,n=a.convertPixelsToUserData(n)*this.scale;const l=e.getShapeCenter(),h=l.x*this.scale*this.origin.signX,d=l.y*this.scale*this.origin.signY,c=e.z*this.scale*this.origin.signZ,u=e.width*this.scale,p=e.height*this.scale,g=e.depth*this.scale,y=-E2DUtils.deg2rad(1*e.rotation),f=new THREE.BoxGeometry(u,p,g);f.applyMatrix((new THREE.Matrix4).makeTranslation(0,0,g/2));const v=new THREE.Mesh(f,this.materials.group);v.id=e.id,v.name=e.source,v.sourceType="group",v.castShadow=!1,v.receiveShadow=!1,v.userData={initSize:{x:u,y:p,z:g}},v.position.set(h,d,c),v.rotation.set(0,0,y,"XYZ"),this.objects[v.id]=v,this.objectMaterials[v.id]="group",this.scene.add(v),o?this.select(v):s&&this.addSelection(e.id);for(let o=0,s=r.length;o=0){const t=e.rotation.split(";");v=t.length>=1?1*t[0]:0,m=t.length>=2?1*t[1]:0,S=t.length>=3?1*t[2]:0}else S=-E2DUtils.deg2rad(1*e.rotation);u.rotation.set(v,m,S,"XYZ"),this.objectMaterials[u.id]="default",this.objectLineMaterials[u.id]="default",this.updateObjectStyle(u,e),u.matrixAutoUpdate=!1,u.updateMatrix(),u.castShadow=this.objectCastShadows,u.receiveShadow=this.objectReceiveShadows,n?(u.sourceType="groupItem",this.objectChildren[n.id]?this.objectChildren[n.id][this.objectChildren[n.id].length]=u:this.objectChildren[n.id]=[u],n.add(u)):(this.objects[u.id]=u,this.scene.add(u)),t?this.select(u):i&&this.addSelection(e.id)},_addPolyLine:function(e,t,i){this.polylines[e.id]=[],this._addFloor(e),this._addWall(e,t,i)},_addFloor:function(e){if(this.enableFloor&&e.path)if(this.floorDefinition.image){let t=this.renderer.cachedTextures.get("floor");t||(t=this.loadTexture(this.floorDefinition.image),this.renderer.cachedTextures.set("floor",t));const i=this;t.done(function(t){t.wrapS=THREE.RepeatWrapping,t.wrapT=THREE.RepeatWrapping,t.repeat.set(.118,.118),i.materials.floor=new THREE.MeshBasicMaterial({map:t,transparent:!0}),i._addFloorAsync(e)})}else this._addFloorAsync(e)},_addFloorAsync:function(e){const t=E2DUtils.splitPath(e.path);if(!t||0===t.length)return;let i=0,n=(this.floorDefinition.thickness||.5)*this.scale;n<0&&(i=n,n*=-1),t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y||(t[t.length]={x:t[0].x,y:t[0].y});for(let e=0,i=t.length;e0)for(let t=0,i=e.length;t0){for(let e=0,i=t.length;el?Math.abs(h.x):l,l=Math.abs(h.y)>l?Math.abs(h.y):l}const h=Math.abs(.85-l);if(h>.05){const e=new THREE.Vector3(this.camera.position.x,this.camera.position.y,this.camera.position.z),i=new THREE.Vector3(t.x,t.y,t.z);let n=.1*(1+h);l>.85&&(n*=-1),i.multiplyScalar(n),e.add(i),this.camera.position.set(e.x,e.y,e.z)}},rotateAroundObjectAxis:function(e,t,i){if(!this.isBelowThreshold(e.rotation.z,i)){const n=new THREE.Matrix4;n.makeRotationAxis(t.normalize(),i),e.matrix.multiply(n),e.rotation.setFromRotationMatrix(e.matrix)}},rotateAroundWorldAxis:function(e,t,i){if(!this.isBelowThreshold(e.rotation.z,i)){const n=new THREE.Matrix4;n.makeRotationAxis(t.normalize(),i),n.multiply(e.matrix),e.matrix=n,e.rotation.setFromRotationMatrix(e.matrix)}},rotateAroundWorldX:function(e,t){const i=new THREE.Euler(t,0,0,"XYZ");e.position.applyEuler(i)},rotateAroundWorldY:function(e,t){const i=new THREE.Euler(0,t,0,"XYZ");e.position.applyEuler(i)},rotateAroundWorldZ:function(e,t){const i=new THREE.Euler(0,0,t,"XYZ");e.position.applyEuler(i)},isBelowThreshold:function(e,t){return Math.abs(e-t)<=this.nearThreshold},getInsertedObjectById:function(e){return this.scene.getObjectById(e)},getInsertedObjectByName:function(e){return this.scene.getObjectByName(e)},getParentObject3D:function(e){return e?"Mesh"===e.type&&"group"===e.sourceType?e:"Mesh"===e.type&&"stl"===e.sourceType?e:"Mesh"===e.type&&"textured"===e.sourceType?e:"Mesh"===e.type&&"floor"===e.sourceType?null:"Mesh"===e.type&&"wall"===e.sourceType?e:"Object3D"===e.type&&"obj"===e.sourceType?e:this.getParentObject3D(e.parent):null},getMesh:function(e){return"Object3D"===e.type?e.children[0]:e},renderON:function(e){if(!this.renderer)return;if(this.renderer.render(this.scene,this.camera),this.enableDinamicLights&&this.spotLight){var t=new THREE.Vector3(0,0,200).applyQuaternion(this.camera.quaternion).add(this.camera.position);this.spotLight.position.set(t.x-10,t.y+50,t.z+10);var i=new THREE.Vector3(0,0,-1e4).applyQuaternion(this.camera.quaternion).add(this.camera.position);this.spotLight.target.position.set(i.x,i.y,i.z)}const n=this;this.requestTimerID=setTimeout(function(){n.requestID=requestAnimationFrame(function(){n.renderON(e)})},1e3/e)},renderOFF:function(){this.requestTimerID&&(clearTimeout(this.requestTimerID),this.requestTimerID=null),this.requestID&&(cancelAnimationFrame(this.requestID),this.requestID=null)},renderSingle:function(){const e=this;this.requestID=requestAnimationFrame(function(){e.renderer.render(e.scene,e.camera)})},resize:function(e,t){this.width=e,this.height=t,this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.width,this.height)},toPng:function(){const e=document.querySelector("#"+this.root+" canvas");return e?(new Converter).canvasToPng(e):null}},$(function(){E2DGlobals.initializeEditor()}),E2DGlobals={e2d:null,e2dLayout:null,visibleProperties:"",doBackgroundCheckOnly:!1,dragFps:4,defaultFps:30,dragTimerMode:!0,initializeEditor:function(){if(window.SVGRenderer){var e=$("#E2DEditor");e.droppable({accept:".paletteItem",greedy:!0,tolerance:"fit",drop:E2DEvents.createNewShape});var t=new SVGRenderer;E2DGlobals.e2d=new E2DEditor(e,t),E2DGlobals.e2dLayout=$("#E2DContainer").layout({livePaneResizing:!0,north__closable:!1,north__resizable:!1,north__slidable:!1,north__spacing_open:0,north__spacing_closed:0,east__initHidden:!0,east__resizable:!0,east__slidable:!1,east__size:"40%",east__onclose:E2DEvents.onCloseEastPanel,east__onresize:E2DEvents.onResizeEastPanel,west__initClosed:!1,west__resizable:!0,west__slidable:!1,west__size:"15%",west__childOptions:{minSize:200,south__initHidden:!0,south__resizable:!0,south__slidable:!0,south__size:"35%"},south__initHidden:!0,south__closable:!1,south__resizable:!1,south__slidable:!1,south__spacing_open:0,south__spacing_closed:0}),$(window).on("resize",E2DEvents.onResizeWindow),$("body").on("keypress",E2DEvents.trapDefaultKeys)}else setTimeout(E2DGlobals.initializeEditor,250)},isShapesLoadPending:function(){return E2DGlobals.e2d.isShapesLoadPending()},getPreferencesData:function(){return"V4"},getShapesData:function(e,t,i){var n=E2DGlobals.e2d;!t&&n.checkCollisions&&n.performCheckCollisionsFULL(),!t&&n.checkInclusions&&n.performCheckInclusionsFULL(),!i&&n.includeConnectionPoints&&n.performIncludeConnectionPoints();var o=n.insertedShapes.getShapes(!0);return e?o:JSON.stringify(o)},getShapePropertyData:function(){var e=E2DGlobals.e2d,t="";return e.groupProp?t=e.groupProp:e.groupPropID&&(t=e.libraryProperties[e.groupPropID]),t&&(t.eventHandlers&&(t.eventHandler=e.getEventHandler("regrouped",t.id),t.eventHandlers=JSON.stringify(t.eventHandlers)),t.custom&&(t.custom=JSON.stringify(t.custom)),t.connectionPoints&&(t.connectionPoints=JSON.stringify(t.connectionPoints)),t.group2d&&t.group2d.shapes&&(t.group2dShapes=JSON.stringify(t.group2d.shapes)),t.group2d&&t.group2d.connectors&&(t.group2dConnectors=JSON.stringify(t.group2d.connectors)),delete t.group2d,t.group3d&&(t.group3d=JSON.stringify(t.group3d)),t=JSON.stringify(t)),t},getDrawingData:function(){var e=E2DGlobals.e2d;e.removeSystemShapes();var t=$("#_pageWidth").val(),i=$("#_pageHeight").val(),n=e.renderer.getGlobalBoundingBox();n&&(t=n.x2,i=n.y2);var o=e.renderer.cloneSVGRoot(t,i);if(o.removeChild&&o.querySelector){var s=o.getElementById(E2DGlobals.e2d.ORIGIN_ID);s&&o.removeChild(s);var r=o.getElementById(E2DGlobals.e2d.CUSTOM_ORIGIN_ID);r&&o.removeChild(r)}return o.outerHTML},getViewportData:function(e){const t=E2DGlobals.e2d,i={};return i.groupInfo=t.groupInfo,i.layers=t.libraryLayers,i.scroll=t.getScroll(),i.splitters=t.getSplitters(),i.toggles=t.getToggles(),i.zoom=t.getZoom(),i.e3dActive=t.getE3DActive(),i.e3dData=t.getE3DViewportData(),e?i:JSON.stringify(i)},setPreferencesData:function(e){if(E2DGlobals.e2d){var t=E2DGlobals.e2d;if(e&&"string"==typeof e){e=e.trim();var i=JSON.parse(e);E2DGlobals.doBackgroundCheckOnly=i.DoBackgroundCheckOnly,E2DGlobals.doBackgroundCheckOnly&&$("#_toolbar").css("display","none"),t.setShapeLibrary(i.ShapeLibrary,i.ShapeLibraryHideList,i.ShapeLibraryOpenList,i.PageLanguage),t.setShapeEvents(i.ShapeEvents),t.setPreferencesData(i)}else t.preferencesLoaded.resolve()}else alert("RD Editor 2D (setPreferencesData): not properly initialized.\nPlease, reload the page.")},setShapesData:function(e){if(E2DGlobals.e2d){var t=E2DGlobals.e2d,i=t.insertedShapes.getCount();if(!e||"string"!=typeof e)return i>0&&t.removeAll(!0),void t.shapesLoaded.resolve();E2DGlobals.showLockLayer(!0),t.shapesLoaded.done(function(){E2DGlobals.showLockLayer(!1)}),e=e.trim();var n=JSON.parse(e);0===i?t.setShapesData(n):t.mergeShapesData(n)}else alert("RD Editor 2D (setShapesData): not properly initialized.\nPlease, reload the page.")},setBackgroundData:function(e,t,i){E2DGlobals.e2d?e&&"string"==typeof e&&(e=e.trim(),E2DGlobals.e2d.setBackgroundData(e,t,i)):alert("RD Editor 2D (setBackgroundData): not properly initialized.\nPlease, reload the page.")},setViewportData:function(e){if(E2DGlobals.e2d){var t=E2DGlobals.e2d;if(!e||"string"!=typeof e||e.length&&e.length<=10)t.viewportLoaded.resolve();else{e=e.trim();var i=JSON.parse(e);t.setViewportData(i)}}else alert("RD Editor 2D (setViewportData): not properly initialized.\nPlease, reload the page.")},disposeEditor:function(e){E2DGlobals.e2d&&E2DGlobals.e2d.disposeEditor(e)},restoreEditor:function(){E2DGlobals.e2d&&E2DGlobals.e2d.restoreEditor()},showSplashScreen:function(e){e?document.getElementById("_splashScreen").classList.remove("hidden"):E2DGlobals.doBackgroundCheckOnly||document.getElementById("_splashScreen").classList.add("hidden")},showLockLayer:function(e){e?document.getElementById("_lockLayer").classList.remove("hidden"):document.getElementById("_lockLayer").classList.add("hidden")},exportImage2D:function(){const e=E2DGlobals.e2d;if(e.exportImage2D){const t=e.container.parent(),i=t.scrollLeft(),n=t.scrollTop(),o=E2DGlobals.e2dLayout.state.center.innerWidth,s=E2DGlobals.e2dLayout.state.center.innerHeight,r=e.zoom;(new Converter).svgToPng(e.renderer.cloneSVGRoot(),i,n,o,s,r,screen).done(E2DGlobals.exportImage2DAsync)}},exportImage2DAsync:function(e){if(E2DGlobals.e2d.exportImage2D&&E2DGlobals.e2d.image2DExported){const t=E2DEvents.doSubmitImageAsync("image2d.png",e);t&&t.always(function(){E2DGlobals.e2d.image2DExported.resolve()})}},exportImage3D:function(){const e=E2DGlobals.e2d;if(e.exportImage3D){(new Converter).canvasToPng(e.renderer3d.renderer.domElement).done(E2DGlobals.exportImage3DAsync)}},exportImage3DAsync:function(e){if(E2DGlobals.e2d.exportImage3D&&E2DGlobals.e2d.image3DExported){const t=E2DEvents.doSubmitImageAsync("image3d.png",e);t&&t.always(function(){E2DGlobals.e2d.image3DExported.resolve()})}}},E2DEditor.prototype.disposeEditor=function(e){this.renderer.dispose(),E2DGlobals.showLockLayer(!0),this.image2DExported=null,this.image3DExported=null,this.shapesLoaded=$.Deferred(),this.detachEditorEvents(),this.clearClipboard(),this.unselect(),e&&this.undoManager.clear(),E2DEvents.checkWestLayout()},E2DEditor.prototype.restoreEditor=function(){this.renderer.initSystemShapes(this.shapeLibraryList),this.attachEditorEvents(),this.clearClipboard(),this.shapesLoaded=$.Deferred(),this.groupProp=null,this.groupPropID=null,this.exportImage2D&&(this.image2DExported=$.Deferred(),E2DEvents.doSubmitImageAsync("image2d.png",null)),this.exportImage3D&&(this.image3DExported=$.Deferred(),E2DEvents.doSubmitImageAsync("image3d.png",null)),window.focus()},E2DEditor.prototype.attachEditorEvents=function(){this.container.on("vmousedown",E2DEvents.onMouseDown),this.container.on("vmouseup",E2DEvents.onMouseUp),this.container.on("selectstart",E2DEvents.onSelectStart),this.container.on("touchstart",E2DEvents.onTouchStart),this.container.on("touchmove",E2DEvents.onTouchMove),this.container.on("touchend",E2DEvents.onTouchEnd),this.container.on("gestureend",E2DEvents.onGestureEnd);var e=$(this.container[0].ownerDocument);e.on("keyup",E2DEvents.onKeyUp),e.on("keydown",E2DEvents.onKeyDown),this.mObserver=new MutationObserver(function(e){$.when(E2DGlobals.e2d.preferencesLoaded,E2DGlobals.e2d.viewportLoaded).done(function(){E2DEvents.checkWestLayout()})});var t=document.getElementById("E2DWestSouthContainer");this.mObserver.observe(t,{attributes:!0,attributeFilter:["style"],subtree:!0})},E2DEditor.prototype.detachEditorEvents=function(){this.container.off("vmousedown",E2DEvents.onMouseDown),this.container.off("vmouseup",E2DEvents.onMouseUp),this.container.off("selectstart",E2DEvents.onSelectStart),this.container.off("touchstart",E2DEvents.onTouchStart),this.container.off("touchmove",E2DEvents.onTouchMove),this.container.off("touchend",E2DEvents.onTouchEnd),this.container.off("gestureend",E2DEvents.onGestureEnd);var e=$(this.container[0].ownerDocument);e.off("keyup",E2DEvents.onKeyUp),e.off("keydown",E2DEvents.onKeyDown),this.mObserver&&this.mObserver.disconnect()},E2DEditor.prototype.detachEditorMoveEvents=function(){this.container.off("vmousemove",E2DEvents.onDraw),this.container.off("vmousemove",E2DEvents.onDrag),this.container.off("vmousemove",E2DEvents.onPageDrag),this.container.off("vmousemove",E2DEvents.onSelectionDrag)},E2DEditor.prototype.clearClipboard=function(){this.clipboard=null,this.iClipboard=null},E2DEditor.prototype.clearDragCache=function(){if(this.dragCache&&this.dragCache.linkedShapesHash)for(var e in this.dragCache.linkedShapesHash)if(this.dragCache.linkedShapesHash.hasOwnProperty(e)){var t=this.dragCache.linkedShapesHash[e];if(t&&t.length>0)for(var i=0,n=t.length;i0&&t[0]&&(this.enable3dFloorDefinition.color=t[0].startsWith("#")?t[0]:null,this.enable3dFloorDefinition.image=this.enable3dFloorDefinition.color?null:t[0])),this.enable3dWalls=e.PageShowPreview3DEnableWalls,this.enable3dWallDimensions=e.PageShowPreview3DWallDimensions,this.enableUndoRedo=e.PageShowUndoRedo,this.undoManager.enable(e.PageShowUndoRedo),this.initializeE2DToolbar(e.PageShowConnectorTools,e.PageShowConnectionPointTools,e.PageShowEditConnectionPointsTools,e.PageShowDrawTools,e.PageShowSmartLineTools,e.PageShowTextTools,e.PageShowGridPatternTools,e.PageShowZIndexTools,e.PageShowHelp,e.PageShowSave,e.PageShowActions,e.PageShowPreview3D,e.PageShowPreview3DDinamicLights,e.PageShowSmartCopyTools,e.PageShowGroupTools,e.PageShowQuoteTools,e.PageShowLinkTools,e.PageShowUtils,e.PageShowCustomOrigin,e.PageShowUndoRedo,e.PageShowToolsOnToolbar,e.DisableTopToolbar,e.DisableLeftToolbar),this.setFontSize(e.PageFontSize),this.setEnterBehaviour(e.EnterBehaviour),this.setUnit(e.PageUnit),this.setNumberOfDecimal(e.PageNumberOfDecimal),this.setScaleFactor(e.PageScaleFactor),this.setPageSizeEx(e.PageFormat),this.setGridSizeEx(e.PageGridSize),this.setRotationalGridSizeEx(e.PageGridRotation),this.setOrientation(e.PageOrientation);var i=this.setOrigin(e.PageOrigin);this.enableGrid(e.PageShowGrid),this.enableSnapToGrid(e.PageSnapToGrid),this.enableSnapToObject(e.PageSnapToObject,e.PageSnapToShapeCenter,e.PageGridSize),this.enableSnapToPolyline(e.PageSnapToPolyline,e.PageSnapToShapeCenter,e.PageGridSize),E2DEvents.onResizeWindow(),this.renderer.initFloor(this.enable3dFloor,this.enable3dFloorDefinition),this.initializeE3DPreview(i.data),e.PageZoomPage&&this.pageZoom(),E2DGlobals.showSplashScreen(!1),window.focus();var n=this;$.when(i.dfd).done(function(){n.origin=i.data,n.centerOrigin(),n.preferencesLoaded.resolve()}),e.DoAutoSave&&setInterval(E2DEvents.doSubmitAsync,3e5),e.DoExportImage2D&&(this.exportImage2D=!0,this.image2DExported=$.Deferred(),E2DEvents.doSubmitImageAsync("image2d.png",null)),e.DoExportImage3D&&(this.exportImage3D=!0,this.image3DExported=$.Deferred(),E2DEvents.doSubmitImageAsync("image3d.png",null))},E2DEditor.prototype.setBackgroundData=function(e,t,i){$.when(this.libraryLoaded,this.preferencesLoaded,this.viewportLoaded).done(function(){E2DGlobals.e2d.setBackgroundDataAsync(e,t,i)})},E2DEditor.prototype.setBackgroundDataAsync=function(e,t,i){t=this.convertUserDataToGraphData(t),i=this.convertUserDataToGraphData(i),this.renderer.setBackground(e,t,i)},E2DEditor.prototype.isShapesLoadPending=function(){return"pending"===this.shapesLoaded.state()},E2DEditor.prototype.setShapesData=function(e){$.when(this.libraryLoaded,this.preferencesLoaded,this.viewportLoaded).done(function(){E2DGlobals.e2d.setShapesDataAsync(e)})},E2DEditor.prototype.setShapesDataAsync=function(e){var t=[],i=[],n=[],o=[];this.renderer3d&&this.renderer3d.renderOFF();for(var s=69,r=0,a=e.length;r0){for(var i=[],n=0,o=e.length;n0)for(var u=0,p=c.length;u0){for(var i=[],n=0,o=e.length;n0)for(var i=0,n=t.length;i0){for(var u=0,p=o.length;u0&&E2DEvents.doSubmitEvent("OnEditor2DRemoved",n,1,"urDeleteShapes")}},E2DEditor.prototype.deleteItem=function(e,t){if(e){this.hideSmartLineMiddleConnectionPoints(e),this.hideSmartLineOrthoConnectionPoints();var i,n,o,s=this.insertedShapes.getShapeById(e.id);if(s)if(s.isLine()||s.isCurveLine()||s.isOrthoLine()||s.isLinkLine()||s.isQuoteLine())this.renderer.disconnectLineFromShape(e,"from"),this.renderer.disconnectLineFromShape(e,"to"),this.renderer.remove(e),this.insertedShapes.removeShape(e);else if(s.isSmartLine()){var r=this.insertedShapes.getConnectionShape(e.id,"from"),a=this.insertedShapes.getShapeById(r.shapeID),l=this.insertedShapes.getConnectionShape(e.id,"to"),h=this.insertedShapes.getShapeById(l.shapeID);this.renderer.remove(e),this.insertedShapes.removeShape(e),a&&h?(a.isSmartLineHub()&&(n=document.getElementById(r.shapeID),this.deleteItem(n,t)),h.isSmartLineHub()&&(o=document.getElementById(l.shapeID),this.deleteItem(o,t))):a&&a.isSmartLineHub()&&this.insertedShapes.getAttachedSmartLines(r.shapeID).length<=2?(n=document.getElementById(r.shapeID),this.deleteItem(n,t)):h&&h.isSmartLineHub()&&this.insertedShapes.getAttachedSmartLines(l.shapeID).length<=2&&(o=document.getElementById(l.shapeID),this.deleteItem(o,t))}else if(s.isSmartLineHub()){var d=this.insertedShapes.getAttachedSmartLines(e.id);switch(d.length){case 0:this.renderer.remove(e),this.insertedShapes.removeShape(e);break;case 1:this.renderer.remove(e),this.insertedShapes.removeShape(e),i=document.getElementById(d[0]),this.deleteItem(i,t);break;case 2:this.renderer.remove(e),this.insertedShapes.removeShape(e);var c=document.getElementById(d[0]),u=document.getElementById(d[1]);this.renderer.joinSmartLines(c,u,t);break;default:for(var p=0,g=d.length;p2?this.deletePolylinePoint(e):-1!==v&&-1!==m?this.deletePolylineSegment(e,v,m):(this.renderer.remove(e),this.insertedShapes.removeShape(e),E2DEvents.polylineStarted&&(E2DEvents.polylineStarted=!1,this.container.off("vmousemove",E2DEvents.onDraw),this.setPropertiesVisible(null)))}else{for(var D=this.insertedShapes.getAttachedLines(e.id),b=0,x=D.length;b1?(this.multipleSelectShapes.setSelectedShapes(w),O=this.resetMultipleSelector()):1===w.length&&(this.unselect(),O=w[0]),this.select(O),this.renderer.updateTracker(this.selected),this.copy(),this.clearShapeText(),this.resetShapeText();var G=[];for(var M in i)if(i.hasOwnProperty(M)){var R=this.getEventArgumentByShapeId("PASTED",i[M].id,"(ORIGSHAPEID="+M+")");R&&(G[G.length]=R)}this.handleZIndexPositioning(),this.events.pasted&&G&&G.length>0?E2DEvents.doSubmitEvent("OnEditor2DPasted",G,1,"urPasteShapes"):this.saveUndoRedoPoint(0,"urPasteShapes")}else this.setHelp("info","Nothing to paste, please use copy or cut on selected shape")},E2DEditor.prototype.pasteSingleConnector=function(e,t,i,n,o,s){var r=this.insertedShapes.getConnectionShape(e.id,"from"),a=this.insertedShapes.getConnectionShape(e.id,"to");if(!t.isSmartLine()&&!t.isLinkLine()||i[r.shapeID]&&i[a.shapeID]){this.pasteSingleShape(e,t,i,n,o,s,!0);var l=i[e.id];if(i[r.shapeID]){var h=i[r.shapeID];this.renderer.connectLineToShape(h,l,"from",r.pointID)}if(i[a.shapeID]){var d=i[a.shapeID];this.renderer.connectLineToShape(d,l,"to",a.pointID)}this.insertedShapes.updateConnector(l)}},E2DEditor.prototype.pasteSingleShape=function(e,t,i,n,o,s,r){var a=this.renderer.paste(e,o,s);r||E2DUtils.clearClassList(a),i[e.id]=a,this.addNewShapeListeners(a);var l=!1,h=null;if(this.renderer.isConnector(a))l=!this.renderer.isPolyline(a),h=InsertedShape.CreateShapeFromConnector(a,t.sourceLibrary);else{var d=this.renderer.bounds(a);d=this.convertTrueBoundsToUserBounds(d),d=this.applyRoundingToUserRect(d),h=InsertedShape.CreateShape(t.sourceLibrary,t.source,a.id,t.name,t.family,t.description,d.x,d.y,d.z,d.width,d.height,d.depth,d.rotation,t.text,t.behaviour,E2DUtils.cloneObject(t.custom),t)}h.group=n,this.insertedShapes.addShape(h,l),this.updateOnTheFlyStyleForHighlightEqualShape(h)},E2DEditor.prototype.addNewShapeListeners=function(e){if(e){var t=$(e);t.on("vclick",E2DEvents.onSingleDoubleClick),t.on("vmousedown",E2DEvents.onHit),t.on("vmouseover",E2DEvents.onShapeMouseOver),t.on("vmouseout",E2DEvents.onShapeMouseOut),t.on("touchstart",E2DEvents.onShapeTouchStart),t.on("touchend",E2DEvents.onShapeTouchEnd),t.addClass("shapeCursor")}},E2DEditor.prototype.getToolbarWidth=function(){return 1*$("#_toolbar").css("width").split("px")[0]-66},E2DEditor.prototype.getToolbarHeight=function(){return 1*$("#_toolbar").css("height").split("px")[0]},E2DEditor.prototype.getUrlForHelp=function(){var e=this.shapeLibraryList[0]+"/shapes/help/main.html";if(!this.selected)return e;if(this.renderer.isMultipleSelect(this.selected))return e;var t=this.insertedShapes.getShapeById(this.selected.id);if(!t)return e;var i=(t.sourceLibrary||this.shapeLibraryList[0])+"/shapes/help/"+t.source+".html";return E2DUtils.existsOnServer(i)||(i=e),i},E2DEditor.prototype.cancelLinkLine=function(){for(var e=this.getSelectedShapes(),t=0,i=e.length;t{if(r!==this.ORIGIN_ID&&r!==this.CUSTOM_ORIGIN_ID){var a=this.insertedShapes.getShapeById(r);this.selectById(r),this.createGridPatternItem(a,e,t,i,n,o,s)}}),this.unselect(),r.forEach(e=>{this.addSelectionById(e,!0)}),this.renderer3d&&this.renderer3d.renderON(E2DGlobals.defaultFps),this.handleZIndexPositioning()):this.setHelp("warning","No shape selected!")},E2DEditor.prototype.createGridPatternItem=function(e,t,i,n,o,s,r){if(e)if(e!==this.origin&&e!==this.customOrigin){var a=e.decodeBehaviour("(ORIGIN="),l=1,h=1;this.customOrigin&&(l=this.customOrigin.signX*this.origin.signX,h=this.customOrigin.signY*this.origin.signY),this.renderer3d&&this.renderer3d.renderOFF(),!0===s&&(i=e.width,o=e.height);var d=new Array;d[0]=this.createGridPatternRow(e,a,t,i,1,l,null);for(var c=1;c0&&this.linkShapes(e[o][s].id,n[0].from,e[o+1][s].id,n[0].to),s+10&&this.linkShapes(e[o][s].id,n[0].from,e[o][s+1].id,n[0].to))},E2DEditor.prototype.linkShapes=function(e,t,i,n){let o=new InsertedShape;o.source="link-line",o.shapeFromId=e,o.shapeFromPointIndex=t,o.shapeToId=i,o.shapeToPointIndex=n,this.createNewConnector(o)},E2DEditor.prototype.indexOfConnectingShape=function(e,t){if(this.renderer.isConnector(e))return-1;const i=this.renderer.getConnectionPointObjs(e);for(let e=0,n=t.length;e1)return E2DEvents.hideExtraToolbars(),E2DEvents.closeToolsDialog(),E2DEvents.openQuickPickCPDialog(),!1;var o=69,s=null;if(t){var r=t.split("--"),a=this.pointFromConnector(t),l=r[0],h=r[1],d=document.getElementById(l),c=this.renderer.isSmartLine(this.selected),u=this.renderer.isSmartLine(d);if("line-from"===this.resizeMode?c&&u?this.renderer.replaceSmartLineWithSmartLineHub(this.selected,d,a,"from",!1):this.renderer.connectLine(d,this.selected,"from",h):"line-to"===this.resizeMode&&(c&&u?this.renderer.replaceSmartLineWithSmartLineHub(this.selected,d,a,"to",!1):this.renderer.connectLine(d,this.selected,"to",h)),"line"!==this.mode&&"curve-line"!==this.mode&&"ortho-line"!==this.mode&&"smart-line"!==this.mode&&"quote-line"!==this.mode||t!==e&&(this.selected&&this.renderer.isConnector(this.selected)?c&&u?this.renderer.replaceSmartLineWithSmartLineHub(this.selected,d,a,"to",!1):this.renderer.connectLine(d,this.selected,"to",h):o=this.connectNewLine(e,t)),"link-line"===this.mode){if(t!==e)if(this.selected&&this.renderer.isConnector(this.selected)){var p=this.insertedShapes.getConnectionShape(this.selected.id,"from"),g=this.insertedShapes.isPinned(p.shapeID);if(g.pinnedX||g.pinnedY)this.deleteSelection(!0);else if(p.shapeID===d.id)this.deleteSelection(!0);else if(this.insertedShapes.areShapesConnectedWithQuote(p.shapeID,d.id,!0))this.deleteSelection(!0);else{var y=!0;this.insertedShapes.isCircularReference(d.id,this.selected,this.mode)&&(y=this.areOverlappingConnectionPoints(document.getElementById(p.shapeID),p.pointID,document.getElementById(r[0]),r[1])),y?(this.renderer.connectLine(d,this.selected,"to",h),this.renderer.validateLink(this.selected),s=$.Deferred(),this.fireLinkedEvent(this.selected,s)):(E2DEvents.showMessageDialog(this.translate("validation"),this.translate("circularReference")),this.deleteSelection(!0))}}else o=this.connectNewLine(e,t);this.unselect()}this.selected&&this.insertedShapes.updateConnector(this.selected)}else"smart-line"!==this.mode&&"link-line"!==this.mode||this.deleteSelection(!0);var f=this;$.when(o).done(function(i){var o=f.selected||i;if("quote-line"===f.mode&&o&&(0===f.renderer.getQuoteValue(o)?f.deleteSelection(!0):(f.selected||f.select(o),f.renderer.updateQuoteType(o))),n&&!isNaN(n.userZ)){var r=null,a=null;if(n.id===e){var l=t.split("--");r=document.getElementById(l[0]),a=f.insertedShapes.getShapeById(l[0])}else if(n.id===t){var h=e.split("--");r=document.getElementById(h[0]),a=f.insertedShapes.getShapeById(h[0])}if(r&&a){a.z=n.userZ;var d=f.convertUserBoundsToGraphBounds(a);f.updateShapeSingle(r,a,d)}}f.clearShapeText(),f.resetShapeText(),f.hideSmartLineOrthoConnectionPoints(),f.restoreMode(),E2DEvents.active_connector=null,E2DEvents.prev_connector=null,E2DEvents.connector_z=null,f.selected&&f.saveUndoRedoPoint(0,"urConnectShapes"),s&&s.resolve()})},E2DEditor.prototype.createLine=function(e,t,i,n){var o=this;this.renderer.createLine(this.shapeLibraryList[0],e,t,i).done(function(e){o.createLineAsync(e,t,i,n)})},E2DEditor.prototype.createLineAsync=function(e,t,i,n){E2DEvents.lineStarted=!0,this.select(e),this.selected.setAttribute("id","connector_"+E2DUtils.createUUID());var o=InsertedShape.CreateShapeFromConnector(this.selected,this.shapeLibraryList[0]);if(this.insertedShapes.addShape(o,!0),this.addNewShapeListeners(this.selected),this.container.on("vmousemove",E2DEvents.onDraw),this.renderer.moveLine(this.selected,t,i,!0),n){E2DEvents.prev_connector=n;var s=n.split("--"),r=this.pointFromConnector(n),a=s[0],l=s[1];E2DEvents.connectorInactive();var h=document.getElementById(a),d=this.renderer.isSmartLine(this.selected),c=this.renderer.isSmartLine(h);d&&c?this.renderer.replaceSmartLineWithSmartLineHub(this.selected,h,r,"from",!0):this.renderer.connectLine(h,this.selected,"from",l),this.clearConnectionPoints(!0)}o.updateConnector(this.selected),this.showSmartLineOrthoConnectionPoints(!1),this.handleZIndexPositioning()},E2DEditor.prototype.connectPolyline=function(e){if(e){var t=e.split("--"),i=t[0],n=t[1],o=document.getElementById(i),s=this.pointFromConnector(e),r="from"===n,a="to"===n;if("poly-line"===this.mode&&E2DEvents.polylineStarted)this.clearPolylineConnections(this.selected),r||a?(this.joinPolylines(this.selected,o,!0,r),E2DEvents.skipMouseUp=!0,E2DEvents.polylineStarted=!1):this.renderer.closePolylineSegment(this.selected,s.x,s.y,!0);else if("resize"===this.mode)if(this.clearPolylineConnections(this.selected),"polyline-from"===this.resizeMode)r||a?this.joinPolylines(this.selected,o,!1,r):this.renderer.movePolylinePoint(this.selected,0,s.x,s.y);else if("polyline-to"===this.resizeMode)r||a?this.joinPolylines(this.selected,o,!0,r):this.renderer.movePolylinePoint(this.selected,-1,s.x,s.y);else if(this.resizeMode.startsWith("polyline-")){var l=1*this.resizeMode.substring(9);this.renderer.movePolylinePoint(this.selected,l,s.x,s.y)}}this.setPropertiesVisible(null),this.renderer.hideTracker(),this.renderer.hideLineTracker(),this.restoreMode(),E2DEvents.active_connector=null,E2DEvents.prev_connector=null,E2DEvents.connector_z=null,this.selected&&this.saveUndoRedoPoint(0,"urConnectPoly")},E2DEditor.prototype.createPolyline=function(e,t,i){if(this.unselect(),E2DEvents.polylineStarted=!0,i){var n=i.split("--"),o=n[0],s=n[1],r=document.getElementById(o),a=this.pointFromConnector(i),l="to"===s;if("from"===s)return void this.reopenPolyline(r,!0,a.x,a.y);if(l)return void this.reopenPolyline(r,!1,a.x,a.y);e=a.x,t=a.y}var h=this;this.renderer.createLine(this.shapeLibraryList[0],"poly-line",e,t).done(function(i){h.createPolylineAsync(i,e,t)})},E2DEditor.prototype.createPolylineAsync=function(e,t,i){this.clearConnectionPoints(),this.select(e),this.selected.setAttribute("id","polyline_"+E2DUtils.createUUID()),this.renderer.moveLine(this.selected,t,i,!0);var n=InsertedShape.CreateShapeFromConnector(this.selected,this.shapeLibraryList[0]);this.insertedShapes.addShape(n,!(this.enable3dFloor||this.enable3dWalls)),this.addNewShapeListeners(this.selected),this.container.on("vmousemove",E2DEvents.onDraw)},E2DEditor.prototype.reopenPolyline=function(e,t,i,n){this.clearConnectionPoints(),this.clearPolylineConnections(e),this.select(e),t&&this.renderer.reversePolylinePoints(e),this.renderer.addPolylinePoint(e,-1,i,n),this.container.on("vmousemove",E2DEvents.onDraw)},E2DEditor.prototype.closePolyline=function(){if(this.clearSnap(),E2DEvents.polylineStarted&&(E2DEvents.polylineStarted=!1,this.renderer.closePolyline(this.selected),this.insertedShapes.updateConnector(this.selected),this.container.off("vmousemove",E2DEvents.onDraw),this.setPropertiesVisible(null),this.showConnectionPoints(),this.saveUndoRedoPoint(0,"urClosePoly"),this.events.polyinserted)){var e=new E2DEventArgument("OnInserted",{handler:"OnInserted.rdx"},null,this.selected.id,null,null);E2DEvents.doSubmitEvent("OnEditor2DInserted",[e],1,"urNewShapes")}},E2DEditor.prototype.finishPolyline=function(){if(this.clearSnap(),E2DEvents.polylineStarted)if(E2DEvents.polylineStarted=!1,this.renderer.getPolylineNumberOfPoints(this.selected)>2){if(this.renderer.finishPolyline(this.selected),this.insertedShapes.updateConnector(this.selected),this.container.off("vmousemove",E2DEvents.onDraw),this.setPropertiesVisible(null),this.showConnectionPoints(),this.saveUndoRedoPoint(0,"urFinishPoly"),this.events.polyinserted){var e=new E2DEventArgument("OnInserted",{handler:"OnInserted.rdx"},null,this.selected.id,null,null);E2DEvents.doSubmitEvent("OnEditor2DInserted",[e],1,"urNewShapes")}}else this.deleteItem(this.selected),this.saveUndoRedoPoint(0,"urFinishPoly")},E2DEditor.prototype.undoPolyline=function(){E2DEvents.polylineStarted&&(this.renderer.undoPolylineLastSegment(this.selected),this.insertedShapes.updateConnector(this.selected))},E2DEditor.prototype.addPolylinePoint=function(e){if(e=e||this.selected,this.renderer.isPolyline(e)){var t=this.renderer.getPolylineSelectedSegment(e);t&&2===t.length&&(this.clearPolylineConnections(e),this.renderer.addPolylineMiddlePoint(e,t[0],t[1]),this.insertedShapes.updateConnector(e))}},E2DEditor.prototype.deletePolylinePoint=function(e){if(e=e||this.selected,this.renderer.isPolyline(e)&&this.renderer.getPolylineNumberOfPoints(e)>2){var t=document.getElementById("resize-from"),i=document.getElementById("resize-to"),n=-1;t.classList.contains("lineTrackerResizeSelected")?n=1*t.getAttributeNS(null,"plPoint"):i.classList.contains("lineTrackerResizeSelected")&&(n=1*i.getAttributeNS(null,"plPoint")),-1!==n&&(this.renderer.removePolylinePoint(e,n),this.insertedShapes.updateConnector(e))}},E2DEditor.prototype.deletePolylineSegment=function(e,t,i){if(e=e||this.selected,this.renderer.isPolyline(e)){if(t="number"!=typeof t?-1:t,i="number"!=typeof i?-1:i,"number"!=typeof t||-1===t){var n=document.getElementById("resize-from");t=n.hasAttributeNS(null,"plPoint")?1*n.getAttributeNS(null,"plPoint"):-1}if("number"!=typeof i||-1===i){var o=document.getElementById("resize-to");i=o.hasAttributeNS(null,"plPoint")?1*o.getAttributeNS(null,"plPoint"):-1}if(-1===t||-1===i)return;if(this.renderer.isPolylineClosed(e))this.renderer.removePolylineSegment(e,t,i),this.insertedShapes.updateConnector(e);else{var s=this.renderer.splitPolylineBySegment(e,t,i);this.renderer.remove(e);var r,a,l,h=this.insertedShapes.removeShape(e);r=(l=s[0])[0],a=l[l.length-1];var d=InsertedShape.CloneShape(h);d.id="polyline_"+E2DUtils.createUUID(),d.path=this.convertPathToUserString(l),d.x=r.x,d.y=r.y,d.width=a.x,d.height=a.y,this.createNewConnector(d),r=(l=s[1])[0],a=l[l.length-1];var c=InsertedShape.CloneShape(h);c.id="polyline_"+E2DUtils.createUUID(),c.path=this.convertPathToUserString(l),c.x=r.x,c.y=r.y,c.width=a.x,c.height=a.y,this.createNewConnector(c)}}},E2DEditor.prototype.joinPolylines=function(e,t,i,n){this.renderer.isPolyline(e)&&this.renderer.isPolyline(t)&&(this.clearPolylineConnections(e),this.clearPolylineConnections(t),this.renderer.joinPolylines(e,t,i,n),this.insertedShapes.updateConnector(e),this.renderer.remove(t),this.insertedShapes.removeShape(t),this.container.off("vmousemove",E2DEvents.onDraw),this.clearConnectionPoints())},E2DEditor.prototype.clearPolylineConnections=function(e){if(this.renderer.isPolyline(e))for(var t=this.insertedShapes.getAttachedLines(e.id),i=0,n=t.length;i0&&(this.renderer.updateTracker(this.selected,i),this.updateShapeInfo(this.selected))}},E2DEditor.prototype.unselectPolylineSegment=function(){this.selected&&this.renderer.isPolyline(this.selected)&&(this.renderer.clearTrackerSegments(),this.renderer.updateTracker(this.selected),this.updateShapeInfo(null))},E2DEditor.prototype.startTextEdit=function(e){this.setHelp("info","Enter text and then click anywhere outside the text area");var t=this.renderer.getShapeText(e),i=this.renderer.getTextBounds(e,""),n=$("#E2DShapeText");n.val(t||""),n.css({visibility:"visible",left:i.x>3?i.x-3:0,top:i.y>3?i.y-3:0,width:i.width>=35?parseInt(i.width):35,height:i.height>=35?parseInt(i.height):35});var o=this.renderer.getFont(this.selected);o=E2DFont.mergeWithDefault(o),n.css({"font-size":o.size,color:o.color,"font-family":o.family}),this.renderer.remove(n[0]),this.container.append(n),n.focus(),this.container.off("vmousedown",E2DEvents.onMouseDown),this.container.off("vmouseup",E2DEvents.onMouseUp),this.container.off("selectstart",E2DEvents.onSelectStart),this.container.off("keyup",E2DEvents.onKeyUp),this.container.off("vmousemove",E2DEvents.onDrag),this.container.on("vmousedown",E2DEvents.onTextEditEnd),this.textEditMode=!0},E2DEditor.prototype.finishTextEdit=function(){this.setHelp("info","Finished editing text");var e=$("#E2DShapeText"),t=e.val();t&&0!==t.length||(t=" "),this.clearShapeText(),this.renderer.setShapeText(this.selected,t);var i=this.insertedShapes.getShapeById(this.selected.id);i&&i.update(null,null,null,null,null,null,null,t),this.renderer.isConnector(this.selected)||this.resetTextForAttachedConnectors(this.selected),e.css("visibility","hidden"),this.container.on("vmousedown",E2DEvents.onMouseDown),this.container.on("vmouseup",E2DEvents.onMouseUp),this.container.on("selectstart",E2DEvents.onSelectStart),this.container.on("keyup",E2DEvents.onKeyUp),this.container.off("vmousedown",E2DEvents.onTextEditEnd),this.textEditMode=!1},E2DEditor.prototype.clearShapeText=function(e){if(e||this.selected)for(var t=null,i=0,n=(t=e?[e]:this.getSelectedShapes()).length;i"},E2DEditor.prototype.connectionPointPolylineTemplate=function(e,t,i){return"
"},E2DEditor.prototype.connectionPointSmartlineTemplate=function(e,t,i,n){return"
"},E2DEditor.prototype.pointFromConnector=function(e){if(!e)return null;var t=$("#"+e);return{x:1*t.attr("oX"),y:1*t.attr("oY"),z:1*t.attr("oZ")}},E2DEditor.prototype.clearConnectionPoints=function(e){var t="link-line"===this.mode,i=this.renderer.isLinkLine(this.selected);if(e&&(t||i)){var n="",o=this.insertedShapes.getConnectionShape(this.selected.id,"from");o.shapeID&&(n=this.getLinkClass(o.shapeID,o.pointID));var s=this.insertedShapes.getConnectionShape(this.selected.id,"to");s.shapeID&&(n=this.getLinkClass(s.shapeID,s.pointID));var r=this.getLinkClassTarget(n);return r&&(n=r),void $("#connectors div").not("[linkClass='']").not("[linkClass=null]").not("[linkClass=undefined]").each(function(){var e=$(this),t=e.attr("id").split("--"),i=E2DGlobals.e2d.getLinkClass(t[0],t[1]);E2DUtils.isInSameClass(i,n)||(delete E2DGlobals.e2d.shapesWithConnectionPoints[t[0]],e.remove())})}$("#connectors").empty(),this.shapesWithConnectionPoints=[],E2DEvents.active_connector=null},E2DEditor.prototype.showConnectionPoints=function(){this.selected&&(this.renderer.isMultipleSelect(this.selected)||(this.renderer.isPolyline(this.selected)?("quote-line"===this.mode||"poly-line"===this.mode||"resize"===this.mode&&this.resizeMode.startsWith("polyline-"))&&this.addConnectionPointsForPolyline(this.selected):this.addConnectionPointsForShape(this.selected)))},E2DEditor.prototype.addConnectionPointsForShape=function(e,t,i,n){if(e&&!this.renderer.isConnector(e)&&!this.shapesWithConnectionPoints[e.id]){i=i||E2DEvents.active_connector,n=n||E2DEvents.prev_connector;var o="quote-line"===this.mode||this.renderer.isQuoteLine(this.selected),s="link-line"===this.mode,r=this.renderer.isLinkLine(this.selected),a=this.insertedShapes.getShapeById(e.id);if(a&&!(a.hasBehaviour("(BACKGROUND)")||(s||r)&&a.hasBehaviour("(NOLINKS)"))){var l="";if(r&&t){var h=this.insertedShapes.getConnectionShape(this.selected.id,"from");h.shapeID&&(l=this.getLinkClass(h.shapeID,h.pointID));var d=this.insertedShapes.getConnectionShape(this.selected.id,"to");d.shapeID&&(l=this.getLinkClass(d.shapeID,d.pointID))}var c=this.getLinkClassTarget(l);c&&(l=c);for(var u="",p=this.renderer.getConnectionPointObjs(e,o),g=0,y=p.length;g0)for(var c=0,u=d.length;c0?E2DUtils.round(D.controlX/this.scale-O,4):-1,b.ctrl1y=D.controlY>0?E2DUtils.round(D.controlY/this.scale-w,4):-1,b.ctrl2x=D.controlX2>0?E2DUtils.round(D.controlX2/this.scale-O,4):-1,b.ctrl2y=D.controlY2>0?E2DUtils.round(D.controlY2/this.scale-w,4):-1,b.shapeFromId=o.shapeFromId,b.shapeFromPointIndex=o.shapeFromPointIndex,b.shapeToId=o.shapeToId,b.shapeToPointIndex=o.shapeToPointIndex,b.path="";for(var B=0,_=D.points.length;B<_;B++){var z=D.points[B],V=E2DUtils.round(z.x/this.scale-O,4),F=E2DUtils.round(z.y/this.scale-w,4);b.path+=V+","+F+" "}b.path=b.path.trim(),E.group2d.connectors[E.group2d.connectors.length]=b}var H=new InsertedShape;H.id="shape_"+E2DUtils.createUUID(),H.source=E.id,H.x=x,H.y=I,H.z=C,H.width=T,H.height=P,H.depth=L,H.needRefresh=!0,this.insertedShapes.addShape(H,!0),this.unselect(),this.deleteItems(f,!0,!0),this.deleteItems(r,!0,!0),this.groupProp=E,this.needRefresh=!0,E2DEvents.doSubmitEvent("OnEditor2DRegrouped",null,1,"urRegroupShapes")}},E2DEditor.prototype.regroup=function(e){if(!$("#toolGroup").hasClass("toolItemDisabled")){for(var t,i,n=[],o=[],s=new SelectedShapes(this.renderer),r=this.insertedShapes.getShapes(!1),a=0,l=r.length;a0?E2DUtils.round(c.controlX-v,4):-1,u.ctrl1y=c.controlY>0?E2DUtils.round(c.controlY-m,4):-1,u.ctrl2x=c.controlX2>0?E2DUtils.round(c.controlX2-v,4):-1,u.ctrl2y=c.controlY2>0?E2DUtils.round(c.controlY2-m,4):-1,u.shapeFromId=i.shapeFromId,u.shapeFromPointIndex=i.shapeFromPointIndex,u.shapeToId=i.shapeToId,u.shapeToPointIndex=i.shapeToPointIndex,u.path="";for(var I=0,C=c.points.length;I0)for(var n=0,o=i.length;n0)for(var o=0,s=e.length;o("+this.unit+")");var i=this.getGridSize();if(1!==i)switch(this.unit){case"in":this.GRID_SIZE_MM=i,this.setGridSize(this.GRID_SIZE_IN);break;case"mm":this.GRID_SIZE_IN=i,this.setGridSize(this.GRID_SIZE_MM)}if(this.updateGrid(),t!==this.unit){var n=0,o=$("#_pageWidth").val(),s=$("#_pageHeight").val();"LANDSCAPE"===this.orientation?o=2&&(this.scale=e.split(":")[0]/e.split(":")[1])):$("#_pageScaleFactor").val("1:1")},E2DEditor.prototype.setOrigin=function(e){var t={data:this.origin,dfd:69};if(!e)return t;var i=e.replace(/\s/g,"").split(",");if(i.length<2||i.length>5)return t;var n=i[0],o=i[1],s=i[2],r=i[3],a=!1,l="";if(i[4]&&i[4].toLowerCase){var h=i[4].toLowerCase();-1!==h.indexOf("c")&&(l="c",h=h.replace("c","")),-1!==h.indexOf("tl")&&(l="tl",h=h.replace("tl","")),-1!==h.indexOf("tr")&&(l="tr",h=h.replace("tr","")),-1!==h.indexOf("bl")&&(l="bl",h=h.replace("bl","")),-1!==h.indexOf("br")&&(l="br",h=h.replace("br","")),a=-1!==h.indexOf("b")}var d=this.convertGraphDataToUserData(48),c="";s?("+"===s?(s=1,c+="+"):(s=-1,c+="-"),d=this.convertGraphDataToUserData(96)):s=1,r?("+"===r?(r=1,c+="+"):(r=-1,c+="-"),d=this.convertGraphDataToUserData(96)):r=1;var u=d,p=d,g=InsertedShape.CreateShape(this.shapeLibraryList[0],"origin",this.ORIGIN_ID,"","","",n,o,0,d,u,p,0,null,"(ORIGIN=CENTER)",{Orientation:c});return t.data={x:n,y:o,z:0,w:d,h:u,d:p,signX:s,signY:r,signZ:1,position:l,background:a},t.dfd=this.createNewShape(g),t},E2DEditor.prototype.getCurrentOrigin=function(){return this.customOrigin?this.customOrigin:this.origin},E2DEditor.prototype.toggleCustomOrigin=function(){if(this.customOrigin){var e=document.getElementById(this.CUSTOM_ORIGIN_ID);this.unselect(),this.deleteItem(e),this.customOrigin=null}else{var t=this.convertGraphDataToUserData(72),i=t,n=t,o="";this.customOrigin={x:0,y:0,z:0,signX:this.origin.signX,signY:this.origin.signY,signZ:this.origin.signZ},1===this.customOrigin.signX?o+="+":o+="-",1===this.customOrigin.signY?o+="+":o+="-";var s=InsertedShape.CreateShape(this.shapeLibraryList[0],"originCustom",this.CUSTOM_ORIGIN_ID,"O","","",this.customOrigin.x,this.customOrigin.y,this.customOrigin.z,t,i,n,0,null,"",{Orientation:o});this.createNewShape(s)}},E2DEditor.prototype.updateCustomOrigin=function(e){if(e.id===this.CUSTOM_ORIGIN_ID&&(this.customOrigin.x=E2DGlobals.e2d.shapeProps.x.val(),this.customOrigin.y=E2DGlobals.e2d.shapeProps.y.val(),this.customOrigin.z=E2DGlobals.e2d.shapeProps.z.val(),e.custom&&e.custom.Orientation))switch(e.custom.Orientation){case"++":this.customOrigin.signX=1,this.customOrigin.signY=1;break;case"+-":this.customOrigin.signX=1,this.customOrigin.signY=-1;break;case"-+":this.customOrigin.signX=-1,this.customOrigin.signY=1;break;case"--":this.customOrigin.signX=-1,this.customOrigin.signY=-1}},E2DEditor.prototype.toggleHighlightEqualShapes=function(e){e?this.highlightEqualShapes&&(this.highlightEqualShapes=!1,this.updateOnTheFlyStyleForHighlightEqualShapes(this.highlightEqualShapes)):(this.highlightEqualShapes=!this.highlightEqualShapes,this.updateOnTheFlyStyleForHighlightEqualShapes(this.highlightEqualShapes))},E2DEditor.prototype.updateOnTheFlyStyleForHighlightEqualShape=function(e){if(this.highlightEqualShapes&&e&&!e.isConnector()){var t=$("#onTheFly"),i=!1,n=t.text();this.hexToShapeHash||(this.hexToShapeHash=[]);var o=this.shapeToHexHash[e.id],s=E2DUtils.toHexColour(e.getSignature()),r="rgb"+s;if(o!==r){this.hexToShapeHash[s]||(i=!0,n+="\n."+r+" path{fill: #"+s+";}",this.hexToShapeHash[s]=!0),this.shapeToHexHash[e.id]=r;var a=document.getElementById(e.id);a.classList.remove(o),a.classList.add(r)}i&&t.text(n)}},E2DEditor.prototype.updateOnTheFlyStyleForHighlightEqualShapes=function(e){var t=$("#onTheFly"),i=!1,n=t.text();if(this.hexToShapeHash||(this.hexToShapeHash=[]),e){var o=this.insertedShapes.getShapes(!1,!0);if(!o||0===o.length)return;this.shapeToHexHash||(this.shapeToHexHash=[]);for(var s=0,r=o.length;s0){for(var t=$("#onTheFly"),i="",n=0,o=e.length;n0&&this.updateOnTheFlyStyleForTree(s.items)}var r=t.text()+i;t.text(r)}},E2DEditor.prototype.addConnectionPoint=function(){var e=this.convertGraphDataToUserData(16),t=e,i=e,n=InsertedShape.CreateShape(this.shapeLibraryList[0],this.CONNECTION_POINT_CLASS,"cp_"+E2DUtils.createUUID(),"Connection Point","","",0,0,0,e,t,i,0,null,"",{Direction:"NONE"});this.createNewShape(n)},E2DEditor.prototype.setOrientation=function(e){if(e&&(e=e.toUpperCase(),$("#_pageLandscape").prop("checked","LANDSCAPE"===e),e!==this.orientation)){this.orientation=e;var t=$("#_pageWidth"),i=$("#_pageHeight"),n=t.val();t.val(i.val()),i.val(n),this.updatePageSize()}},E2DEditor.prototype.setPageSizeEx=function(e){if(e){$("#_pageSize").val(e);var t=e.indexOf("(")+1,i=e.indexOf(")"),n=e.substring(t,i);this.updatePageSize(n)}},E2DEditor.prototype.updatePageSize=function(e){var t=0,i=0;if(e){var n=0;t=1*e.split("x")[0],i=1*e.split("x")[1],"LANDSCAPE"===this.orientation?t43||i>43))return void this.setHelp("warning","Size too large, please use a smaller size");if("mm"===this.unit&&(t>1001||i>1001))return void this.setHelp("warning","Size too large, please use a smaller size")}this.setPageSize(t+this.unit,i+this.unit)},E2DEditor.prototype.setPageSize=function(e,t){this.width=e,this.height=t,this.renderer.setSVGPageSize(e,t),this.updateShapeInfo(null)},E2DEditor.prototype.getPageSize=function(){return{width:this.width,height:this.height}},E2DEditor.prototype.checkScroll=function(e,t,i){var n=E2DGlobals.e2dLayout,o=n.state.center.innerWidth,s=n.state.center.innerHeight,r=n.state.center.offsetTop,a=n.state.center.offsetLeft;E2DEvents.autoScrollIntervalDirection=null,E2DEvents.autoScrollIntervalObject=null,e<=a+90?E2DEvents.autoScrollIntervalDirection="LEFT":a+o-90<=e&&(E2DEvents.autoScrollIntervalDirection="RIGHT"),t<=r+90?E2DEvents.autoScrollIntervalDirection="UP":r+s-90<=t&&(E2DEvents.autoScrollIntervalDirection="DOWN"),!E2DEvents.autoScrollIntervalID&&E2DEvents.autoScrollIntervalDirection&&(E2DEvents.autoScrollIntervalID=setInterval(i,500))},E2DEditor.prototype.setScrollObj=function(e){e&&this.setScroll(e.x,e.y)},E2DEditor.prototype.setScroll=function(e,t){var i=this.container.parent();null!==e&&void 0!==e&&i.scrollLeft(e),null!==t&&void 0!==t&&i.scrollTop(t)},E2DEditor.prototype.getScroll=function(){var e=this.container.parent();return{x:e.scrollLeft(),y:e.scrollTop()}},E2DEditor.prototype.setToggles=function(e){e&&(this.show3dWalls=e.show3dWalls,this.show3dShadows=e.show3dShadows,this.showGrid=e.showGrid,this.enableGrid(this.showGrid))},E2DEditor.prototype.getToggles=function(){var e={};return e.showGrid=this.showGrid,e.show3dWalls=this.show3dWalls,e.show3dShadows=this.show3dShadows,e},E2DEditor.prototype.setSplitters=function(e){if(e){e.westClosed?E2DGlobals.e2dLayout.close("west"):e.westSize&&(E2DGlobals.e2dLayout.open("west"),E2DGlobals.e2dLayout.sizePane("west",e.westSize)),e.eastClosed?E2DGlobals.e2dLayout.close("east"):e.eastSize&&(E2DGlobals.e2dLayout.open("east"),E2DGlobals.e2dLayout.sizePane("east",e.eastSize));var t=E2DGlobals.e2dLayout.panes.west.layout();e.westSouthClosed?t.close("south"):e.westSouthSize&&(t.open("south"),t.sizePane("south",e.westSouthSize))}},E2DEditor.prototype.getSplitters=function(){var e=E2DGlobals.e2dLayout.panes.west.layout();return{westClosed:E2DGlobals.e2dLayout.state.west.isClosed,westSize:E2DGlobals.e2dLayout.state.west.size,eastClosed:E2DGlobals.e2dLayout.state.east.isClosed,eastSize:E2DGlobals.e2dLayout.state.east.size,westSouthClosed:e.state.south.isClosed,westSouthSize:e.state.south.size}},E2DEditor.prototype.fitZoom=function(){this.setMode("select");var e=this.renderer.getGlobalBoundingBox();this.applyFitZoom(e)},E2DEditor.prototype.pageZoom=function(){this.setMode("select");var e=this.renderer.getSVGPageSize(),t={x:0,y:0,x2:e.width,y2:e.height,width:e.width,height:e.height};this.applyFitZoom(t)},E2DEditor.prototype.applyFitZoom=function(e){if(e){var t=this.container.parent(),i=.9*t.width(),n=.9*t.height(),o=E2DUtils.round(i/e.width,5),s=E2DUtils.round(n/e.height,5),r=(e.width,e.height*o<=n?o:s);r=E2DUtils.round(r,1),E2DUtils.isAlmostZero(r)&&(r=.1),1!==r&&(this.setZoom(r),e.x=e.x-16>=0?e.x-16:e.x,e.y=e.y-16>=0?e.y-16:e.y,this.setScroll(e.x*r,e.y*r))}},E2DEditor.prototype.setZoom=function(e){if(e&&!(E2DUtils.isAlmostZero(e)||e<=0||e===this.zoom))return this.zoom=e,this.renderer.setSVGRootZoom(this.zoom),this.renderer.updateTracker(this.selected),$("#btnZoomText").text(Math.round(100*this.zoom)+"%"),this.clearConnectionPoints(),this.clearPolylineQuotes(),this.setMode(this.mode),0!==E2DEvents.mouseDown.x&&0!==E2DEvents.mouseDown.y?this.centerPoint(E2DEvents.mouseDown.x*this.zoom,E2DEvents.mouseDown.y*this.zoom):this.centerOrigin(),!0},E2DEditor.prototype.getZoom=function(){return this.zoom},E2DEditor.prototype.centerOrigin=function(){if(this.origin&&this.origin.position){var e=this.convertUserDataToGraphData(this.origin.x),t=this.convertUserDataToGraphData(this.origin.y),i=(this.convertUserDataToGraphData(this.origin.w),this.convertUserDataToGraphData(this.origin.h)),n=this.container.parent(),o=n.width()/2,s=n.height()/2;switch(this.origin.position){case"tl":e+=o,t+=s;break;case"tr":e-=o,t+=s;break;case"bl":e+=o,t-=s-i/2;break;case"br":e-=o,t-=s-i/2}this.centerPoint(e*this.zoom,t*this.zoom)}},E2DEditor.prototype.centerPoint=function(e,t){var i=this.container.parent(),n=i.width(),o=i.height();this.setScroll(e-n/2,t-o/2)},E2DEditor.prototype.updateGrid=function(){var e=$("#_pageGrid").prop("checked")?this.unit:null;this.renderer.setSVGPageGrid(e),this.renderer3d&&this.renderer3d.displayGrid(this.showGrid)},E2DEditor.prototype.getContainedShapeList=function(e,t){const i=this.renderer.getAllShapes(this.container[0]),n=this.renderer.getAllConnectors(this.container[0]),o=[],s=[],r=[];for(let n=0,r=i.length;n0)for(let e=0,i=t.length;e0){var v=c;r[a[l].id]&&(v=this.renderer.bounds(a[l]));var m=1*v.rotation+Math.round(t.rotation),S=this.renderer.getProportionalBoundsRotation(v,t,t.rotation);p=S.x-v.x,g=S.y-v.y,f=m-v.rotation,this.renderer.rotate(a[l],m),this.renderer.move(a[l],S.x,S.y,null)}else{var E=null;if(r[a[l].id]&&(E=this.renderer.getPosition(a[l])),this.renderer.move(a[l],c.x+i,c.y+n,c.z+o),r[a[l].id]){var D=this.renderer.getPosition(a[l]);p=D.x-E.x,g=D.y-E.y}}this.clearShapeText(a[l]),this.resetShapeText(a[l]),this.moveShapeDependencies(a[l],p,g,y,f);var b=this.insertedShapes.getAttachedShapesDeep(a[l].id,["link-line"]);if(b&&b.length)for(var x=0,I=b.length;x0){var y=!1;(s=this.insertedShapes.getShapeById(e))&&(y=s.hasBehaviour("(SNAPPED)"),s.clearPolylineBehaviour(!1,!0));var f,v,m=99999,S={id:"",snappoints:"",snappointsEX:""},E=E2DUtils.round(this.snapToThreshold,10);if(y&&(E*=2),this.snapToShapeCenter)for(var D=this.renderer.getCenterPointFromRect(t,i,n),b=0,x=r.length;b90&&($-=180),Q>=0&&q>=0&&($*=-1),o.x=t.x+i+f,o.y=t.y+n+v,E2DUtils.isAlmostZero($)?o.rotation=null:o.rotation=t.rotation+$,o.dx=f,o.dy=v,o.snapped=!0,o.a=k,o.b=N,S.id=r[L].id,S.snappoints=R+"-"+A}}m0){var c=!1;(s=this.insertedShapes.getShapeById(e))&&(c=s.hasBehaviour("(SNAPPED)"),s.clearPolylineBehaviour(!0));var u,p,g,y,f,v,m,S=99999,E={id:"",xa:0,ya:0,xb:0,yb:0,snapPoints:""},D=E2DUtils.round(this.snapToThreshold,10);if(c&&(D*=2),this.snapToShapeCenter)for(var b=this.renderer.getCenterPointFromRect(t,i,n),x=0,I=r.length;xMath.max(y.x,f.x)&&(y.x>f.x?(b.px=y.x,b.py=y.y):(b.px=f.x,b.py=f.y)),b.D=E2DUtils.getSegmentLength(b.px,b.py,b.x,b.y),b.DMath.max(y.x,f.x)&&(y.x>f.x?(P[M].px=y.x,P[M].py=y.y):(P[M].px=f.x,P[M].py=f.y)),P[M].D=E2DUtils.getSegmentLength(P[M].px,P[M].py,P[M].x,P[M].y),P[M].D90&&(A-=180),F>=0&&H>=0&&(A*=-1),o.x=t.x+i+p,o.y=t.y+n+g,E2DUtils.isAlmostZero(A)?o.rotation=null:o.rotation=t.rotation+A,o.dx=p,o.dy=g,o.snapped=!0,o.a=y,o.b=f,E.id=u.id,E.xa=E2DUtils.round(this.convertGraphXToUserX(y.x),this.numberOfDecimal),E.ya=E2DUtils.round(this.convertGraphYToUserY(y.y),this.numberOfDecimal),E.xb=E2DUtils.round(this.convertGraphXToUserX(f.x),this.numberOfDecimal),E.yb=E2DUtils.round(this.convertGraphYToUserY(f.y),this.numberOfDecimal)}}}S0)for(var f=0,v=d.group2d.shapes.length;f0){var D={x:1*c.x+m.x*p*this.scale,y:1*c.y+m.y*g*this.scale,z:1*c.z+m.z*y*this.scale,width:m.width*p*this.scale,height:m.height*g*this.scale,depth:m.depth*y*this.scale,rotation:1*c.rotation+1*m.rotation},b=this.renderer.getProportionalBoundsRotation(D,c,c.rotation);D.x=b.x,D.y=b.y;for(var x=0,I=E.connectionPoints.length;x0){var P=!1,L=this.insertedShapes.getShapeById(e);L&&(P=L.hasBehaviour("(SNAPPED)"),L.removeBehaviour("(SNAPPED)"));var O=99999,w=E2DUtils.round(this.snapToThreshold,10);P&&(w*=2);for(var G=this.renderer.getCenterPointFromRect(t,i,n),M=0,R=s.length;M0){return n.z-(t.z-e.z)}return 0},E2DEditor.prototype.getNewCoordsForPolylinePoint=function(e,t,i,n,o){this.clearSnap();var s={x:i,y:n};if(o||1===this.GRID_ROTATE)return s;var r=0,a=0,l=null;0===t?(l=this.renderer.getPolylinePoint(e,1),r=E2DUtils.getSegmentLength(i,n,l.x,l.y),a=(E2DUtils.getSegmentRotation(i,n,l.x,l.y)+180)%360):(l=this.renderer.getPolylinePoint(e,t-1),r=E2DUtils.getSegmentLength(l.x,l.y,i,n),a=E2DUtils.getSegmentRotation(l.x,l.y,i,n)),a=Math.round(a/this.GRID_ROTATE)*this.GRID_ROTATE,a=E2DUtils.deg2rad(a);var h=r*Math.cos(a),d=r*Math.sin(a);return s.x=l.x+h,s.y=l.y+d,s=this.polylineSnapToPoint(e.id,t,s,l)},E2DEditor.prototype.polylineSnapToPoint=function(e,t,i,n){if(e===this.renderer.MULTIPLE_SELECTOR_TRACKER_ID)return i;if(e===this.ORIGIN_ID||e===this.CUSTOM_ORIGIN_ID)return i;var o=this.insertedShapes.getShapeById(e);if(o&&(o.hasBehaviour("(NOTE)")||o.hasBehaviour("(BACKGROUND)")))return i;o={id:"",points:null,pointsNum:0};for(var s=this.renderer.getAllPolylines(this.container[0]),r=0,a=s.length;r0){for(var h=o.points,d=h[0].x,c=h[0].y,u=0,p=0,g=0;g=0){var h=this.renderer.bounds(n),d=1*l.direction,c=1*a.direction-d-180;r=h.rotation,r-=c,r%=360}return r},E2DEditor.prototype.performIncludeConnectionPoints=function(){if(this.includeConnectionPoints)for(var e=this.renderer.getAllShapes(this.container[0]),t=0,i=e.length;t0){this.dragCache.testCollisionCount=0;for(var l=[e],h=this.renderer.bounds(e),d=0,c=t.length;d1&&this.createCollidingGhosts(l)}}},E2DEditor.prototype.performCheckInclusions=function(e){if(e){this.dragCache||(this.dragCache={});var t=this.dragCache.shapesToContain;if(!t){if(this.dragCache.shapesToContain=[],!this.checkInclusions)return;if(this.renderer.isConnector(e))return;if(e.id===this.renderer.MULTIPLE_SELECTOR_TRACKER_ID||e.id===this.ORIGIN_ID||e.id===this.CUSTOM_ORIGIN_ID||e.id===this.renderer.BACKGROUND_ID)return;var i=this.insertedShapes.getShapeById(e.id);if(!i||i.source===this.CONNECTION_POINT_CLASS||i.hasBehaviour("(NOTE)")||i.hasBehaviour("(CONTAINER)")||i.hasBehaviour("(NOINCLUSIONS)"))return;t=[];for(var n=this.renderer.getAllShapes(this.container[0]),o=0,s=n.length;o0&&(f=E2DUtils.round(this.convertGraphDataToUserData(f),this.numberOfDecimal).toString(),this.quoteUOMEnabled&&(f+=" "+this.unit),(r=E2DUtils.midpointOfLine(g.x,g.y,l.x,l.y)).x-=50,(a=l.y-i.a.y)<0?r.y-=20:a>0&&(r.y+=10),r.x*=this.zoom,r.y*=this.zoom,this.renderer.showPolyQuote("A",[g,l,i.a],f,r.x,r.y)),v&&(v=E2DUtils.round(this.convertGraphDataToUserData(v),this.numberOfDecimal).toString(),this.quoteUOMEnabled&&(v+=" "+this.unit),(r=E2DUtils.midpointOfLine(y.x,y.y,h.x,h.y)).x-=50,(a=h.y-i.b.y)<0?r.y-=20:a>0&&(r.y+=10),r.x*=this.zoom,r.y*=this.zoom,this.renderer.showPolyQuote("B",[y,h,i.b],v,r.x,r.y))}}}},E2DEditor.prototype.performCheckOverlappings=function(e){if(e&&!this.renderer.isConnector(e)&&!this.renderer.isMultipleSelect(e)&&e.id!==this.renderer.MULTIPLE_SELECTOR_TRACKER_ID&&e.id!==this.ORIGIN_ID&&e.id!==this.CUSTOM_ORIGIN_ID&&e.id!==this.renderer.BACKGROUND_ID){var t=this.insertedShapes.getShapeById(e.id);if(t&&!t.hasBehaviour("(NOTE)")&&(this.checkBackgroundCollisions||!t.hasBehaviour("(BACKGROUND)"))){for(var i=[e],n=this.renderer.bounds(e),o=this.renderer.getAllShapes(this.container[0]),s=0,r=o.length;s1&&this.createOverlappingGhosts(i)}}},E2DEditor.prototype.getOverlappingConnectionPoints=function(e){if(!e)return[];var t=e.split("--");if(2!==t.length)return[];var i=t[0],n=t[1],o=document.getElementById(i),s=this.renderer.getConnectionPointObjByPointId(o,n);if(!s)return[];for(var r="quote-line"===this.mode,a=this.renderer.getOverlappingConnectionPointObjs(i,n,r,15,this.quickPickIgnoreThreshold),l=this.renderer.bounds(o),h=this.renderer.getAllShapes(this.container[0]),d=0,c=h.length;d=0,p=u&&(this.resizeMode.indexOf("left")>=0||this.resizeMode.indexOf("right")>=0),g=u&&(this.resizeMode.indexOf("top")>=0||this.resizeMode.indexOf("bottom")>=0),y="depth-stretch"===this.resizeMode,f="z-stretch"===this.resizeMode;if(c){if(this.selectedBehaviour.move.noRotate)return void this.setHelp("warning","Selected shape cannot be rotated.");if(this.selectedBehaviour.move.noRotateOnView)return void this.setHelp("warning","Selected shape can be rotated only from the property pane.")}if(u&&!f){if(this.selectedBehaviour.stretch.noStretch)return void this.setHelp("warning","Selected shape cannot be stretched.");if(this.selectedBehaviour.stretch.noStretchOnView)return void this.setHelp("warning","Selected shape can be stretched only from the property pane.")}if(p&&this.selectedBehaviour.stretch.noWStretch)return void this.setHelp("warning","Selected shape cannot be stretched horizontally.");if(g&&this.selectedBehaviour.stretch.noHStretch)return void this.setHelp("warning","Selected shape cannot be stretched vertically.");if(y&&this.selectedBehaviour.stretch.noDStretch)return void this.setHelp("warning","Selected shape cannot be stretched on the z axis.");if(f&&this.selectedBehaviour.move.noZMove)return void this.setHelp("warning","Selected shape cannot be moved on the z axis.");let v=null;c||y||(v=this.getShapeDependenciesBeforeResize(this.selected));const m=this.renderer.bounds(this.selected),S=E2DUtils.round(m.width/m.height,1);if("right-stretch"!==this.resizeMode&&"top-right-stretch"!==this.resizeMode&&"bottom-right-stretch"!==this.resizeMode||(this.renderer.resizeWidth(this.selected,o,s,i.x,i.y,r,!0),E2DEvents.autoScrollIntervalObject=this.selected),"left-stretch"!==this.resizeMode&&"bottom-left-stretch"!==this.resizeMode&&"top-left-stretch"!==this.resizeMode||(this.renderer.resizeWidth(this.selected,o,s,i.x,i.y,r,!1),E2DEvents.autoScrollIntervalObject=this.selected),"bottom-stretch"!==this.resizeMode&&"bottom-left-stretch"!==this.resizeMode&&"bottom-right-stretch"!==this.resizeMode||(this.renderer.resizeHeight(this.selected,o,s,i.x,i.y,a,!0),E2DEvents.autoScrollIntervalObject=this.selected),"top-stretch"!==this.resizeMode&&"top-left-stretch"!==this.resizeMode&&"top-right-stretch"!==this.resizeMode||(this.renderer.resizeHeight(this.selected,o,s,i.x,i.y,a,!1),E2DEvents.autoScrollIntervalObject=this.selected),y&&this.renderer.resizeDepth(this.selected,o,s,i.x,i.y,l),f&&this.renderer.resizeZ(this.selected,o,s,i.x,i.y,h),c){var E=(this.processRotate(this.selected,t.x,t.y,i.x,i.y,e)-m.rotation)%360;this.moveShapeDependencies(this.selected,null,null,null,E)}if(d){var D=d.decodeBehaviour("(SNAPPOINTS=");if(D.found){var b=!1;switch(D.value){case"TL_TR":b="rotate"===this.resizeMode||"top-stretch"===this.resizeMode||"top-left-stretch"===this.resizeMode||"top-right-stretch"===this.resizeMode;break;case"TR_BR":b="rotate"===this.resizeMode||"top-right-stretch"===this.resizeMode||"right-stretch"===this.resizeMode||"bottom-right-stretch"===this.resizeMode;break;case"BR_BL":b="rotate"===this.resizeMode||"bottom-stretch"===this.resizeMode||"bottom-left-stretch"===this.resizeMode||"bottom-right-stretch"===this.resizeMode;break;case"BL_TL":b="rotate"===this.resizeMode||"top-left-stretch"===this.resizeMode||"left-stretch"===this.resizeMode||"bottom-left-stretch"===this.resizeMode}b&&d.clearPolylineBehaviour()}if(d.hasBehaviour("(KEEPASPECTRATIO)")){switch(this.resizeMode){case"right-stretch":case"left-stretch":this.renderer.adjustAspectRatioAfterHorizontalStretch(m,this.selected,S,this.resizeMode);break;case"top-stretch":case"bottom-stretch":this.renderer.adjustAspectRatioAfterVerticalStretch(m,this.selected,S,this.resizeMode);break;case"top-right-stretch":case"bottom-right-stretch":case"top-left-stretch":case"bottom-left-stretch":this.renderer.adjustAspectRatioAfterDiagonalStretch(m,this.selected,S,this.resizeMode)}this.renderer.updateRotation(this.selected)}}v&&v.cpIDs&&v.cpIDs.length>0&&(v=this.updateShapeDependenciesAfterResize(this.selected,v)),this.performCheckInclusions(this.selected),this.performCheckCollisions(this.selected),this.performCheckPolylineQuotes(this.selected),c||y||this.moveShapeDependenciesAfterResize(this.selected,v),this.renderer.updateTracker(this.selected),this.updateShapeInfo(this.selected)},E2DEditor.prototype.resizeMultipleShapes=function(e,t,i){if(this.selected&&this.renderer.isMultipleSelect(this.selected)){if("z-stretch"===this.resizeMode){var n=e?1:this.getGridSize(),o=this.applyGridSize(t.x,n),s=this.applyGridSize(t.y,n);this.renderer.resizeZ(this.selected,o,s,i.x,i.y,this.prevRect.z),this.renderer.resizeZ(this.renderer.getMultipleSelectorDummyShape(),o,s,i.x,i.y,this.prevRect.z)}if("rotate"===this.resizeMode&&(this.processRotate(this.selected,t.x,t.y,i.x,i.y,e),this.processRotate(this.renderer.getMultipleSelectorDummyShape(),t.x,t.y,i.x,i.y,e)),this.renderer.updateTracker(this.selected),this.updateShapeInfo(this.selected),this.enable3d&&this.renderer3d){var r=this.renderer.bounds(this.selected),a=this.convertGraphXToUserX(r.x),l=this.convertGraphYToUserY(r.y),h=this.convertGraphZToUserZ(r.z);this.renderer3d.updateMultipleSelector(a,l,h,r.rotation)}}},E2DEditor.prototype.resizeNewConnector=function(e,t){if(this.selected&&this.renderer.isConnector(this.selected)){this.renderer.hideLineTracker();var i=this.renderer.bounds(this.selected);if(this.renderer.isPolyline(this.selected)){var n=this.renderer.getPolylineNumberOfPoints(this.selected)-1;t=this.getNewCoordsForPolylinePoint(this.selected,n,t.x,t.y,e)}this.renderer.resize(this.selected,i.x,i.y,t.x,t.y),i=this.renderer.bounds(this.selected),this.updateShapeInfo(this.selected,i)}},E2DEditor.prototype.resizeConnector=function(e,t){if(this.selected&&this.renderer.isConnector(this.selected)){if(this.clearPolylineConnections(this.selected),this.renderer.isQuoteLine(this.selected)){var i=this.insertedShapes.getShapeById(this.selected.id);if(i&&i.dimDriving)return}switch(this.renderer.hideLineTracker(),this.resizeMode){case"line-from":this.renderer.disconnectLineFromShape(this.selected,"from"),this.renderer.moveLine(this.selected,e.x,e.y,!0),E2DEvents.autoScrollIntervalObject=this.selected;break;case"line-to":this.renderer.disconnectLineFromShape(this.selected,"to"),this.renderer.moveLine(this.selected,e.x,e.y,!1),E2DEvents.autoScrollIntervalObject=this.selected;break;case"polyline-from":case"polyline-0":e=this.getNewCoordsForPolylinePoint(this.selected,0,e.x,e.y,t),this.renderer.moveLine(this.selected,e.x,e.y,!0);break;case"polyline-to":var n=this.renderer.getPolylineNumberOfPoints(this.selected)-1;e=this.getNewCoordsForPolylinePoint(this.selected,n,e.x,e.y,t),this.renderer.moveLine(this.selected,e.x,e.y,!1);break;case"control1":this.renderer.setControl1(this.selected,e.x,e.y);break;case"control2":this.renderer.setControl2(this.selected,e.x,e.y);break;default:if(this.resizeMode.startsWith("polyline-")){var o=1*this.resizeMode.substring(9);e=this.getNewCoordsForPolylinePoint(this.selected,o,e.x,e.y,t),this.renderer.movePolylinePoint(this.selected,o,e.x,e.y)}}this.updateShapeInfo(this.selected)}},E2DEditor.prototype.performCheckings=function(){if(this.selected)return this.performCheckInclusions(this.selected),this.performCheckCollisions(this.selected),this.performCheckPolylineQuotes(this.selected),this.renderer3d&&this.renderer3d.renderSingle(),E2DEvents.dragStarted},E2DEditor.prototype.moveSmartLineHub=function(){this.selected&&this.renderer.isSmartLineHub(this.selected)&&(this.container.off("vmousemove",E2DEvents.onDrag),this.deleteItem(this.selected,!0),this.unselect(),this.renderer.updateTracker(this.selected),this.updateShapeInfo(this.selected))},E2DEditor.prototype.moveShape=function(e,t,i,n){if(this.selected){var o=this.selectedBehaviour.move.noXMove?0:t,s=this.selectedBehaviour.move.noYMove?0:i,r=this.insertedShapes.getShapeById(this.selected.id),a={x:this.selectedBounds.x+o,y:this.selectedBounds.y+s,rotation:null,snapped:!1};if(E2DUtils.every("SNAPSHAPE",1e3/E2DGlobals.dragFps)){if(this.selected.id===this.CUSTOM_ORIGIN_ID||r.source===this.CONNECTION_POINT_CLASS){var l=this.getNewCoordsForSnapToCenter(this.selected.id,this.selectedBounds,o,s);l.snapped&&(a=l)}else{if(this.snapToObject&&!e){var h=this.getNewCoordsForSnapToObject(this.selected.id,this.selectedBounds,o,s);h.snapped&&(a=h)}if(this.snapToPolyline&&!e){var d=this.getNewCoordsForSnapToPolyline(this.selected.id,this.selectedBounds,o,s);d.snapped&&(a=d)}}if(!a.snapped&&!e){var c=e?1:this.getGridSize();a.x=this.applyGridSize(a.x,c),a.y=this.applyGridSize(a.y,c)}}e||this.setHelp("info","To override snap to grid during drag, press the shift key"),0===o&&(a.x=this.selectedBounds.x),0===s&&(a.y=this.selectedBounds.y);var u=null,p=this.renderer.getPosition(this.selected),g=this.renderer.getRotation(this.selected);this.renderer.move(this.selected,a.x,a.y),a.snapped&&(E2DUtils.every("SNAPSHAPE",0),a.rotation&&(u=a.rotation-g,this.renderer.setRotation(this.selected,a.rotation),this.selectedBounds.x=a.x,this.selectedBounds.y=a.y,this.selectedBounds.rotation=a.rotation,n&&(E2DEvents.mouseDown={x:n.x,y:n.y})),a.a&&a.b&&!r.lastPoly&&this.renderer.showSnapLine(a)),this.moveShapeDependencies(this.selected,a.x-p.x,a.y-p.y,null,u),E2DGlobals.dragTimerMode||this.performCheckings(),this.renderer.updateTracker(this.selected),this.updateShapeInfo(this.selected)}},E2DEditor.prototype.moveShapeSimple=function(e,t,i,n,o){if(!e)return;this.clearShapeText(e);const s=this.renderer.getPosition(e);this.renderer.move(e,s.x+t,s.y+i,s.z+n),this.moveShapeDependencies(e,t,i,n,null,o),this.updateShapeInfo(e),this.resetShapeText(e)},E2DEditor.prototype.moveShapeDependencies=function(e,t,i,n,o,s,r){this.updateAttachedSmartLines(e),this.updateAttachedShapes(e,t,i,n,o,s),this.renderer.moveLineWithShape(e,null,s,r)},E2DEditor.prototype.getShapeDependenciesBeforeResize=function(e,t){if(!e)return null;!t&&this.dragCache||(this.dragCache={});let i=this.dragCache.shapesAfterResize;if(!i){i={cpIDs:[],cpShapeMap:[]};const t=this.insertedShapes.getAttachedLinkLines(e.id,!1,null);if(t&&t.length>0)for(let n of t){const t=this.insertedShapes.getShapeById(n),o=t.shapeFromId===e.id?t.shapeFromPointIndex:t.shapeToPointIndex,s=this.insertedShapes.getOtherConnectedShape(n,e.id);i.cpShapeMap[o]?i.cpShapeMap[o].shapes.push(s.id):(i.cpIDs.push(o),i.cpShapeMap[o]={before:null,after:null,shapes:[s.id]})}this.dragCache.shapesAfterResize=i}for(let t of i.cpIDs)i.cpShapeMap[t].before=this.renderer.getConnectionPointObjByPointId(e,t);return i},E2DEditor.prototype.updateShapeDependenciesAfterResize=function(e,t){if(!e)return null;for(let i of t.cpIDs)t.cpShapeMap[i].after=this.renderer.getConnectionPointObjByPointId(e,i);return t},E2DEditor.prototype.moveShapeDependenciesAfterResize=function(e,t){if(this.renderer.moveLineWithShape(e,null,null),t&&t.cpIDs&&t.cpIDs.length>0){const i=[e.id];for(let e of t.cpIDs){const n=t.cpShapeMap[e],o=n.after.x-n.before.x,s=n.after.y-n.before.y,r=n.after.z-n.before.z;for(let e of n.shapes)this.moveShapeSimple(document.getElementById(e),o,s,r,i)}}},E2DEditor.prototype.moveMultipleShapes=function(e,t){if(this.selected&&this.renderer.isMultipleSelect(this.selected)&&!(this.selectedBehaviour.move.noMove||this.selectedBehaviour.move.noXMove&&this.selectedBehaviour.move.noYMove)){var i=this.selectedBehaviour.move.noXMove?0:e,n=this.selectedBehaviour.move.noYMove?0:t,o=this.selectedBounds.x+i,s=this.selectedBounds.y+n,r=this.selectedBounds.z;this.renderer.move(this.selected,o,s,r),this.renderer.move(this.renderer.getMultipleSelectorDummyShape(),o,s,r),this.renderer.updateTracker(this.selected),this.updateShapeInfo(this.selected),this.enable3d&&this.renderer3d&&(o=this.convertGraphXToUserX(o),s=this.convertGraphYToUserY(s),r=this.convertGraphZToUserZ(r),this.renderer3d.updateMultipleSelector(o,s,r,0))}},E2DEditor.prototype.moveConnector=function(e,t,i){this.selected&&this.renderer.isConnector(this.selected)&&(this.renderer.isPolyline(this.selected)&&this.renderer.isPolylineSegmentSelected(this.selected)||(this.clearPolylineConnections(this.selected),this.renderer.isQuoteLine(this.selected)||(this.renderer.disconnectLineFromShape(this.selected,"to"),this.renderer.disconnectLineFromShape(this.selected,"from")),this.renderer.moveCompleteLine(this.selected,this.selectedBounds,e,t,i.x,i.y),this.renderer.updateTracker(this.selected),this.updateShapeInfo(this.selected)))},E2DEditor.prototype.updateAttachedSmartLines=function(e){for(var t=this.insertedShapes.getAttachedSmartLines(e.id),i=0,n=t.length;i0)for(var d=this.renderer.bounds(e),c=this.renderer.getCenterPointFromRect(d,0,0),u=0,p=r.length;u1?1:l)<-1?-1:l,l=Math.acos(l),l=E2DUtils.rad2deg(l),r<=0&&(l=360-l),l},E2DEditor.prototype.getLibraryProperties=function(e){const t=this.insertedShapes.getShapeById(e);return t?this.libraryProperties[t.getFullSource()]:null},E2DEditor.prototype.createNewGroup=function(e,t,i,n){i=i||$.Deferred();const o=Date.now(),s=[];let r=69;if(e.group=InsertedShapes.GetNextGroupOccurrence(e.source),t.group2d.shapes&&t.group2d.shapes.length>0)for(let i=0,n=t.group2d.shapes.length;i0){t.x*=1,t.y*=1;for(let e=0,i=n.group2d.connectors.length;e0)for(var t=0,i=e.length;t0)for(var s=o.group2d.shapes,r=0,a=s.length;rthis.renderer.MAX_WIDTH){s=0;const e=C?this.revertShapeOriginToGraphData(s,r,l,h,C).x:s;i.x=E2DUtils.round(this.convertGraphXToUserX(e),this.numberOfDecimal)}if(P[0].y<0||P[0].y>this.renderer.MAX_WIDTH){r=0;const e=C?this.revertShapeOriginToGraphData(s,r,l,h,C).y:r;i.y=E2DUtils.round(this.convertGraphYToUserY(e),this.numberOfDecimal)}if(i.width||(i.width=E2DUtils.round(this.convertGraphDataToUserData(l),this.numberOfDecimal)),i.height||(i.height=E2DUtils.round(this.convertGraphDataToUserData(h),this.numberOfDecimal)),i.depth||(i.depth=E2DUtils.round(this.convertGraphDataToUserData(d),this.numberOfDecimal)),i.text||(i.text=c),i.linkClass||(i.linkClass=u),i.eventClass||(i.eventClass=p),i.color||(i.color=g),i.colorOpacity||(i.colorOpacity=y),i.lineColor||(i.lineColor=f),i.lineOpacity||(i.lineOpacity=v),i.color3D||(i.color3D=m),i.colorOpacity3D||(i.colorOpacity3D=S),i.lineColor3D||(i.lineColor3D=E),i.lineOpacity3D||(i.lineOpacity3D=D),(e=this.renderer.importAndAppendChild(this.renderer.svgRoot,e)).setAttribute("id",i.id),this.renderer.setPosition(e,s,r,a),this.renderer.setDimensions(e,l,h,d),this.renderer.setRotation(e,i.rotation),i.text&&(this.renderer.setShapeText(e,i.text),i.hasBehaviour("(NOTE)")&&(this.renderer.setLineWidth(e,"0px"),this.renderer.setFillOpacity(e,"0.0"))),this.renderer.setLineColor(e,i.lineColor),this.renderer.setLineWidth(e,i.lineWidth),this.renderer.setLineOpacity(e,i.lineOpacity),1!==t.shapeMode&&(this.renderer.setFillColor(e,i.color),this.renderer.setFillOpacity(e,i.colorOpacity)),this.renderer.setLayer(e,this.libraryLayers[i.layer]),this.renderer.setPinned(e,i.pinned),i.custom&&(this.updateShapeAccordingToCustomProperties(e,i),this.renderer.hideSnapLine(),this.renderer.hideTracker(),this.renderer.hideLineTracker()),this.updateLibraryLayers(i.layer),this.insertedShapes.addShape(i),this.addNewShapeListeners(e),i.id!==this.ORIGIN_ID&&i.id!==this.CUSTOM_ORIGIN_ID&&(this.handleZIndexPositioning(),e=document.getElementById(e.id)),o?(this.select(e),this.selectedBounds=this.renderer.bounds(e),E2DEvents.mouseDown={x:this.selectedBounds.x,y:this.selectedBounds.y}):this.unselect(),n&&n.resolve(e),o){if(this.events.inserted){var L=this.getEventArgumentByShapeId("INSERTED",i.id);if(L)return void E2DEvents.doSubmitEvent("OnEditor2DInserted",[L],1,"urNewShapes")}this.saveUndoRedoPoint(0,"urNewShape")}},E2DEditor.prototype.handleZIndexPositioning=function(){let e=null;if(!E2DGlobals.e2d.origin.background){if(e=document.getElementById(this.ORIGIN_ID)){if(e.getAttribute("riSVGInProgress"))return void setTimeout(E2DGlobals.e2d.handleZIndexPositioning,50);(e=this.renderer.bringToFront(e))&&this.addNewShapeListeners(e)}(e=document.getElementById(this.CUSTOM_ORIGIN_ID))&&(e=this.renderer.bringToFront(e))&&this.addNewShapeListeners(e)}if(this.insertedShapes.alwaysInBack)for(let t in this.insertedShapes.alwaysInBack)this.insertedShapes.alwaysInBack.hasOwnProperty(t)&&(e=document.getElementById(t))&&(e=this.renderer.sendToBack(e))&&this.addNewShapeListeners(e);if(this.insertedShapes.alwaysInFront)for(let t in this.insertedShapes.alwaysInFront)this.insertedShapes.alwaysInFront.hasOwnProperty(t)&&(e=document.getElementById(t))&&(e=this.renderer.bringToFront(e))&&this.addNewShapeListeners(e)},E2DEditor.prototype.applyRoundingToUserRect=function(e){var t={};return t.x=E2DUtils.round(e.x,this.numberOfDecimal),t.y=E2DUtils.round(e.y,this.numberOfDecimal),(e.z||"number"==typeof e.z)&&(t.z=E2DUtils.round(1*e.z,this.numberOfDecimal)),t.width=E2DUtils.round(e.width,this.numberOfDecimal),t.height=E2DUtils.round(e.height,this.numberOfDecimal),(e.depth||"number"==typeof e.depth)&&(t.depth=E2DUtils.round(1*e.depth,this.numberOfDecimal)),(e.length||"number"==typeof e.length)&&(t.length=E2DUtils.round(1*e.length,this.numberOfDecimal)),(e.rotation||"number"==typeof e.rotation)&&(t.rotation=e.rotation),t},E2DEditor.prototype.convertTrueBoundsToUserBounds=function(e){var t={};return t.x=this.convertGraphXToUserX(e.x),t.y=this.convertGraphYToUserY(e.y),(e.z||"number"==typeof e.z)&&(t.z=this.convertGraphZToUserZ(e.z)),t.width=this.convertGraphDataToUserData(e.width),t.height=this.convertGraphDataToUserData(e.height),(e.depth||"number"==typeof e.depth)&&(t.depth=this.convertGraphDataToUserData(e.depth)),(e.length||"number"==typeof e.length)&&(t.length=this.convertGraphDataToUserData(e.length)),(e.lengthFrom||"number"==typeof e.lengthFrom)&&(t.lengthFrom=this.convertGraphDataToUserData(e.lengthFrom)),(e.lengthTo||"number"==typeof e.lengthTo)&&(t.lengthTo=this.convertGraphDataToUserData(e.lengthTo)),(e.rotation||"number"==typeof e.rotation)&&(t.rotation=e.rotation),(e.rotationFrom||"number"==typeof e.rotationFrom)&&(t.rotationFrom=e.rotationFrom),(e.rotationTo||"number"==typeof e.rotationTo)&&(t.rotationTo=e.rotationTo),t},E2DEditor.prototype.convertGraphXToUserX=function(e){return(this.convertGraphDataToUserData(e)-this.origin.x)*this.origin.signX},E2DEditor.prototype.convertGraphYToUserY=function(e){return(this.convertGraphDataToUserData(e)-this.origin.y)*this.origin.signY},E2DEditor.prototype.convertGraphZToUserZ=function(e){return(this.convertGraphDataToUserData(e)-this.origin.z)*this.origin.signZ},E2DEditor.prototype.convertGraphPointToUserPoint=function(e){return e.x=this.convertGraphXToUserX(e.x),e.y=this.convertGraphYToUserY(e.y),e.z=this.convertGraphZToUserZ(e.z),e},E2DEditor.prototype.convertGraphDataToUserData=function(e){return e*this.conversionFactor/this.scale},E2DEditor.prototype.convertPixelsToUserData=function(e){return e*this.conversionFactor},E2DEditor.prototype.convertUserBoundsToGraphBounds=function(e){var t={};return t.x=this.convertUserXToGraphX(e.x),t.y=this.convertUserYToGraphY(e.y),(e.z||"number"==typeof e.z)&&(t.z=this.convertUserZToGraphZ(e.z)),t.width=this.convertUserDataToGraphData(e.width),t.height=this.convertUserDataToGraphData(e.height),(e.depth||"number"==typeof e.depth)&&(t.depth=this.convertUserDataToGraphData(e.depth)),(e.length||"number"==typeof e.length)&&(t.length=this.convertUserDataToGraphData(e.length)),(e.rotation||"number"==typeof e.rotation)&&(t.rotation=1*e.rotation),(e.x2||"number"==typeof e.x2)&&(t.x2=e.x2),(e.y2||"number"==typeof e.y2)&&(t.y2=e.y2),(e.controlX||"number"==typeof e.controlX)&&(t.controlX=e.controlX),(e.controlY||"number"==typeof e.controlY)&&(t.controlY=e.controlY),(e.controlX2||"number"==typeof e.controlX2)&&(t.controlX2=e.controlX2),(e.controlY2||"number"==typeof e.controlY2)&&(t.controlY2=e.controlY2),t},E2DEditor.prototype.convertUserXToGraphX=function(e){return this.convertUserDataToGraphData(1*this.origin.x+e*this.origin.signX*1)},E2DEditor.prototype.convertUserYToGraphY=function(e){return this.convertUserDataToGraphData(1*this.origin.y+e*this.origin.signY*1)},E2DEditor.prototype.convertUserZToGraphZ=function(e){return this.convertUserDataToGraphData(1*this.origin.z+e*this.origin.signZ*1)},E2DEditor.prototype.convertUserDataToGraphData=function(e){return e*(1/this.conversionFactor)*this.scale},E2DEditor.prototype.convertUserDataToPixels=function(e){return e/this.conversionFactor},E2DEditor.prototype.convertPathToUserString=function(e){for(var t="",i=0,n=e.length;i0&&(w=!1,G="urRotateShapes",E2DEvents.doSubmitEvent("OnEditor2DRotated",l,1,G)),this.events.stretched&&h.length>0&&(w=!1,G="urStretchShapes",E2DEvents.doSubmitEvent("OnEditor2DStretched",h,1,G)),w&&this.saveUndoRedoPoint(0,G)},E2DEditor.prototype.updateShapeEx=function(e,t){if(e&&t){e.copyFrom(t);var i={width:e.width,height:e.height,depth:e.depth,x:e.x,y:e.y,z:e.z,rotation:e.rotation},n=this.convertUserBoundsToGraphBounds(i);if(this.customOrigin&&e.id!==this.CUSTOM_ORIGIN_ID){var o=this.customOrigin.x*this.origin.signX*1+1*this.origin.x,s=this.customOrigin.y*this.origin.signY*1+1*this.origin.y;n.x=this.convertUserDataToGraphData(o+i.x*this.customOrigin.signX*1),n.y=this.convertUserDataToGraphData(s+i.y*this.customOrigin.signY*1)}var r=document.getElementById(e.id);this.updateLibraryLayers(e.layer),this.updateShapeSingle(r,e,n,!0),e.update3D()}},E2DEditor.prototype.updateConnectorEx=function(e,t){if(e&&t){e.copyFrom(t);var i=document.getElementById(e.id);this.updateConnectorSingle(i,e),e.update3D()}},E2DEditor.prototype.updateConnectorSingle=function(e,t){var i=this.convertUserXToGraphX(t.x),n=this.convertUserYToGraphY(t.y),o=this.convertUserXToGraphX(t.width),s=this.convertUserYToGraphY(t.height),r=null,a=null;"number"==typeof t.ctrl1x&&"number"==typeof t.ctrl1y&&-1!==t.ctrl1x&&-1!==t.ctrl1y&&(r=this.convertUserXToGraphX(t.ctrl1x),a=this.convertUserYToGraphY(t.ctrl1y));var l=null,h=null;"number"==typeof t.ctrl2x&&"number"==typeof t.ctrl2y&&-1!==t.ctrl2x&&-1!==t.ctrl2y&&(l=this.convertUserXToGraphX(t.ctrl2x),h=this.convertUserYToGraphY(t.ctrl2y));var d=null,c=null;t.shapeFromId&&(c=document.getElementById(t.shapeFromId)),c&&(d=this.renderer.getConnectionPointObjByPointId(c,t.shapeFromPointIndex))&&(t.x=E2DUtils.round(this.convertGraphXToUserX(d.x),this.numberOfDecimal),t.y=E2DUtils.round(this.convertGraphYToUserY(d.y),this.numberOfDecimal),i=d.x,n=d.y);var u=null;if(t.shapeToId&&(u=document.getElementById(t.shapeToId)),u&&(d=this.renderer.getConnectionPointObjByPointId(u,t.shapeToPointIndex))&&(t.width=E2DUtils.round(this.convertGraphXToUserX(d.x),this.numberOfDecimal),t.height=E2DUtils.round(this.convertGraphYToUserY(d.y),this.numberOfDecimal),o=d.x,s=d.y),"link-line"===t.source){if(!c||!u)return void this.deleteItem(e);if(c.id===u.id)return void this.deleteItem(e)}switch(t.source){case"line":case"link-line":case"ortho-line":case"smart-line":case"quote-line":this.renderer.moveLine(e,i,n,!0),this.renderer.moveLine(e,o,s,!1);break;case"curve-line":this.renderer.moveLine(e,i,n,!0),this.renderer.moveLine(e,o,s,!1),this.renderer.setControl1(e,r,a),this.renderer.setControl2(e,l,h);break;case"poly-line":if(t.path){var p=this.convertUserStringToPath(t.path);this.renderer.setPolylinePoints(e,p),this.renderer.setPolylineColor(e,t.lineColor),this.renderer.setPolylineWidth(e,t.lineWidth)}}if(c&&(this.renderer.disconnectLineFromShape(e,"from"),this.renderer.connectLine(c,e,"from",t.shapeFromPointIndex)),u){this.renderer.disconnectLineFromShape(e,"to");var g=null;if(t.isLinkLine()&&(g=this.insertedShapes.getCircularReference(u.id,e,t.source)).circular&&!this.areOverlappingConnectionPoints(c,t.shapeFromPointIndex,u,t.shapeToPointIndex))return void this.deleteItem(e);this.renderer.connectLine(u,e,"to",t.shapeToPointIndex),t.isLinkLine()&&!g.circular&&this.renderer.validateLink(e)}if(t.isQuoteLine()){this.isShapesLoadPending()&&this.clearDragCache();var y=this.convertUserDataToGraphData(t.dimStack),f=this.convertUserDataToGraphData(t.dimValue),v=E2DTag.isTagInString(t.behaviour,"(DIMSTACKABSOLUTE)");this.renderer.updateQuote(e,y,t.dimType,t.dimDriving,f,v)}!t.text||t.isPolyline()||t.isQuoteLine()||this.renderer.setShapeText(e,t.text),this.clearShapeText(e),this.resetShapeText(e)},E2DEditor.prototype.updateShapeSingle=function(e,t,i,n,o){if(t){if(!n&&!this.updateShapeCustomProperties(t))return null;this.updateCustomOrigin(t),this.updateShapeInfoAccordingToCustomProperties(e,t,i),this.updateShapeInfoAccordingToAspectRatio(e,t,i),this.updateShapeInfoAccordingToOrigin(e,t,i)}let s=null,r=this.renderer.bounds(e);var a,l,h,d;r.width===i.width&&r.height===i.height||(s=this.getShapeDependenciesBeforeResize(e,!0)),this.renderer.setDimensions(e,i.width,i.height,i.depth),s&&(s=this.updateShapeDependenciesAfterResize(e,s),this.moveShapeDependenciesAfterResize(e,s));var c=this.renderer.bounds(e);if(this.renderer.isMultipleSelect(this.selected)&&!this.renderer.isMultipleSelect(e))if(i.rotation>0){var u=1*c.rotation+Math.round(o.rotation),p=this.renderer.getProportionalBoundsRotation(c,o,o.rotation);a=p.x-c.x,l=p.y-c.y,d=u-c.rotation,this.renderer.rotate(e,u),this.renderer.move(e,p.x,p.y,null)}else a=i.x-c.x,l=i.y-c.y,h=i.z-c.z,d=0,this.renderer.move(e,i.x,i.y,i.z);else a=i.x-c.x,l=i.y-c.y,h=i.z-c.z,d=i.rotation-c.rotation,this.renderer.setPosition(e,i.x,i.y,i.z),this.renderer.setRotation(e,i.rotation);this.moveShapeDependencies(e,a,l,h,d),this.renderer.setLayer(e,this.libraryLayers[t.layer]),this.renderer.setPinned(e,!!t&&t.pinned);var g=this.renderer.getShapeText(e);return g&&t.text&&g!==t.text?this.renderer.setShapeText(e,t.text):(this.clearShapeText(e),this.resetShapeText(e)),e},E2DEditor.prototype.updateShapeCustomProperties=function(e){var t=this.libraryProperties[e.getFullSource()].custom;if(!t)return!0;for(var i in e.custom){var n=$("#"+i.replace(" ","_"));if(0!==n.length){var o=null;if(o="select"===n.prop("tagName").toLowerCase()?n.find(":selected").text():n.val()){var s=t[i].UIValidation;if(s&&i&&o){var r=s.replace(/value/gi,o),a=s.replace(/value/gi,i);if(!window.eval(r))return n.addClass("validationError"),n.attr("title",a),!1;n.removeClass("validationError"),n.removeAttr("title")}e.custom[i]=o}}}return!0},E2DEditor.prototype.updateShapeInfoAccordingToCustomProperties=function(e,t,i){if(!this.libraryProperties[t.getFullSource()])return!1;var n=this.libraryProperties[t.getFullSource()].custom;if(!n)return e;var o=this.getUpdateDataFromCustomProperties(e,t,n);if((o.width||"number"==typeof o.width)&&(i.width=o.noConvert?o.width:this.convertUserDataToGraphData(o.width)),(o.height||"number"==typeof o.height)&&(i.height=o.noConvert?o.height:this.convertUserDataToGraphData(o.height)),(o.depth||"number"==typeof o.depth)&&(i.depth=o.noConvert?o.depth:this.convertUserDataToGraphData(o.depth)),(o.x||"number"==typeof o.x)&&(i.x=o.noConvert?o.x:this.convertUserXToGraphX(o.x)),(o.y||"number"==typeof o.y)&&(i.y=o.noConvert?o.y:this.convertUserYToGraphY(o.y)),(o.z||"number"==typeof o.z)&&(i.z=o.noConvert?o.z:this.convertUserZToGraphZ(o.z)),(o.rotation||"number"==typeof o.rotation)&&(i.rotation=o.rotation),o.color&&(t.color=o.color,this.renderer.setFillColor(e,o.color)),o.color3d&&(t.color3D=o.color3d),o.image&&t.image!==o.image&&(t.image=o.image,this.renderer.setImage(e,o.image)),o.remBehaviour)for(var s=0,r=o.remBehaviour.length;s("+this.unit+")"),!this.hasFocusPolyLineProperties()){var l=null;if(s=this.convertTrueBoundsToUserBounds(s),"select"===this.mode&&this.renderer.isPolylineSegmentSelected(this.selected)){var h=this.renderer.getPolylineSelectedSegment(this.selected);(l=this.renderer.getPolylineSegmentInfo(e,h[1])).length=this.convertGraphDataToUserData(l.length),this.polyLineProps.length.val(E2DUtils.round(l.length,this.numberOfDecimal)),this.polyLineProps.rotation.val(l.rotation)}else if("polyline-to"===this.resizeMode||""===this.resizeMode)this.polyLineProps.length.val(E2DUtils.round(s.lengthTo,this.numberOfDecimal)),this.polyLineProps.rotation.val(s.rotationTo);else if("polyline-from"===this.resizeMode||"polyline-0"===this.resizeMode)this.polyLineProps.length.val(E2DUtils.round(s.lengthFrom,this.numberOfDecimal)),this.polyLineProps.rotation.val(s.rotationFrom);else{var d=1*this.resizeMode.substring(9);(l=this.renderer.getPolylineSegmentInfo(e,d)).length=this.convertGraphDataToUserData(l.length),this.polyLineProps.length.val(E2DUtils.round(l.length,this.numberOfDecimal)),this.polyLineProps.rotation.val(l.rotation)}}this.setPropertiesVisible(this.polyLineProps.table)}}else if(this.renderer.isQuoteLine(e)){if(!this.quotePropertiesEnabled)return;this.quoteProps.units.html("("+this.unit+")");var c=this.insertedShapes.getShapeById(e.id);if(c){this.quoteProps.driving.prop("checked",c.dimDriving),this.quoteProps.type.find("input[name=_qTGroup]").each(function(){var e=$(this);if(1*e.val()===c.dimType)return e.prop("checked",!0).trigger("change"),!1}),this.quoteProps.value.val(c.dimValue);var u=this.insertedShapes.getConnectionShape(c.id,"from"),p=this.insertedShapes.getConnectionShape(c.id,"to"),g=u.shapeID===p.shapeID;E2DEvents.enableQuoteDriving(c.dimDriving,g)}this.setPropertiesVisible(this.quoteProps.table)}}else{if(!a)return;if(!this.shapePropertiesEnabled)return;this.shapeProps.width[0].setCustomValidity(""),this.shapeProps.height[0].setCustomValidity(""),this.shapeProps.depth[0].setCustomValidity(""),this.shapeProps.x[0].setCustomValidity(""),this.shapeProps.y[0].setCustomValidity(""),this.shapeProps.z[0].setCustomValidity("");var y=this.getBehaviour(e.id,!0);if(!E2DEvents.dragStarted&&(this.shapeProps.units.html("("+E2DGlobals.e2d.unit+")"),this.shapeProps.name.html(""+a.name+""),this.shapeProps.pin.prop("checked",!!a.pinned),this.shapeProps.width.attr("readOnly",y.stretch.noStretch||y.stretch.noWStretch),this.shapeProps.height.attr("readOnly",y.stretch.noStretch||y.stretch.noHStretch),this.shapeProps.depth.attr("readOnly",y.stretch.noStretch||y.stretch.noDStretch),this.shapeProps.x.attr("readOnly",y.move.noMove||y.move.noXMove),this.shapeProps.y.attr("readOnly",y.move.noMove||y.move.noYMove),this.shapeProps.z.attr("readOnly",y.move.noMove||y.move.noZMove),this.shapeProps.rotation.attr("readOnly",y.move.noRotate),this.libraryProperties[a.getFullSource()])){var f=this.libraryProperties[a.getFullSource()],v=f.iconBig||f.icon;this.shapeProps.image.attr("src",v||(a.sourceLibrary||this.shapeLibraryList[0])+"/theme/images/e2d/shape.png")}if(this.shapeProps.layer.val(a.layer),this.shapeProps.width.val(a.width),this.shapeProps.height.val(a.height),this.shapeProps.depth.val(a.depth),this.customOrigin&&e.id!==this.CUSTOM_ORIGIN_ID?(r.x=(r.x-this.customOrigin.x)*this.customOrigin.signX*this.origin.signX,r.y=(r.y-this.customOrigin.y)*this.customOrigin.signY*this.origin.signY,r.z=(r.z-this.customOrigin.z)*this.customOrigin.signZ*this.origin.signZ,this.shapeProps.x.val(E2DUtils.round(r.x,this.numberOfDecimal)),this.shapeProps.y.val(E2DUtils.round(r.y,this.numberOfDecimal)),this.shapeProps.z.val(E2DUtils.round(r.z,this.numberOfDecimal))):(this.shapeProps.x.val(a.x),this.shapeProps.y.val(a.y),this.shapeProps.z.val(a.z)),e.id===this.CUSTOM_ORIGIN_ID&&(this.customOrigin.x=a.x,this.customOrigin.y=a.y,this.customOrigin.z=a.z),this.shapeProps.rotation.val(a.rotation),i){var m=a.id===this.CUSTOM_ORIGIN_ID||a.hasBehaviour("(HIDEPIN)")?"none":"";$("#_pin_row").css("display",m);var S=a.hasBehaviour("(HIDEDIMENSIONS)")?"none":"",E=!this.enable3d&&"PROPSONLY"!==this.enable3dViewStyle||a.hasBehaviour("(HIDEDIMENSIONS)")?"none":"";$("#_width_row").css("display",S),$("#_height_row").css("display",S),$("#_depth_row").css("display",E);var D=a.hasBehaviour("(HIDECOORDINATES)")?"none":"",b=!this.enable3d&&"PROPSONLY"!==this.enable3dViewStyle||a.hasBehaviour("(HIDECOORDINATES)")?"none":"";$("#_x_row").css("display",D),$("#_y_row").css("display",D),$("#_z_row").css("display",m||b);var x=a.hasBehaviour("(HIDEROTATION)")?"none":"";$("#_rotation_row").css("display",x);var I=a.hasBehaviour("(HIDELAYER)")?"none":"";$("#_layer_row").css("display",I);var C=a.hasBehaviour("(HIDEUPDATEBUTTON)")?"none":"";$("#btnUpdateShape").css("display",C);var T=a.hasBehaviour("(SHOWCONFIGUREBUTTON)")?"":"none";$("#btnConfigureShape").css("display",T);var P=a.hasBehaviour("(SHOWVALIDATEBUTTON)")?"":"none";$("#btnValidateShape").css("display",P),this.updateShapePropertiesTableWithCustomProperties(a.getFullSource(),a)}this.setPropertiesVisible(this.shapeProps.table)}}else this.setPropertiesVisible(null)},E2DEditor.prototype.updateMultipleShapeInfo=function(e){for(var t={},i=0,n=e.length;i0)for(var h=0,d=l.length;h"+t.name+""),this.shapeProps.pin.prop("checked",!1),this.shapeProps.layer.val(i.layer),this.shapeProps.width.val(""),this.shapeProps.height.val(""),this.shapeProps.depth.val("");var n=this.renderer.getMultipleSelector(),o=this.renderer.bounds(n),s=this.convertTrueBoundsToUserBounds(o);if(this.shapeProps.x.val(E2DUtils.round(s.x,this.numberOfDecimal)),this.shapeProps.y.val(E2DUtils.round(s.y,this.numberOfDecimal)),this.shapeProps.z.val(E2DUtils.round(s.z,this.numberOfDecimal)),this.shapeProps.rotation.val(s.rotation),this.libraryProperties&&this.libraryProperties[t.fullSource]){var r=this.libraryProperties[t.fullSource],a=r.iconBig||r.icon;this.shapeProps.image.attr("src",a||this.shapeLibraryList[0]+"/theme/images/e2d/shape.png");var l=this.getBehaviourFromMultipleShapes(e),h=E2DTag.isTagInString(l,"(HIDECOORDINATES)")?"none":"";$("#_x_row").css("display",h),$("#_y_row").css("display",h),$("#_z_row").css("display",h),$("#_width_row").css("display","none"),$("#_height_row").css("display","none"),$("#_depth_row").css("display","none");var d=E2DTag.isTagInString(l,"(HIDEROTATION)")?"none":"";$("#_rotation_row").css("display",d);var c=E2DTag.isTagInString(l,"(HIDELAYER)")?"none":"";$("#_layer_row").css("display",c);var u=E2DTag.isTagInString(l,"(HIDEUPDATEBUTTON)")?"none":"";$("#btnUpdateShape").css("display",u);var p=E2DTag.isTagInString(l,"(SHOWCONFIGUREBUTTON)")?"":"none";$("#btnConfigureShape").css("display",p);var g=E2DTag.isTagInString(l,"(SHOWVALIDATEBUTTON)")?"":"none";$("#btnValidateShape").css("display",g),this.updateShapePropertiesTableWithCustomProperties(t.fullSource,i),this.setPropertiesVisible(this.shapeProps.table)}},E2DEditor.prototype.getBehaviourFromMultipleShapes=function(e){return e&&0!==e.length?e.reduce((e,t)=>{if(this.renderer.isConnector(t))return e;return e+=this.insertedShapes.getShapeById(t.id).behaviour},""):""},E2DEditor.prototype.getBehaviour=function(e,t){var i={move:{},stretch:{}};if(!e||e===this.ORIGIN_ID||e===this.CUSTOM_ORIGIN_ID)return i;if(this.renderer.isMultipleSelect(e))for(var n=this.multipleSelectShapes.getShapes(),o=0,s=n.length;o0){t=t||[],i=i||[];for(var s=null,r=0,a=o.length;r{if(e=e||{},this.renderer.isConnector(t))return e;const i=this.insertedShapes.getShapeById(t.id);if(!i)return e;const n=i.getFullSource();return e[n]?e[n].count++:e[n]={count:1,source:i.source,fullSource:n,name:i.name},e},null),n=Object.values(i);if(n&&n.length>0){const e=n.reduce((e,t)=>e.count>t.count?e:t);t.source=e.source,t.fullSource=e.fullSource,t.name=e.name}return t},E2DEditor.prototype.getMainShapeValuesFromMultipleShapes=function(e,t){let i={layer:"",custom:{}};if(!e||0===e.length)return i;const n=e.find(e=>{if(this.renderer.isConnector(e))return!1;const i=this.insertedShapes.getShapeById(e.id);return!!i&&i.getFullSource()===t});if(!n)return i;const o=this.insertedShapes.getShapeById(n.id),s=JSON.parse(JSON.stringify(o));i.layer=s.layer,i.custom=s.custom;const r=i.custom?Object.keys(i.custom):[];return i=e.reduce((e,i)=>{if(this.renderer.isConnector(i))return e;const n=this.insertedShapes.getShapeById(i.id);if(!n)return e;if(n.getFullSource()!==t)return e;const o=JSON.parse(JSON.stringify(n));return e.layer!==o.layer&&(e.layer=null),e.custom&&o.custom?r.forEach(t=>{e.custom[t]!=o.custom[t]&&(e.custom[t]=null)}):e.custom=null,e},i)},E2DEditor.prototype.updateShapePropertiesTableWithCustomProperties=function(e,t){if(this.shapePropertiesEnabled){var i=$("#_toolbarShapePropertiesDetails");if(0!==i.length&&(i.find(".shapeCustomPropertyRow").remove(),this.libraryProperties&&this.libraryProperties[e]&&this.libraryProperties[e].custom)){var n=this.libraryProperties[e].custom;for(var o in n){var s=this.createCustomPropertyRowForShapePropertiesTable(t,o,n[o]);s&&0!==s.length&&i.append(s)}}}},E2DEditor.prototype.createCustomPropertyRowForShapePropertiesTable=function(e,t,i){if($.isEmptyObject(i))return null;if("hide"===i.UIType)return null;var n=$("
").addClass("shapeCustomPropertyRow"),o=($("