@excalidraw/excalidraw 0.18.0-c141960 → 0.18.0-c158187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/{chunk-SJTAY27F.js → chunk-5A4X24JB.js} +135 -107
- package/dist/dev/chunk-5A4X24JB.js.map +7 -0
- package/dist/dev/{chunk-FB2NA5UG.js → chunk-6JJSWC4C.js} +1 -1
- package/dist/dev/{chunk-FB2NA5UG.js.map → chunk-6JJSWC4C.js.map} +2 -2
- package/dist/dev/{chunk-PMQWN2AA.js → chunk-DJHLEOOZ.js} +13 -13
- package/dist/dev/{chunk-PMQWN2AA.js.map → chunk-DJHLEOOZ.js.map} +1 -1
- package/dist/dev/{chunk-AWYOLLYX.js → chunk-OCFTI2BU.js} +2 -2
- package/dist/dev/{chunk-AWYOLLYX.js.map → chunk-OCFTI2BU.js.map} +1 -1
- package/dist/dev/data/{image-S2GFZH7W.js → image-Q6JHR7OE.js} +2 -2
- package/dist/dev/index.css +1 -3
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +796 -1307
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{ar-SA-USQAA427.js → ar-SA-JK5MQ7TT.js} +2 -1
- package/dist/dev/locales/{ar-SA-USQAA427.js.map → ar-SA-JK5MQ7TT.js.map} +2 -2
- package/dist/dev/locales/{az-AZ-CVQRXULV.js → az-AZ-2PAD62G4.js} +2 -1
- package/dist/dev/locales/{az-AZ-CVQRXULV.js.map → az-AZ-2PAD62G4.js.map} +2 -2
- package/dist/dev/locales/{bg-BG-E4I2JVOQ.js → bg-BG-HUKVYCRK.js} +2 -1
- package/dist/dev/locales/{bg-BG-E4I2JVOQ.js.map → bg-BG-HUKVYCRK.js.map} +2 -2
- package/dist/dev/locales/{bn-BD-O55ROP2R.js → bn-BD-V2CQI46P.js} +2 -1
- package/dist/dev/locales/{bn-BD-O55ROP2R.js.map → bn-BD-V2CQI46P.js.map} +2 -2
- package/dist/dev/locales/{bn-IN-OL7OUKTP.js → bn-IN-MBEO4C3J.js} +2 -1
- package/dist/dev/locales/{bn-IN-OL7OUKTP.js.map → bn-IN-MBEO4C3J.js.map} +2 -2
- package/dist/dev/locales/{ca-ES-73KY52DM.js → ca-ES-KWEKW4C3.js} +2 -1
- package/dist/dev/locales/{ca-ES-73KY52DM.js.map → ca-ES-KWEKW4C3.js.map} +2 -2
- package/dist/dev/locales/{cs-CZ-2YGHPQ24.js → cs-CZ-W5AHZB5H.js} +2 -1
- package/dist/dev/locales/{cs-CZ-2YGHPQ24.js.map → cs-CZ-W5AHZB5H.js.map} +2 -2
- package/dist/dev/locales/{da-DK-OEIZIPJU.js → da-DK-ITTM6YM4.js} +2 -1
- package/dist/dev/locales/{da-DK-OEIZIPJU.js.map → da-DK-ITTM6YM4.js.map} +2 -2
- package/dist/dev/locales/{de-CH-4GJTW23D.js → de-CH-OAWPDQFJ.js} +2 -1
- package/dist/dev/locales/{de-CH-4GJTW23D.js.map → de-CH-OAWPDQFJ.js.map} +2 -2
- package/dist/dev/locales/{de-DE-YRH6WMM5.js → de-DE-ZRDYEPMS.js} +8 -7
- package/dist/dev/locales/de-DE-ZRDYEPMS.js.map +7 -0
- package/dist/dev/locales/{el-GR-W7S64QNM.js → el-GR-QXASZLPE.js} +2 -1
- package/dist/dev/locales/el-GR-QXASZLPE.js.map +7 -0
- package/dist/dev/locales/{en-ZO6QSABV.js → en-MLZIHOCR.js} +2 -2
- package/dist/dev/locales/{es-ES-7JEN5PTZ.js → es-ES-VLQBB7FJ.js} +4 -3
- package/dist/dev/locales/es-ES-VLQBB7FJ.js.map +7 -0
- package/dist/dev/locales/{eu-ES-HQNHU6VR.js → eu-ES-TF2DGTZU.js} +2 -1
- package/dist/dev/locales/{eu-ES-HQNHU6VR.js.map → eu-ES-TF2DGTZU.js.map} +2 -2
- package/dist/dev/locales/{fa-IR-IN6XOPA6.js → fa-IR-ITKFQ7QV.js} +2 -1
- package/dist/dev/locales/{fa-IR-IN6XOPA6.js.map → fa-IR-ITKFQ7QV.js.map} +2 -2
- package/dist/dev/locales/{fi-FI-5BAAYJDZ.js → fi-FI-UWZRVXFI.js} +2 -1
- package/dist/dev/locales/{fi-FI-5BAAYJDZ.js.map → fi-FI-UWZRVXFI.js.map} +2 -2
- package/dist/dev/locales/{fr-FR-KCXBY2R4.js → fr-FR-A72LKGCO.js} +2 -1
- package/dist/dev/locales/{fr-FR-KCXBY2R4.js.map → fr-FR-A72LKGCO.js.map} +2 -2
- package/dist/dev/locales/{gl-ES-5OPGWS6N.js → gl-ES-2QCVIBFP.js} +2 -1
- package/dist/dev/locales/{gl-ES-5OPGWS6N.js.map → gl-ES-2QCVIBFP.js.map} +2 -2
- package/dist/dev/locales/{he-IL-3A6ZWK6L.js → he-IL-WJNUHU26.js} +2 -1
- package/dist/dev/locales/{he-IL-3A6ZWK6L.js.map → he-IL-WJNUHU26.js.map} +2 -2
- package/dist/dev/locales/{hi-IN-HZTBH6EG.js → hi-IN-XGMO235V.js} +2 -1
- package/dist/dev/locales/{hi-IN-HZTBH6EG.js.map → hi-IN-XGMO235V.js.map} +2 -2
- package/dist/dev/locales/{hu-HU-52IRZEAZ.js → hu-HU-37FDQFIS.js} +2 -1
- package/dist/dev/locales/{hu-HU-52IRZEAZ.js.map → hu-HU-37FDQFIS.js.map} +2 -2
- package/dist/dev/locales/{id-ID-W6HBGXTS.js → id-ID-EJIDCO4E.js} +2 -1
- package/dist/dev/locales/{id-ID-W6HBGXTS.js.map → id-ID-EJIDCO4E.js.map} +2 -2
- package/dist/dev/locales/{it-IT-AV75ICYT.js → it-IT-X34PIOJ2.js} +49 -48
- package/dist/dev/locales/it-IT-X34PIOJ2.js.map +7 -0
- package/dist/dev/locales/{ja-JP-SS4G3ZXF.js → ja-JP-37FC23PR.js} +28 -27
- package/dist/dev/locales/ja-JP-37FC23PR.js.map +7 -0
- package/dist/dev/locales/{kaa-Y5BBB3IW.js → kaa-7ZYDFVKA.js} +2 -1
- package/dist/dev/locales/{kaa-Y5BBB3IW.js.map → kaa-7ZYDFVKA.js.map} +2 -2
- package/dist/dev/locales/{kab-KAB-KDVZQXBT.js → kab-KAB-MILWXBA6.js} +2 -1
- package/dist/dev/locales/{kab-KAB-KDVZQXBT.js.map → kab-KAB-MILWXBA6.js.map} +2 -2
- package/dist/dev/locales/{kk-KZ-762YODLJ.js → kk-KZ-7BWTPIAV.js} +2 -1
- package/dist/dev/locales/kk-KZ-7BWTPIAV.js.map +7 -0
- package/dist/dev/locales/{km-KH-K2TE5MIK.js → km-KH-BV4P2KSZ.js} +2 -1
- package/dist/dev/locales/{km-KH-K2TE5MIK.js.map → km-KH-BV4P2KSZ.js.map} +2 -2
- package/dist/dev/locales/{ko-KR-75RUMBCO.js → ko-KR-TSXE5P7B.js} +2 -1
- package/dist/dev/locales/{ko-KR-75RUMBCO.js.map → ko-KR-TSXE5P7B.js.map} +2 -2
- package/dist/dev/locales/{ku-TR-E6DJ6LYM.js → ku-TR-ASSXNN3U.js} +2 -1
- package/dist/dev/locales/{ku-TR-E6DJ6LYM.js.map → ku-TR-ASSXNN3U.js.map} +2 -2
- package/dist/dev/locales/{lt-LT-BYS5DA45.js → lt-LT-G7RZYQQU.js} +2 -1
- package/dist/dev/locales/{lt-LT-BYS5DA45.js.map → lt-LT-G7RZYQQU.js.map} +2 -2
- package/dist/dev/locales/{lv-LV-SPQ2VWX3.js → lv-LV-DXNPBJZU.js} +2 -1
- package/dist/dev/locales/{lv-LV-SPQ2VWX3.js.map → lv-LV-DXNPBJZU.js.map} +2 -2
- package/dist/dev/locales/{mr-IN-2HLK6LUA.js → mr-IN-7F2ZCTCF.js} +2 -1
- package/dist/dev/locales/{mr-IN-2HLK6LUA.js.map → mr-IN-7F2ZCTCF.js.map} +2 -2
- package/dist/dev/locales/{my-MM-P2LR44WR.js → my-MM-NBI3KQGW.js} +2 -1
- package/dist/dev/locales/{my-MM-P2LR44WR.js.map → my-MM-NBI3KQGW.js.map} +2 -2
- package/dist/dev/locales/{nb-NO-7YZHFFVS.js → nb-NO-4DCTQT6L.js} +2 -1
- package/dist/dev/locales/{nb-NO-7YZHFFVS.js.map → nb-NO-4DCTQT6L.js.map} +2 -2
- package/dist/dev/locales/{nl-NL-TF2OVIKN.js → nl-NL-XGZJ7V2V.js} +226 -225
- package/dist/dev/locales/nl-NL-XGZJ7V2V.js.map +7 -0
- package/dist/dev/locales/{nn-NO-2BWEL2IS.js → nn-NO-FR534JV5.js} +2 -1
- package/dist/dev/locales/{nn-NO-2BWEL2IS.js.map → nn-NO-FR534JV5.js.map} +2 -2
- package/dist/dev/locales/{oc-FR-5JYIFGLE.js → oc-FR-YQCIKZIK.js} +56 -55
- package/dist/dev/locales/oc-FR-YQCIKZIK.js.map +7 -0
- package/dist/dev/locales/{pa-IN-KBBGER76.js → pa-IN-UM43JGD2.js} +2 -1
- package/dist/dev/locales/{pa-IN-KBBGER76.js.map → pa-IN-UM43JGD2.js.map} +2 -2
- package/dist/dev/locales/{percentages-2RAYDWNS.js → percentages-OGWD7R2K.js} +2 -2
- package/dist/dev/locales/{pl-PL-BWZ2X734.js → pl-PL-2UGKA6HK.js} +2 -1
- package/dist/dev/locales/{pl-PL-BWZ2X734.js.map → pl-PL-2UGKA6HK.js.map} +2 -2
- package/dist/dev/locales/{pt-BR-ERVIQI63.js → pt-BR-H23QFYE3.js} +3 -2
- package/dist/dev/locales/pt-BR-H23QFYE3.js.map +7 -0
- package/dist/dev/locales/{pt-PT-ZNJ5NB5S.js → pt-PT-RHKJH5I5.js} +2 -1
- package/dist/dev/locales/{pt-PT-ZNJ5NB5S.js.map → pt-PT-RHKJH5I5.js.map} +2 -2
- package/dist/dev/locales/{ro-RO-UYNXGUB7.js → ro-RO-IIFONL3T.js} +2 -1
- package/dist/dev/locales/{ro-RO-UYNXGUB7.js.map → ro-RO-IIFONL3T.js.map} +2 -2
- package/dist/dev/locales/{ru-RU-F7LPIMGQ.js → ru-RU-QEP6D7GK.js} +49 -48
- package/dist/dev/locales/ru-RU-QEP6D7GK.js.map +7 -0
- package/dist/dev/locales/{si-LK-5GF2DJUH.js → si-LK-LZYJQLHF.js} +2 -1
- package/dist/dev/locales/{si-LK-5GF2DJUH.js.map → si-LK-LZYJQLHF.js.map} +2 -2
- package/dist/dev/locales/{sk-SK-H6WE7IJX.js → sk-SK-RWC6UWGY.js} +49 -48
- package/dist/dev/locales/sk-SK-RWC6UWGY.js.map +7 -0
- package/dist/dev/locales/{sl-SI-4PJ6LBI7.js → sl-SI-QJT2CAUO.js} +2 -1
- package/dist/dev/locales/{sl-SI-4PJ6LBI7.js.map → sl-SI-QJT2CAUO.js.map} +2 -2
- package/dist/dev/locales/{sv-SE-E5VQLCRE.js → sv-SE-3MAT3NDX.js} +5 -4
- package/dist/dev/locales/sv-SE-3MAT3NDX.js.map +7 -0
- package/dist/dev/locales/{ta-IN-2YWIVLKF.js → ta-IN-J7XOYF2T.js} +2 -1
- package/dist/dev/locales/{ta-IN-2YWIVLKF.js.map → ta-IN-J7XOYF2T.js.map} +2 -2
- package/dist/dev/locales/{th-TH-IV7RUTDK.js → th-TH-2OI52EOQ.js} +2 -1
- package/dist/dev/locales/{th-TH-IV7RUTDK.js.map → th-TH-2OI52EOQ.js.map} +2 -2
- package/dist/dev/locales/{tr-TR-LEQWIQH7.js → tr-TR-G7TAUHUI.js} +2 -1
- package/dist/dev/locales/{tr-TR-LEQWIQH7.js.map → tr-TR-G7TAUHUI.js.map} +2 -2
- package/dist/dev/locales/{uk-UA-DWVOQPTB.js → uk-UA-IVSVBJIG.js} +2 -1
- package/dist/dev/locales/{uk-UA-DWVOQPTB.js.map → uk-UA-IVSVBJIG.js.map} +2 -2
- package/dist/dev/locales/{uz-UZ-CKXQ3QKG.js → uz-UZ-KCVDUVDE.js} +2 -1
- package/dist/dev/locales/{uz-UZ-CKXQ3QKG.js.map → uz-UZ-KCVDUVDE.js.map} +2 -2
- package/dist/dev/locales/{vi-VN-3P6DZOGS.js → vi-VN-KBZAVWP5.js} +4 -3
- package/dist/dev/locales/{vi-VN-3P6DZOGS.js.map → vi-VN-KBZAVWP5.js.map} +2 -2
- package/dist/dev/locales/{zh-CN-XXVG53TQ.js → zh-CN-IS26RG2D.js} +2 -1
- package/dist/dev/locales/{zh-CN-XXVG53TQ.js.map → zh-CN-IS26RG2D.js.map} +2 -2
- package/dist/dev/locales/{zh-HK-JCHGKEUE.js → zh-HK-KBWQ6SJC.js} +2 -1
- package/dist/dev/locales/{zh-HK-JCHGKEUE.js.map → zh-HK-KBWQ6SJC.js.map} +2 -2
- package/dist/dev/locales/{zh-TW-ARVT7RZU.js → zh-TW-JKJWJQ4J.js} +2 -1
- package/dist/dev/locales/{zh-TW-ARVT7RZU.js.map → zh-TW-JKJWJQ4J.js.map} +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-AJI3LATG.js +1 -0
- package/dist/prod/{chunk-N7QNUCIG.js → chunk-QNG5NH6R.js} +1 -1
- package/dist/prod/chunk-TIFXQFVB.js +4 -0
- package/dist/prod/{chunk-LS7FJGPW.js → chunk-Z5NKEFVG.js} +8 -8
- package/dist/prod/data/{image-SMWA6JLH.js → image-OPZV5J37.js} +1 -1
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +24 -24
- package/dist/prod/locales/{ar-SA-F62BVQMB.js → ar-SA-IYHKZRSE.js} +2 -2
- package/dist/prod/locales/{az-AZ-7PGSKYOB.js → az-AZ-WL5GYRHK.js} +1 -1
- package/dist/prod/locales/{bg-BG-AAEXMUQ4.js → bg-BG-FXZYTRPD.js} +1 -1
- package/dist/prod/locales/{bn-IN-YT3I2M3F.js → bn-BD-KO6YL5G2.js} +1 -1
- package/dist/prod/locales/{bn-BD-ONOFQYIQ.js → bn-IN-PC6JHKYB.js} +1 -1
- package/dist/prod/locales/{ca-ES-GG4YH2FN.js → ca-ES-AREX5NEO.js} +1 -1
- package/dist/prod/locales/{cs-CZ-IS5VTBOP.js → cs-CZ-HXAZMFYH.js} +2 -2
- package/dist/prod/locales/{da-DK-VPQ2KWAY.js → da-DK-5X7ZLFU3.js} +2 -2
- package/dist/prod/locales/{de-DE-RAT2LIDI.js → de-CH-76ZNVSOF.js} +1 -1
- package/dist/prod/locales/{de-CH-G4Y2G6IS.js → de-DE-G3JVZ4MQ.js} +3 -3
- package/dist/prod/locales/{el-GR-DNJB2AZO.js → el-GR-4AZTZGY6.js} +2 -2
- package/dist/prod/locales/{en-FOCNVEEU.js → en-BARVNJLJ.js} +1 -1
- package/dist/prod/locales/es-ES-ART7BI3G.js +7 -0
- package/dist/prod/locales/{eu-ES-XLOS36YS.js → eu-ES-BIF4XBMT.js} +2 -2
- package/dist/prod/locales/{fa-IR-J6Z2YOGX.js → fa-IR-D4HHKAAI.js} +1 -1
- package/dist/prod/locales/{fi-FI-B2IQ7SBP.js → fi-FI-O35ZY7UI.js} +1 -1
- package/dist/prod/locales/{fr-FR-N5BRDCMI.js → fr-FR-XEFNCM4I.js} +3 -3
- package/dist/prod/locales/{gl-ES-BOYALFRN.js → gl-ES-U4NYM3X5.js} +2 -2
- package/dist/prod/locales/{he-IL-H7M7HGY5.js → he-IL-656ABAVQ.js} +1 -1
- package/dist/prod/locales/{hi-IN-7AB5CA2Q.js → hi-IN-Z55GAFFR.js} +2 -2
- package/dist/prod/locales/{hu-HU-ZZM7UJLP.js → hu-HU-UJ62DVIW.js} +1 -1
- package/dist/prod/locales/{id-ID-RZ7JNCXA.js → id-ID-FLZFU3OO.js} +1 -1
- package/dist/prod/locales/it-IT-GIGIGIBJ.js +12 -0
- package/dist/prod/locales/ja-JP-43VXGDWI.js +7 -0
- package/dist/prod/locales/{kaa-QWYSGEM7.js → kaa-L3IMSDYL.js} +1 -1
- package/dist/prod/locales/{kab-KAB-Q3HBKQ5I.js → kab-KAB-XKPWJLNL.js} +2 -2
- package/dist/prod/locales/kk-KZ-SXPDDY2H.js +1 -0
- package/dist/prod/locales/{km-KH-CN6HHF5U.js → km-KH-DOS4CPGC.js} +3 -3
- package/dist/prod/locales/{ko-KR-SJQMUXM7.js → ko-KR-BGC6VCY4.js} +1 -1
- package/dist/prod/locales/{ku-TR-VM4BHTPC.js → ku-TR-J7IUITIA.js} +1 -1
- package/dist/prod/locales/{lt-LT-QIWZQ7AG.js → lt-LT-AC3LV5KG.js} +1 -1
- package/dist/prod/locales/{lv-LV-YQFCB4WZ.js → lv-LV-I6AY7QG2.js} +1 -1
- package/dist/prod/locales/{mr-IN-GR2ZJPSQ.js → mr-IN-5SP4HV5B.js} +2 -2
- package/dist/prod/locales/{my-MM-M5XJDJQ2.js → my-MM-S7ECRBYZ.js} +1 -1
- package/dist/prod/locales/{nb-NO-2RU2YF7H.js → nb-NO-6PNHTF4R.js} +1 -1
- package/dist/prod/locales/nl-NL-R4C4SUIG.js +13 -0
- package/dist/prod/locales/{nn-NO-72RCA552.js → nn-NO-3TFXTM7Y.js} +1 -1
- package/dist/prod/locales/oc-FR-IK6GIE7H.js +4 -0
- package/dist/prod/locales/{pa-IN-WESENMFH.js → pa-IN-YAKHYJET.js} +1 -1
- package/dist/prod/locales/percentages-OL6W367U.js +1 -0
- package/dist/prod/locales/{pl-PL-7C4NGVUA.js → pl-PL-BIY22ZWU.js} +2 -2
- package/dist/prod/locales/{pt-BR-QH23C2IX.js → pt-BR-Q23NUPD6.js} +2 -2
- package/dist/prod/locales/{pt-PT-O5XBATXI.js → pt-PT-LOPEJLPJ.js} +2 -2
- package/dist/prod/locales/{ro-RO-QHCHEGM5.js → ro-RO-W3D2ZATV.js} +2 -2
- package/dist/prod/locales/ru-RU-DCTW7QSH.js +10 -0
- package/dist/prod/locales/{si-LK-JYUINGNN.js → si-LK-FYRRHO3C.js} +1 -1
- package/dist/prod/locales/sk-SK-MC7UOHQO.js +7 -0
- package/dist/prod/locales/{sl-SI-5KPVX4FS.js → sl-SI-L6B6HFY5.js} +2 -2
- package/dist/prod/locales/{sv-SE-MVMXV6O4.js → sv-SE-KMY6L2BA.js} +3 -3
- package/dist/prod/locales/{ta-IN-A32FQB4D.js → ta-IN-ZQCYE2JK.js} +2 -2
- package/dist/prod/locales/{th-TH-CXMWNVBY.js → th-TH-WS7ECBAV.js} +1 -1
- package/dist/prod/locales/{tr-TR-YHFI3W2D.js → tr-TR-S5FI7JRW.js} +2 -2
- package/dist/prod/locales/{uk-UA-UTJIIKT5.js → uk-UA-4EZUWUSQ.js} +3 -3
- package/dist/prod/locales/{uz-UZ-H4EGTR7D.js → uz-UZ-OKHL6AFA.js} +1 -1
- package/dist/prod/locales/{vi-VN-XBV2ESZM.js → vi-VN-K34TWHF7.js} +2 -2
- package/dist/prod/locales/{zh-CN-CKCJ4HAO.js → zh-CN-JE4UZWNO.js} +2 -2
- package/dist/prod/locales/{zh-HK-ISASRRMF.js → zh-HK-RM35YDXX.js} +1 -1
- package/dist/prod/locales/{zh-TW-KYRW5V3R.js → zh-TW-ONGLV6Y5.js} +3 -3
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/bounds.d.ts +10 -0
- package/dist/types/common/src/colors.d.ts +5 -2
- package/dist/types/common/src/constants.d.ts +13 -11
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +1 -0
- package/dist/types/common/src/keys.d.ts +1 -1
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +43 -33
- package/dist/types/common/src/visualdebug.d.ts +1 -1
- package/dist/types/element/src/Scene.d.ts +3 -3
- package/dist/types/element/src/binding.d.ts +6 -4
- package/dist/types/element/src/bounds.d.ts +2 -10
- package/dist/types/element/src/collision.d.ts +2 -2
- package/dist/types/element/src/comparisons.d.ts +7 -7
- package/dist/types/element/src/dragElements.d.ts +3 -3
- package/dist/types/element/src/duplicate.d.ts +3 -3
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +5 -1
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +1 -11
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +1 -2
- package/dist/types/element/src/mutateElement.d.ts +3 -1
- package/dist/types/element/src/newElement.d.ts +6 -6
- package/dist/types/element/src/renderElement.d.ts +0 -6
- package/dist/types/element/src/resizeElements.d.ts +10 -10
- package/dist/types/element/src/resizeTest.d.ts +1 -1
- package/dist/types/element/src/selection.d.ts +3 -7
- package/dist/types/element/src/shape.d.ts +8 -7
- package/dist/types/element/src/textMeasurements.d.ts +1 -3
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
- package/dist/types/element/src/transformHandles.d.ts +3 -23
- package/dist/types/element/src/typeChecks.d.ts +2 -4
- package/dist/types/element/src/utils.d.ts +3 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +62 -126
- package/dist/types/excalidraw/actions/actionAlign.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +44 -87
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +263 -510
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +44 -87
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +21 -43
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +68 -136
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +18 -40
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +45 -88
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionExport.d.ts +85 -170
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -2
- package/dist/types/excalidraw/actions/actionFlip.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionFrame.d.ts +167 -288
- package/dist/types/excalidraw/actions/actionGroup.d.ts +48 -99
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +102 -160
- package/dist/types/excalidraw/actions/actionLink.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionMenu.d.ts +17 -39
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -17
- package/dist/types/excalidraw/actions/actionProperties.d.ts +59 -102
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +24 -50
- package/dist/types/excalidraw/actions/actionStyles.d.ts +20 -42
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -38
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +22 -44
- package/dist/types/excalidraw/actions/actionZindex.d.ts +0 -1
- package/dist/types/excalidraw/actions/manager.d.ts +1 -1
- package/dist/types/excalidraw/actions/register.d.ts +2 -2
- package/dist/types/excalidraw/appState.d.ts +3 -3
- package/dist/types/excalidraw/clipboard.d.ts +7 -31
- package/dist/types/excalidraw/components/Actions.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +33 -41
- package/dist/types/excalidraw/components/ButtonIconCycle.d.ts +1 -1
- package/dist/types/excalidraw/components/Card.d.ts +0 -1
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +7 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +0 -1
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +0 -1
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/InlineIcon.d.ts +2 -2
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -1
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
- package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
- package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +0 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +2 -3
- package/dist/types/excalidraw/components/Toast.d.ts +3 -3
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +28 -32
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +5 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +10 -18
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +0 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +11 -11
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +2 -13
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -2
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +26 -28
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +6 -6
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +15 -16
- package/dist/types/excalidraw/data/blob.d.ts +321 -3
- package/dist/types/excalidraw/data/encode.d.ts +4 -4
- package/dist/types/excalidraw/data/encryption.d.ts +5 -5
- package/dist/types/excalidraw/data/filesystem.d.ts +2 -2
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +159 -2
- package/dist/types/excalidraw/data/library.d.ts +24 -9
- package/dist/types/excalidraw/data/restore.d.ts +25 -10
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- package/dist/types/excalidraw/index.d.ts +2 -4
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -4
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +5 -2
- package/dist/types/excalidraw/scene/export.d.ts +2 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
- package/dist/types/excalidraw/scene/types.d.ts +7 -2
- package/dist/types/excalidraw/snapping.d.ts +5 -5
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/types.d.ts +1 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -2
- package/dist/types/math/src/polygon.d.ts +2 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +3 -3
- package/dist/types/utils/src/bbox.d.ts +1 -1
- package/dist/types/utils/src/export.d.ts +5 -5
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/dist/types/utils/src/withinBounds.d.ts +2 -2
- package/package.json +5 -5
- package/dist/dev/chunk-SJTAY27F.js.map +0 -7
- package/dist/dev/locales/de-DE-YRH6WMM5.js.map +0 -7
- package/dist/dev/locales/el-GR-W7S64QNM.js.map +0 -7
- package/dist/dev/locales/es-ES-7JEN5PTZ.js.map +0 -7
- package/dist/dev/locales/it-IT-AV75ICYT.js.map +0 -7
- package/dist/dev/locales/ja-JP-SS4G3ZXF.js.map +0 -7
- package/dist/dev/locales/kk-KZ-762YODLJ.js.map +0 -7
- package/dist/dev/locales/nl-NL-TF2OVIKN.js.map +0 -7
- package/dist/dev/locales/oc-FR-5JYIFGLE.js.map +0 -7
- package/dist/dev/locales/pt-BR-ERVIQI63.js.map +0 -7
- package/dist/dev/locales/ru-RU-F7LPIMGQ.js.map +0 -7
- package/dist/dev/locales/sk-SK-H6WE7IJX.js.map +0 -7
- package/dist/dev/locales/sv-SE-E5VQLCRE.js.map +0 -7
- package/dist/prod/chunk-KRJFZ5JQ.js +0 -1
- package/dist/prod/chunk-XJNFOLHK.js +0 -4
- package/dist/prod/locales/es-ES-IMTENLBU.js +0 -7
- package/dist/prod/locales/it-IT-ZX7HN56D.js +0 -8
- package/dist/prod/locales/ja-JP-NBNBUHIR.js +0 -7
- package/dist/prod/locales/kk-KZ-HF2NTCRX.js +0 -1
- package/dist/prod/locales/nl-NL-MUHXDQFK.js +0 -7
- package/dist/prod/locales/oc-FR-65ITQYQ2.js +0 -4
- package/dist/prod/locales/percentages-OEPNEGCM.js +0 -1
- package/dist/prod/locales/ru-RU-FUMQ2LLB.js +0 -6
- package/dist/prod/locales/sk-SK-R25O52BS.js +0 -7
- /package/dist/dev/data/{image-S2GFZH7W.js.map → image-Q6JHR7OE.js.map} +0 -0
- /package/dist/dev/locales/{en-ZO6QSABV.js.map → en-MLZIHOCR.js.map} +0 -0
- /package/dist/dev/locales/{percentages-2RAYDWNS.js.map → percentages-OGWD7R2K.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -56,7 +56,6 @@ import {
|
|
|
56
56
|
renderStaticScene,
|
|
57
57
|
renderStaticSceneThrottled,
|
|
58
58
|
resizeImageFile,
|
|
59
|
-
restore,
|
|
60
59
|
restoreAppState,
|
|
61
60
|
restoreElement,
|
|
62
61
|
restoreElements,
|
|
@@ -66,16 +65,16 @@ import {
|
|
|
66
65
|
serializeAsJSON,
|
|
67
66
|
serializeLibraryAsJSON,
|
|
68
67
|
strokeRectWithRotation_simple
|
|
69
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-5A4X24JB.js";
|
|
70
69
|
import {
|
|
71
70
|
define_import_meta_env_default
|
|
72
71
|
} from "./chunk-CP5DND7P.js";
|
|
73
72
|
import {
|
|
74
73
|
en_default
|
|
75
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-OCFTI2BU.js";
|
|
76
75
|
import {
|
|
77
76
|
percentages_default
|
|
78
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-DJHLEOOZ.js";
|
|
79
78
|
import {
|
|
80
79
|
__export,
|
|
81
80
|
__glob,
|
|
@@ -95,7 +94,7 @@ import rough3 from "roughjs/bin/rough";
|
|
|
95
94
|
import { nanoid } from "nanoid";
|
|
96
95
|
import {
|
|
97
96
|
clamp as clamp8,
|
|
98
|
-
pointFrom as
|
|
97
|
+
pointFrom as pointFrom29,
|
|
99
98
|
pointDistance as pointDistance8,
|
|
100
99
|
vector as vector3,
|
|
101
100
|
pointRotateRads as pointRotateRads19,
|
|
@@ -110,7 +109,7 @@ import {
|
|
|
110
109
|
CODES as CODES13,
|
|
111
110
|
shouldResizeFromCenter,
|
|
112
111
|
shouldMaintainAspectRatio,
|
|
113
|
-
shouldRotateWithDiscreteAngle as
|
|
112
|
+
shouldRotateWithDiscreteAngle as shouldRotateWithDiscreteAngle3,
|
|
114
113
|
isArrowKey as isArrowKey2,
|
|
115
114
|
KEYS as KEYS54,
|
|
116
115
|
APP_NAME as APP_NAME2,
|
|
@@ -133,10 +132,9 @@ import {
|
|
|
133
132
|
SCROLL_TIMEOUT,
|
|
134
133
|
TAP_TWICE_TIMEOUT,
|
|
135
134
|
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
|
136
|
-
THEME as
|
|
137
|
-
THEME_FILTER,
|
|
135
|
+
THEME as THEME17,
|
|
138
136
|
TOUCH_CTX_MENU_TIMEOUT,
|
|
139
|
-
VERTICAL_ALIGN as
|
|
137
|
+
VERTICAL_ALIGN as VERTICAL_ALIGN5,
|
|
140
138
|
YOUTUBE_STATES,
|
|
141
139
|
ZOOM_STEP as ZOOM_STEP2,
|
|
142
140
|
POINTER_EVENTS,
|
|
@@ -150,10 +148,10 @@ import {
|
|
|
150
148
|
normalizeLink as normalizeLink3,
|
|
151
149
|
toValidURL as toValidURL2,
|
|
152
150
|
getGridPoint as getGridPoint2,
|
|
153
|
-
getLineHeight as
|
|
151
|
+
getLineHeight as getLineHeight4,
|
|
154
152
|
debounce as debounce4,
|
|
155
153
|
distance as distance2,
|
|
156
|
-
getFontString as
|
|
154
|
+
getFontString as getFontString9,
|
|
157
155
|
getNearestScrollableContainer,
|
|
158
156
|
isInputLike,
|
|
159
157
|
isToolIcon,
|
|
@@ -164,18 +162,19 @@ import {
|
|
|
164
162
|
wrapEvent as wrapEvent2,
|
|
165
163
|
updateObject as updateObject2,
|
|
166
164
|
updateActiveTool as updateActiveTool7,
|
|
167
|
-
isTransparent as
|
|
165
|
+
isTransparent as isTransparent8,
|
|
168
166
|
easeToValuesRAF,
|
|
169
167
|
muteFSAbortError as muteFSAbortError2,
|
|
170
168
|
isTestEnv as isTestEnv5,
|
|
171
|
-
isDevEnv as
|
|
169
|
+
isDevEnv as isDevEnv9,
|
|
172
170
|
easeOut as easeOut4,
|
|
173
171
|
updateStable,
|
|
174
172
|
addEventListener as addEventListener3,
|
|
175
173
|
normalizeEOL as normalizeEOL2,
|
|
176
174
|
getDateTime,
|
|
177
175
|
isShallowEqual as isShallowEqual9,
|
|
178
|
-
arrayToMap as
|
|
176
|
+
arrayToMap as arrayToMap26,
|
|
177
|
+
applyDarkModeFilter as applyDarkModeFilter4,
|
|
179
178
|
randomInteger as randomInteger4,
|
|
180
179
|
CLASSES as CLASSES9,
|
|
181
180
|
Emitter as Emitter3,
|
|
@@ -196,31 +195,31 @@ import {
|
|
|
196
195
|
} from "@excalidraw/common";
|
|
197
196
|
import {
|
|
198
197
|
getObservedAppState,
|
|
199
|
-
getCommonBounds as
|
|
198
|
+
getCommonBounds as getCommonBounds11,
|
|
200
199
|
getElementAbsoluteCoords as getElementAbsoluteCoords8,
|
|
201
200
|
bindOrUnbindBindingElements as bindOrUnbindBindingElements2,
|
|
202
201
|
fixBindingsAfterDeletion as fixBindingsAfterDeletion2,
|
|
203
|
-
getHoveredElementForBinding as
|
|
202
|
+
getHoveredElementForBinding as getHoveredElementForBinding2,
|
|
204
203
|
isBindingEnabled as isBindingEnabled2,
|
|
205
204
|
shouldEnableBindingForPointerEvent,
|
|
206
205
|
updateBoundElements as updateBoundElements3,
|
|
207
|
-
LinearElementEditor as
|
|
206
|
+
LinearElementEditor as LinearElementEditor11,
|
|
208
207
|
newElementWith as newElementWith11,
|
|
209
|
-
newFrameElement as
|
|
208
|
+
newFrameElement as newFrameElement2,
|
|
210
209
|
newFreeDrawElement,
|
|
211
210
|
newEmbeddableElement,
|
|
212
|
-
newMagicFrameElement
|
|
211
|
+
newMagicFrameElement,
|
|
213
212
|
newIframeElement,
|
|
214
|
-
newArrowElement as
|
|
215
|
-
newElement as
|
|
216
|
-
newImageElement
|
|
217
|
-
newLinearElement as
|
|
218
|
-
newTextElement as
|
|
213
|
+
newArrowElement as newArrowElement2,
|
|
214
|
+
newElement as newElement4,
|
|
215
|
+
newImageElement,
|
|
216
|
+
newLinearElement as newLinearElement3,
|
|
217
|
+
newTextElement as newTextElement3,
|
|
219
218
|
refreshTextDimensions,
|
|
220
219
|
deepCopyElement as deepCopyElement5,
|
|
221
220
|
duplicateElements as duplicateElements3,
|
|
222
221
|
hasBoundTextElement as hasBoundTextElement9,
|
|
223
|
-
isArrowElement as
|
|
222
|
+
isArrowElement as isArrowElement13,
|
|
224
223
|
isBindingElement as isBindingElement4,
|
|
225
224
|
isBindingElementType,
|
|
226
225
|
isBoundToContainer as isBoundToContainer9,
|
|
@@ -256,7 +255,7 @@ import {
|
|
|
256
255
|
getContainerCenter,
|
|
257
256
|
getContainerElement as getContainerElement5,
|
|
258
257
|
isValidTextContainer,
|
|
259
|
-
redrawTextBoundingBox as
|
|
258
|
+
redrawTextBoundingBox as redrawTextBoundingBox8,
|
|
260
259
|
hasBoundingBox as hasBoundingBox2,
|
|
261
260
|
getFrameChildren as getFrameChildren6,
|
|
262
261
|
isCursorInFrame,
|
|
@@ -284,8 +283,8 @@ import {
|
|
|
284
283
|
isElementLink as isElementLink2,
|
|
285
284
|
parseElementLinkFromURL,
|
|
286
285
|
isMeasureTextSupported,
|
|
287
|
-
normalizeText as
|
|
288
|
-
measureText as
|
|
286
|
+
normalizeText as normalizeText2,
|
|
287
|
+
measureText as measureText6,
|
|
289
288
|
getLineHeightInPx as getLineHeightInPx2,
|
|
290
289
|
getApproxMinLineWidth,
|
|
291
290
|
getApproxMinLineHeight,
|
|
@@ -299,7 +298,7 @@ import {
|
|
|
299
298
|
isElementInGroup as isElementInGroup2,
|
|
300
299
|
isSelectedViaGroup as isSelectedViaGroup2,
|
|
301
300
|
selectGroupsForSelectedElements as selectGroupsForSelectedElements6,
|
|
302
|
-
syncInvalidIndices
|
|
301
|
+
syncInvalidIndices,
|
|
303
302
|
syncMovedIndices as syncMovedIndices4,
|
|
304
303
|
excludeElementsInFramesFromSelection,
|
|
305
304
|
getSelectionStateForElements as getSelectionStateForElements2,
|
|
@@ -314,7 +313,7 @@ import {
|
|
|
314
313
|
dragSelectedElements,
|
|
315
314
|
getDragOffsetXY,
|
|
316
315
|
isNonDeletedElement,
|
|
317
|
-
Scene
|
|
316
|
+
Scene,
|
|
318
317
|
Store,
|
|
319
318
|
CaptureUpdateAction as CaptureUpdateAction37,
|
|
320
319
|
hitElementBoundingBox as hitElementBoundingBox2,
|
|
@@ -328,7 +327,8 @@ import {
|
|
|
328
327
|
getElementBounds as getElementBounds5,
|
|
329
328
|
doBoundsIntersect as doBoundsIntersect4,
|
|
330
329
|
isPointInElement as isPointInElement3,
|
|
331
|
-
maxBindingDistance_simple as maxBindingDistance_simple2
|
|
330
|
+
maxBindingDistance_simple as maxBindingDistance_simple2,
|
|
331
|
+
convertToExcalidrawElements as convertToExcalidrawElements2
|
|
332
332
|
} from "@excalidraw/element";
|
|
333
333
|
|
|
334
334
|
// actions/actionDeleteSelected.tsx
|
|
@@ -370,64 +370,64 @@ var editorJotaiStore = createStore();
|
|
|
370
370
|
|
|
371
371
|
// import("./locales/**/*.json") in i18n.ts
|
|
372
372
|
var globImport_locales_json = __glob({
|
|
373
|
-
"./locales/ar-SA.json": () => import("./locales/ar-SA-
|
|
374
|
-
"./locales/az-AZ.json": () => import("./locales/az-AZ-
|
|
375
|
-
"./locales/bg-BG.json": () => import("./locales/bg-BG-
|
|
376
|
-
"./locales/bn-BD.json": () => import("./locales/bn-BD-
|
|
377
|
-
"./locales/bn-IN.json": () => import("./locales/bn-IN-
|
|
378
|
-
"./locales/ca-ES.json": () => import("./locales/ca-ES-
|
|
379
|
-
"./locales/cs-CZ.json": () => import("./locales/cs-CZ-
|
|
380
|
-
"./locales/da-DK.json": () => import("./locales/da-DK-
|
|
381
|
-
"./locales/de-CH.json": () => import("./locales/de-CH-
|
|
382
|
-
"./locales/de-DE.json": () => import("./locales/de-DE-
|
|
383
|
-
"./locales/el-GR.json": () => import("./locales/el-GR-
|
|
384
|
-
"./locales/en.json": () => import("./locales/en-
|
|
385
|
-
"./locales/es-ES.json": () => import("./locales/es-ES-
|
|
386
|
-
"./locales/eu-ES.json": () => import("./locales/eu-ES-
|
|
387
|
-
"./locales/fa-IR.json": () => import("./locales/fa-IR-
|
|
388
|
-
"./locales/fi-FI.json": () => import("./locales/fi-FI-
|
|
389
|
-
"./locales/fr-FR.json": () => import("./locales/fr-FR-
|
|
390
|
-
"./locales/gl-ES.json": () => import("./locales/gl-ES-
|
|
391
|
-
"./locales/he-IL.json": () => import("./locales/he-IL-
|
|
392
|
-
"./locales/hi-IN.json": () => import("./locales/hi-IN-
|
|
393
|
-
"./locales/hu-HU.json": () => import("./locales/hu-HU-
|
|
394
|
-
"./locales/id-ID.json": () => import("./locales/id-ID-
|
|
395
|
-
"./locales/it-IT.json": () => import("./locales/it-IT-
|
|
396
|
-
"./locales/ja-JP.json": () => import("./locales/ja-JP-
|
|
397
|
-
"./locales/kaa.json": () => import("./locales/kaa-
|
|
398
|
-
"./locales/kab-KAB.json": () => import("./locales/kab-KAB-
|
|
399
|
-
"./locales/kk-KZ.json": () => import("./locales/kk-KZ-
|
|
400
|
-
"./locales/km-KH.json": () => import("./locales/km-KH-
|
|
401
|
-
"./locales/ko-KR.json": () => import("./locales/ko-KR-
|
|
402
|
-
"./locales/ku-TR.json": () => import("./locales/ku-TR-
|
|
403
|
-
"./locales/lt-LT.json": () => import("./locales/lt-LT-
|
|
404
|
-
"./locales/lv-LV.json": () => import("./locales/lv-LV-
|
|
405
|
-
"./locales/mr-IN.json": () => import("./locales/mr-IN-
|
|
406
|
-
"./locales/my-MM.json": () => import("./locales/my-MM-
|
|
407
|
-
"./locales/nb-NO.json": () => import("./locales/nb-NO-
|
|
408
|
-
"./locales/nl-NL.json": () => import("./locales/nl-NL-
|
|
409
|
-
"./locales/nn-NO.json": () => import("./locales/nn-NO-
|
|
410
|
-
"./locales/oc-FR.json": () => import("./locales/oc-FR-
|
|
411
|
-
"./locales/pa-IN.json": () => import("./locales/pa-IN-
|
|
412
|
-
"./locales/percentages.json": () => import("./locales/percentages-
|
|
413
|
-
"./locales/pl-PL.json": () => import("./locales/pl-PL-
|
|
414
|
-
"./locales/pt-BR.json": () => import("./locales/pt-BR-
|
|
415
|
-
"./locales/pt-PT.json": () => import("./locales/pt-PT-
|
|
416
|
-
"./locales/ro-RO.json": () => import("./locales/ro-RO-
|
|
417
|
-
"./locales/ru-RU.json": () => import("./locales/ru-RU-
|
|
418
|
-
"./locales/si-LK.json": () => import("./locales/si-LK-
|
|
419
|
-
"./locales/sk-SK.json": () => import("./locales/sk-SK-
|
|
420
|
-
"./locales/sl-SI.json": () => import("./locales/sl-SI-
|
|
421
|
-
"./locales/sv-SE.json": () => import("./locales/sv-SE-
|
|
422
|
-
"./locales/ta-IN.json": () => import("./locales/ta-IN-
|
|
423
|
-
"./locales/th-TH.json": () => import("./locales/th-TH-
|
|
424
|
-
"./locales/tr-TR.json": () => import("./locales/tr-TR-
|
|
425
|
-
"./locales/uk-UA.json": () => import("./locales/uk-UA-
|
|
426
|
-
"./locales/uz-UZ.json": () => import("./locales/uz-UZ-
|
|
427
|
-
"./locales/vi-VN.json": () => import("./locales/vi-VN-
|
|
428
|
-
"./locales/zh-CN.json": () => import("./locales/zh-CN-
|
|
429
|
-
"./locales/zh-HK.json": () => import("./locales/zh-HK-
|
|
430
|
-
"./locales/zh-TW.json": () => import("./locales/zh-TW-
|
|
373
|
+
"./locales/ar-SA.json": () => import("./locales/ar-SA-JK5MQ7TT.js"),
|
|
374
|
+
"./locales/az-AZ.json": () => import("./locales/az-AZ-2PAD62G4.js"),
|
|
375
|
+
"./locales/bg-BG.json": () => import("./locales/bg-BG-HUKVYCRK.js"),
|
|
376
|
+
"./locales/bn-BD.json": () => import("./locales/bn-BD-V2CQI46P.js"),
|
|
377
|
+
"./locales/bn-IN.json": () => import("./locales/bn-IN-MBEO4C3J.js"),
|
|
378
|
+
"./locales/ca-ES.json": () => import("./locales/ca-ES-KWEKW4C3.js"),
|
|
379
|
+
"./locales/cs-CZ.json": () => import("./locales/cs-CZ-W5AHZB5H.js"),
|
|
380
|
+
"./locales/da-DK.json": () => import("./locales/da-DK-ITTM6YM4.js"),
|
|
381
|
+
"./locales/de-CH.json": () => import("./locales/de-CH-OAWPDQFJ.js"),
|
|
382
|
+
"./locales/de-DE.json": () => import("./locales/de-DE-ZRDYEPMS.js"),
|
|
383
|
+
"./locales/el-GR.json": () => import("./locales/el-GR-QXASZLPE.js"),
|
|
384
|
+
"./locales/en.json": () => import("./locales/en-MLZIHOCR.js"),
|
|
385
|
+
"./locales/es-ES.json": () => import("./locales/es-ES-VLQBB7FJ.js"),
|
|
386
|
+
"./locales/eu-ES.json": () => import("./locales/eu-ES-TF2DGTZU.js"),
|
|
387
|
+
"./locales/fa-IR.json": () => import("./locales/fa-IR-ITKFQ7QV.js"),
|
|
388
|
+
"./locales/fi-FI.json": () => import("./locales/fi-FI-UWZRVXFI.js"),
|
|
389
|
+
"./locales/fr-FR.json": () => import("./locales/fr-FR-A72LKGCO.js"),
|
|
390
|
+
"./locales/gl-ES.json": () => import("./locales/gl-ES-2QCVIBFP.js"),
|
|
391
|
+
"./locales/he-IL.json": () => import("./locales/he-IL-WJNUHU26.js"),
|
|
392
|
+
"./locales/hi-IN.json": () => import("./locales/hi-IN-XGMO235V.js"),
|
|
393
|
+
"./locales/hu-HU.json": () => import("./locales/hu-HU-37FDQFIS.js"),
|
|
394
|
+
"./locales/id-ID.json": () => import("./locales/id-ID-EJIDCO4E.js"),
|
|
395
|
+
"./locales/it-IT.json": () => import("./locales/it-IT-X34PIOJ2.js"),
|
|
396
|
+
"./locales/ja-JP.json": () => import("./locales/ja-JP-37FC23PR.js"),
|
|
397
|
+
"./locales/kaa.json": () => import("./locales/kaa-7ZYDFVKA.js"),
|
|
398
|
+
"./locales/kab-KAB.json": () => import("./locales/kab-KAB-MILWXBA6.js"),
|
|
399
|
+
"./locales/kk-KZ.json": () => import("./locales/kk-KZ-7BWTPIAV.js"),
|
|
400
|
+
"./locales/km-KH.json": () => import("./locales/km-KH-BV4P2KSZ.js"),
|
|
401
|
+
"./locales/ko-KR.json": () => import("./locales/ko-KR-TSXE5P7B.js"),
|
|
402
|
+
"./locales/ku-TR.json": () => import("./locales/ku-TR-ASSXNN3U.js"),
|
|
403
|
+
"./locales/lt-LT.json": () => import("./locales/lt-LT-G7RZYQQU.js"),
|
|
404
|
+
"./locales/lv-LV.json": () => import("./locales/lv-LV-DXNPBJZU.js"),
|
|
405
|
+
"./locales/mr-IN.json": () => import("./locales/mr-IN-7F2ZCTCF.js"),
|
|
406
|
+
"./locales/my-MM.json": () => import("./locales/my-MM-NBI3KQGW.js"),
|
|
407
|
+
"./locales/nb-NO.json": () => import("./locales/nb-NO-4DCTQT6L.js"),
|
|
408
|
+
"./locales/nl-NL.json": () => import("./locales/nl-NL-XGZJ7V2V.js"),
|
|
409
|
+
"./locales/nn-NO.json": () => import("./locales/nn-NO-FR534JV5.js"),
|
|
410
|
+
"./locales/oc-FR.json": () => import("./locales/oc-FR-YQCIKZIK.js"),
|
|
411
|
+
"./locales/pa-IN.json": () => import("./locales/pa-IN-UM43JGD2.js"),
|
|
412
|
+
"./locales/percentages.json": () => import("./locales/percentages-OGWD7R2K.js"),
|
|
413
|
+
"./locales/pl-PL.json": () => import("./locales/pl-PL-2UGKA6HK.js"),
|
|
414
|
+
"./locales/pt-BR.json": () => import("./locales/pt-BR-H23QFYE3.js"),
|
|
415
|
+
"./locales/pt-PT.json": () => import("./locales/pt-PT-RHKJH5I5.js"),
|
|
416
|
+
"./locales/ro-RO.json": () => import("./locales/ro-RO-IIFONL3T.js"),
|
|
417
|
+
"./locales/ru-RU.json": () => import("./locales/ru-RU-QEP6D7GK.js"),
|
|
418
|
+
"./locales/si-LK.json": () => import("./locales/si-LK-LZYJQLHF.js"),
|
|
419
|
+
"./locales/sk-SK.json": () => import("./locales/sk-SK-RWC6UWGY.js"),
|
|
420
|
+
"./locales/sl-SI.json": () => import("./locales/sl-SI-QJT2CAUO.js"),
|
|
421
|
+
"./locales/sv-SE.json": () => import("./locales/sv-SE-3MAT3NDX.js"),
|
|
422
|
+
"./locales/ta-IN.json": () => import("./locales/ta-IN-J7XOYF2T.js"),
|
|
423
|
+
"./locales/th-TH.json": () => import("./locales/th-TH-2OI52EOQ.js"),
|
|
424
|
+
"./locales/tr-TR.json": () => import("./locales/tr-TR-G7TAUHUI.js"),
|
|
425
|
+
"./locales/uk-UA.json": () => import("./locales/uk-UA-IVSVBJIG.js"),
|
|
426
|
+
"./locales/uz-UZ.json": () => import("./locales/uz-UZ-KCVDUVDE.js"),
|
|
427
|
+
"./locales/vi-VN.json": () => import("./locales/vi-VN-KBZAVWP5.js"),
|
|
428
|
+
"./locales/zh-CN.json": () => import("./locales/zh-CN-IS26RG2D.js"),
|
|
429
|
+
"./locales/zh-HK.json": () => import("./locales/zh-HK-KBWQ6SJC.js"),
|
|
430
|
+
"./locales/zh-TW.json": () => import("./locales/zh-TW-JKJWJQ4J.js")
|
|
431
431
|
});
|
|
432
432
|
|
|
433
433
|
// i18n.ts
|
|
@@ -3550,9 +3550,10 @@ import {
|
|
|
3550
3550
|
arrayToMap as arrayToMap3,
|
|
3551
3551
|
getFontFamilyString as getFontFamilyString2,
|
|
3552
3552
|
getLineHeight,
|
|
3553
|
-
isTransparent as
|
|
3553
|
+
isTransparent as isTransparent3,
|
|
3554
3554
|
reduceToCommonValue,
|
|
3555
|
-
invariant
|
|
3555
|
+
invariant,
|
|
3556
|
+
FONT_SIZES
|
|
3556
3557
|
} from "@excalidraw/common";
|
|
3557
3558
|
import { canBecomePolygon, getNonDeletedElements as getNonDeletedElements4 } from "@excalidraw/element";
|
|
3558
3559
|
import {
|
|
@@ -3682,7 +3683,6 @@ import { useRef as useRef8, useEffect as useEffect9 } from "react";
|
|
|
3682
3683
|
import {
|
|
3683
3684
|
COLOR_OUTLINE_CONTRAST_THRESHOLD as COLOR_OUTLINE_CONTRAST_THRESHOLD2,
|
|
3684
3685
|
COLOR_PALETTE as COLOR_PALETTE2,
|
|
3685
|
-
isTransparent,
|
|
3686
3686
|
isWritableElement
|
|
3687
3687
|
} from "@excalidraw/common";
|
|
3688
3688
|
|
|
@@ -4111,10 +4111,15 @@ var temporarilyDisableTextEditorBlur = (duration = 100) => {
|
|
|
4111
4111
|
// components/ColorPicker/ColorInput.tsx
|
|
4112
4112
|
import clsx7 from "clsx";
|
|
4113
4113
|
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
4114
|
-
import { KEYS as KEYS6 } from "@excalidraw/common";
|
|
4114
|
+
import { isTransparent as isTransparent2, KEYS as KEYS6 } from "@excalidraw/common";
|
|
4115
|
+
import tinycolor2 from "tinycolor2";
|
|
4115
4116
|
|
|
4116
4117
|
// components/ColorPicker/colorPickerUtils.ts
|
|
4117
|
-
import {
|
|
4118
|
+
import {
|
|
4119
|
+
isTransparent,
|
|
4120
|
+
MAX_CUSTOM_COLORS_USED_IN_CANVAS,
|
|
4121
|
+
tinycolor
|
|
4122
|
+
} from "@excalidraw/common";
|
|
4118
4123
|
var getColorNameAndShadeFromColor = ({
|
|
4119
4124
|
palette: palette2,
|
|
4120
4125
|
color
|
|
@@ -4178,36 +4183,33 @@ var isColorDark = (color, threshold = 160) => {
|
|
|
4178
4183
|
if (!color) {
|
|
4179
4184
|
return true;
|
|
4180
4185
|
}
|
|
4181
|
-
if (color
|
|
4186
|
+
if (isTransparent(color)) {
|
|
4182
4187
|
return false;
|
|
4183
4188
|
}
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
node.style.color = color;
|
|
4187
|
-
if (node.style.color) {
|
|
4188
|
-
node.style.position = "absolute";
|
|
4189
|
-
node.style.visibility = "hidden";
|
|
4190
|
-
node.style.width = "0";
|
|
4191
|
-
node.style.height = "0";
|
|
4192
|
-
document.body.appendChild(node);
|
|
4193
|
-
const computedColor = getComputedStyle(node).color;
|
|
4194
|
-
document.body.removeChild(node);
|
|
4195
|
-
const rgb = computedColor.replace(/^(rgb|rgba)\(/, "").replace(/\)$/, "").replace(/\s/g, "").split(",");
|
|
4196
|
-
const r2 = parseInt(rgb[0]);
|
|
4197
|
-
const g2 = parseInt(rgb[1]);
|
|
4198
|
-
const b2 = parseInt(rgb[2]);
|
|
4199
|
-
return calculateContrast(r2, g2, b2) < threshold;
|
|
4200
|
-
}
|
|
4189
|
+
const tc = tinycolor(color);
|
|
4190
|
+
if (!tc.isValid()) {
|
|
4201
4191
|
return true;
|
|
4202
4192
|
}
|
|
4203
|
-
const r =
|
|
4204
|
-
const g = parseInt(color.slice(3, 5), 16);
|
|
4205
|
-
const b = parseInt(color.slice(5, 7), 16);
|
|
4193
|
+
const { r, g, b } = tc.toRgb();
|
|
4206
4194
|
return calculateContrast(r, g, b) < threshold;
|
|
4207
4195
|
};
|
|
4208
4196
|
|
|
4209
4197
|
// components/ColorPicker/ColorInput.tsx
|
|
4210
4198
|
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4199
|
+
var normalizeInputColor = (color) => {
|
|
4200
|
+
color = color.trim();
|
|
4201
|
+
if (isTransparent2(color)) {
|
|
4202
|
+
return color;
|
|
4203
|
+
}
|
|
4204
|
+
const tc = tinycolor2(color);
|
|
4205
|
+
if (tc.isValid()) {
|
|
4206
|
+
if (tc.getFormat() === "hex" && !color.startsWith("#")) {
|
|
4207
|
+
return `#${color}`;
|
|
4208
|
+
}
|
|
4209
|
+
return color;
|
|
4210
|
+
}
|
|
4211
|
+
return null;
|
|
4212
|
+
};
|
|
4211
4213
|
var ColorInput = ({
|
|
4212
4214
|
color,
|
|
4213
4215
|
onChange,
|
|
@@ -4226,7 +4228,7 @@ var ColorInput = ({
|
|
|
4226
4228
|
const changeColor = useCallback2(
|
|
4227
4229
|
(inputValue) => {
|
|
4228
4230
|
const value = inputValue.toLowerCase();
|
|
4229
|
-
const color2 =
|
|
4231
|
+
const color2 = normalizeInputColor(value);
|
|
4230
4232
|
if (color2) {
|
|
4231
4233
|
onChange(color2);
|
|
4232
4234
|
}
|
|
@@ -4937,17 +4939,6 @@ var TopPicks = ({
|
|
|
4937
4939
|
|
|
4938
4940
|
// components/ColorPicker/ColorPicker.tsx
|
|
4939
4941
|
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4940
|
-
var isValidColor = (color) => {
|
|
4941
|
-
const style = new Option().style;
|
|
4942
|
-
style.color = color;
|
|
4943
|
-
return !!style.color;
|
|
4944
|
-
};
|
|
4945
|
-
var getColor = (color) => {
|
|
4946
|
-
if (isTransparent(color)) {
|
|
4947
|
-
return color;
|
|
4948
|
-
}
|
|
4949
|
-
return isValidColor(`#${color}`) ? `#${color}` : isValidColor(color) ? color : null;
|
|
4950
|
-
};
|
|
4951
4942
|
var ColorPickerPopupContent = ({
|
|
4952
4943
|
type,
|
|
4953
4944
|
color,
|
|
@@ -6212,20 +6203,20 @@ var changeFontSize = (elements, appState, app, getNewFontSize, fallbackValue) =>
|
|
|
6212
6203
|
if (isTextElement2(oldElement)) {
|
|
6213
6204
|
const newFontSize = getNewFontSize(oldElement);
|
|
6214
6205
|
newFontSizes.add(newFontSize);
|
|
6215
|
-
let
|
|
6206
|
+
let newElement5 = newElementWith2(oldElement, {
|
|
6216
6207
|
fontSize: newFontSize
|
|
6217
6208
|
});
|
|
6218
6209
|
redrawTextBoundingBox(
|
|
6219
|
-
|
|
6210
|
+
newElement5,
|
|
6220
6211
|
app.scene.getContainerElement(oldElement),
|
|
6221
6212
|
app.scene
|
|
6222
6213
|
);
|
|
6223
|
-
|
|
6214
|
+
newElement5 = offsetElementAfterFontResize(
|
|
6224
6215
|
oldElement,
|
|
6225
|
-
|
|
6216
|
+
newElement5,
|
|
6226
6217
|
app.scene
|
|
6227
6218
|
);
|
|
6228
|
-
return
|
|
6219
|
+
return newElement5;
|
|
6229
6220
|
}
|
|
6230
6221
|
return oldElement;
|
|
6231
6222
|
},
|
|
@@ -6317,7 +6308,7 @@ var actionChangeBackgroundColor = register({
|
|
|
6317
6308
|
}
|
|
6318
6309
|
let nextElements;
|
|
6319
6310
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
6320
|
-
const shouldEnablePolygon = !
|
|
6311
|
+
const shouldEnablePolygon = !isTransparent3(value.currentItemBackgroundColor) && selectedElements.every(
|
|
6321
6312
|
(el) => isLineElement(el) && canBecomePolygon(el.points)
|
|
6322
6313
|
);
|
|
6323
6314
|
if (shouldEnablePolygon) {
|
|
@@ -6651,25 +6642,25 @@ var actionChangeFontSize = register(
|
|
|
6651
6642
|
group: "font-size",
|
|
6652
6643
|
options: [
|
|
6653
6644
|
{
|
|
6654
|
-
value:
|
|
6645
|
+
value: FONT_SIZES.sm,
|
|
6655
6646
|
text: t("labels.small"),
|
|
6656
6647
|
icon: FontSizeSmallIcon,
|
|
6657
6648
|
testId: "fontSize-small"
|
|
6658
6649
|
},
|
|
6659
6650
|
{
|
|
6660
|
-
value:
|
|
6651
|
+
value: FONT_SIZES.md,
|
|
6661
6652
|
text: t("labels.medium"),
|
|
6662
6653
|
icon: FontSizeMediumIcon,
|
|
6663
6654
|
testId: "fontSize-medium"
|
|
6664
6655
|
},
|
|
6665
6656
|
{
|
|
6666
|
-
value:
|
|
6657
|
+
value: FONT_SIZES.lg,
|
|
6667
6658
|
text: t("labels.large"),
|
|
6668
6659
|
icon: FontSizeLargeIcon,
|
|
6669
6660
|
testId: "fontSize-large"
|
|
6670
6661
|
},
|
|
6671
6662
|
{
|
|
6672
|
-
value:
|
|
6663
|
+
value: FONT_SIZES.xl,
|
|
6673
6664
|
text: t("labels.veryLarge"),
|
|
6674
6665
|
icon: FontSizeExtraLargeIcon,
|
|
6675
6666
|
testId: "fontSize-veryLarge"
|
|
@@ -6764,10 +6755,10 @@ var actionChangeFontFamily = register({
|
|
|
6764
6755
|
(element) => {
|
|
6765
6756
|
const cachedElement = cachedElements?.get(element.id);
|
|
6766
6757
|
if (cachedElement) {
|
|
6767
|
-
const
|
|
6758
|
+
const newElement5 = newElementWith2(element, {
|
|
6768
6759
|
...cachedElement
|
|
6769
6760
|
});
|
|
6770
|
-
return
|
|
6761
|
+
return newElement5;
|
|
6771
6762
|
}
|
|
6772
6763
|
return element;
|
|
6773
6764
|
},
|
|
@@ -6835,7 +6826,7 @@ var actionChangeFontFamily = register({
|
|
|
6835
6826
|
appState,
|
|
6836
6827
|
(oldElement) => {
|
|
6837
6828
|
if (isTextElement2(oldElement) && (oldElement.fontFamily !== nextFontFamily || currentItemFontFamily)) {
|
|
6838
|
-
const
|
|
6829
|
+
const newElement5 = newElementWith2(
|
|
6839
6830
|
oldElement,
|
|
6840
6831
|
{
|
|
6841
6832
|
fontFamily: nextFontFamily,
|
|
@@ -6850,11 +6841,11 @@ var actionChangeFontFamily = register({
|
|
|
6850
6841
|
if (!skipFontFaceCheck) {
|
|
6851
6842
|
uniqueChars = /* @__PURE__ */ new Set([
|
|
6852
6843
|
...uniqueChars,
|
|
6853
|
-
...Array.from(
|
|
6844
|
+
...Array.from(newElement5.originalText)
|
|
6854
6845
|
]);
|
|
6855
6846
|
}
|
|
6856
|
-
elementContainerMapping.set(
|
|
6857
|
-
return
|
|
6847
|
+
elementContainerMapping.set(newElement5, container);
|
|
6848
|
+
return newElement5;
|
|
6858
6849
|
}
|
|
6859
6850
|
return oldElement;
|
|
6860
6851
|
},
|
|
@@ -7040,16 +7031,16 @@ var actionChangeTextAlign = register({
|
|
|
7040
7031
|
appState,
|
|
7041
7032
|
(oldElement) => {
|
|
7042
7033
|
if (isTextElement2(oldElement)) {
|
|
7043
|
-
const
|
|
7034
|
+
const newElement5 = newElementWith2(
|
|
7044
7035
|
oldElement,
|
|
7045
7036
|
{ textAlign: value }
|
|
7046
7037
|
);
|
|
7047
7038
|
redrawTextBoundingBox(
|
|
7048
|
-
|
|
7039
|
+
newElement5,
|
|
7049
7040
|
app.scene.getContainerElement(oldElement),
|
|
7050
7041
|
app.scene
|
|
7051
7042
|
);
|
|
7052
|
-
return
|
|
7043
|
+
return newElement5;
|
|
7053
7044
|
}
|
|
7054
7045
|
return oldElement;
|
|
7055
7046
|
},
|
|
@@ -7134,16 +7125,16 @@ var actionChangeVerticalAlign = register({
|
|
|
7134
7125
|
appState,
|
|
7135
7126
|
(oldElement) => {
|
|
7136
7127
|
if (isTextElement2(oldElement)) {
|
|
7137
|
-
const
|
|
7128
|
+
const newElement5 = newElementWith2(
|
|
7138
7129
|
oldElement,
|
|
7139
7130
|
{ verticalAlign: value }
|
|
7140
7131
|
);
|
|
7141
7132
|
redrawTextBoundingBox(
|
|
7142
|
-
|
|
7133
|
+
newElement5,
|
|
7143
7134
|
app.scene.getContainerElement(oldElement),
|
|
7144
7135
|
app.scene
|
|
7145
7136
|
);
|
|
7146
|
-
return
|
|
7137
|
+
return newElement5;
|
|
7147
7138
|
}
|
|
7148
7139
|
return oldElement;
|
|
7149
7140
|
},
|
|
@@ -7463,7 +7454,7 @@ var actionChangeArrowType = register({
|
|
|
7463
7454
|
-1,
|
|
7464
7455
|
elementsMap
|
|
7465
7456
|
);
|
|
7466
|
-
let
|
|
7457
|
+
let newElement5 = newElementWith2(el, {
|
|
7467
7458
|
x: value === ARROW_TYPE.elbow ? startPoint[0] : el.x,
|
|
7468
7459
|
y: value === ARROW_TYPE.elbow ? startPoint[1] : el.y,
|
|
7469
7460
|
roundness: value === ARROW_TYPE.round ? {
|
|
@@ -7494,53 +7485,53 @@ var actionChangeArrowType = register({
|
|
|
7494
7485
|
)
|
|
7495
7486
|
] : el.points
|
|
7496
7487
|
});
|
|
7497
|
-
if (isElbowArrow2(
|
|
7498
|
-
|
|
7488
|
+
if (isElbowArrow2(newElement5)) {
|
|
7489
|
+
newElement5.fixedSegments = null;
|
|
7499
7490
|
const elementsMap2 = app.scene.getNonDeletedElementsMap();
|
|
7500
7491
|
app.dismissLinearEditor();
|
|
7501
7492
|
const startGlobalPoint = LinearElementEditor4.getPointAtIndexGlobalCoordinates(
|
|
7502
|
-
|
|
7493
|
+
newElement5,
|
|
7503
7494
|
0,
|
|
7504
7495
|
elementsMap2
|
|
7505
7496
|
);
|
|
7506
7497
|
const endGlobalPoint = LinearElementEditor4.getPointAtIndexGlobalCoordinates(
|
|
7507
|
-
|
|
7498
|
+
newElement5,
|
|
7508
7499
|
-1,
|
|
7509
7500
|
elementsMap2
|
|
7510
7501
|
);
|
|
7511
|
-
const startElement =
|
|
7512
|
-
|
|
7502
|
+
const startElement = newElement5.startBinding && elementsMap2.get(
|
|
7503
|
+
newElement5.startBinding.elementId
|
|
7513
7504
|
);
|
|
7514
|
-
const endElement =
|
|
7515
|
-
|
|
7505
|
+
const endElement = newElement5.endBinding && elementsMap2.get(
|
|
7506
|
+
newElement5.endBinding.elementId
|
|
7516
7507
|
);
|
|
7517
|
-
const startBinding = startElement &&
|
|
7508
|
+
const startBinding = startElement && newElement5.startBinding ? {
|
|
7518
7509
|
// @ts-ignore TS cannot discern check above
|
|
7519
|
-
...
|
|
7510
|
+
...newElement5.startBinding,
|
|
7520
7511
|
...calculateFixedPointForElbowArrowBinding(
|
|
7521
|
-
|
|
7512
|
+
newElement5,
|
|
7522
7513
|
startElement,
|
|
7523
7514
|
"start",
|
|
7524
7515
|
elementsMap2
|
|
7525
7516
|
)
|
|
7526
7517
|
} : null;
|
|
7527
|
-
const endBinding = endElement &&
|
|
7518
|
+
const endBinding = endElement && newElement5.endBinding ? {
|
|
7528
7519
|
// @ts-ignore TS cannot discern check above
|
|
7529
|
-
...
|
|
7520
|
+
...newElement5.endBinding,
|
|
7530
7521
|
...calculateFixedPointForElbowArrowBinding(
|
|
7531
|
-
|
|
7522
|
+
newElement5,
|
|
7532
7523
|
endElement,
|
|
7533
7524
|
"end",
|
|
7534
7525
|
elementsMap2
|
|
7535
7526
|
)
|
|
7536
7527
|
} : null;
|
|
7537
|
-
|
|
7538
|
-
...
|
|
7528
|
+
newElement5 = {
|
|
7529
|
+
...newElement5,
|
|
7539
7530
|
startBinding,
|
|
7540
7531
|
endBinding,
|
|
7541
|
-
...updateElbowArrowPoints(
|
|
7532
|
+
...updateElbowArrowPoints(newElement5, elementsMap2, {
|
|
7542
7533
|
points: [startGlobalPoint, endGlobalPoint].map(
|
|
7543
|
-
(p) => pointFrom(p[0] -
|
|
7534
|
+
(p) => pointFrom(p[0] - newElement5.x, p[1] - newElement5.y)
|
|
7544
7535
|
),
|
|
7545
7536
|
startBinding,
|
|
7546
7537
|
endBinding,
|
|
@@ -7549,13 +7540,13 @@ var actionChangeArrowType = register({
|
|
|
7549
7540
|
};
|
|
7550
7541
|
} else {
|
|
7551
7542
|
const elementsMap2 = app.scene.getNonDeletedElementsMap();
|
|
7552
|
-
if (
|
|
7543
|
+
if (newElement5.startBinding) {
|
|
7553
7544
|
const startElement = elementsMap2.get(
|
|
7554
|
-
|
|
7545
|
+
newElement5.startBinding.elementId
|
|
7555
7546
|
);
|
|
7556
7547
|
if (startElement) {
|
|
7557
7548
|
bindBindingElement(
|
|
7558
|
-
|
|
7549
|
+
newElement5,
|
|
7559
7550
|
startElement,
|
|
7560
7551
|
appState.bindMode === "inside" ? "inside" : "orbit",
|
|
7561
7552
|
"start",
|
|
@@ -7563,13 +7554,13 @@ var actionChangeArrowType = register({
|
|
|
7563
7554
|
);
|
|
7564
7555
|
}
|
|
7565
7556
|
}
|
|
7566
|
-
if (
|
|
7557
|
+
if (newElement5.endBinding) {
|
|
7567
7558
|
const endElement = elementsMap2.get(
|
|
7568
|
-
|
|
7559
|
+
newElement5.endBinding.elementId
|
|
7569
7560
|
);
|
|
7570
7561
|
if (endElement) {
|
|
7571
7562
|
bindBindingElement(
|
|
7572
|
-
|
|
7563
|
+
newElement5,
|
|
7573
7564
|
endElement,
|
|
7574
7565
|
appState.bindMode === "inside" ? "inside" : "orbit",
|
|
7575
7566
|
"end",
|
|
@@ -7578,7 +7569,7 @@ var actionChangeArrowType = register({
|
|
|
7578
7569
|
}
|
|
7579
7570
|
}
|
|
7580
7571
|
}
|
|
7581
|
-
return
|
|
7572
|
+
return newElement5;
|
|
7582
7573
|
});
|
|
7583
7574
|
const newState = {
|
|
7584
7575
|
...appState,
|
|
@@ -8349,6 +8340,7 @@ import {
|
|
|
8349
8340
|
KEYS as KEYS13,
|
|
8350
8341
|
arrayToMap as arrayToMap4,
|
|
8351
8342
|
invariant as invariant2,
|
|
8343
|
+
shouldRotateWithDiscreteAngle,
|
|
8352
8344
|
updateActiveTool as updateActiveTool4
|
|
8353
8345
|
} from "@excalidraw/common";
|
|
8354
8346
|
import { isPathALoop } from "@excalidraw/element";
|
|
@@ -8396,10 +8388,19 @@ var actionFinalize = register({
|
|
|
8396
8388
|
});
|
|
8397
8389
|
return map;
|
|
8398
8390
|
}, /* @__PURE__ */ new Map()) ?? /* @__PURE__ */ new Map();
|
|
8399
|
-
bindOrUnbindBindingElement(
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8391
|
+
bindOrUnbindBindingElement(
|
|
8392
|
+
element2,
|
|
8393
|
+
draggedPoints,
|
|
8394
|
+
sceneCoords.x,
|
|
8395
|
+
sceneCoords.y,
|
|
8396
|
+
scene,
|
|
8397
|
+
appState,
|
|
8398
|
+
{
|
|
8399
|
+
newArrow,
|
|
8400
|
+
altKey: event.altKey,
|
|
8401
|
+
angleLocked: shouldRotateWithDiscreteAngle(event)
|
|
8402
|
+
}
|
|
8403
|
+
);
|
|
8403
8404
|
} else if (isLineElement2(element2)) {
|
|
8404
8405
|
if (appState.selectedLinearElement?.isEditing && !appState.newElement && !isValidPolygon(element2.points)) {
|
|
8405
8406
|
scene.mutateElement(element2, {
|
|
@@ -8731,7 +8732,8 @@ import {
|
|
|
8731
8732
|
DEFAULT_FONT_SIZE as DEFAULT_FONT_SIZE2,
|
|
8732
8733
|
VERTICAL_ALIGN as VERTICAL_ALIGN2,
|
|
8733
8734
|
randomId,
|
|
8734
|
-
isDevEnv as isDevEnv3
|
|
8735
|
+
isDevEnv as isDevEnv3,
|
|
8736
|
+
FONT_SIZES as FONT_SIZES2
|
|
8735
8737
|
} from "@excalidraw/common";
|
|
8736
8738
|
import {
|
|
8737
8739
|
newTextElement,
|
|
@@ -8863,7 +8865,7 @@ var chartXLabels = (spreadsheet, x, y, groupId, backgroundColor) => {
|
|
|
8863
8865
|
y: y + BAR_GAP / 2,
|
|
8864
8866
|
width: BAR_WIDTH,
|
|
8865
8867
|
angle: 5.87,
|
|
8866
|
-
fontSize:
|
|
8868
|
+
fontSize: FONT_SIZES2.sm,
|
|
8867
8869
|
textAlign: "center",
|
|
8868
8870
|
verticalAlign: "top"
|
|
8869
8871
|
});
|
|
@@ -9098,7 +9100,6 @@ var createPasteEvent = ({
|
|
|
9098
9100
|
if (typeof value !== "string") {
|
|
9099
9101
|
files = files || [];
|
|
9100
9102
|
files.push(value);
|
|
9101
|
-
event.clipboardData?.items.add(value);
|
|
9102
9103
|
continue;
|
|
9103
9104
|
}
|
|
9104
9105
|
try {
|
|
@@ -9556,7 +9557,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
9556
9557
|
let blob = canvasToBlob(tempCanvas);
|
|
9557
9558
|
if (appState.exportEmbedScene) {
|
|
9558
9559
|
blob = blob.then(
|
|
9559
|
-
(blob2) => import("./data/image-
|
|
9560
|
+
(blob2) => import("./data/image-Q6JHR7OE.js").then(
|
|
9560
9561
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
9561
9562
|
blob: blob2,
|
|
9562
9563
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -9968,7 +9969,7 @@ var actionPasteStyles = register({
|
|
|
9968
9969
|
if (!elementStylesToCopyFrom) {
|
|
9969
9970
|
return element;
|
|
9970
9971
|
}
|
|
9971
|
-
let
|
|
9972
|
+
let newElement5 = newElementWith5(element, {
|
|
9972
9973
|
backgroundColor: elementStylesToCopyFrom?.backgroundColor,
|
|
9973
9974
|
strokeWidth: elementStylesToCopyFrom?.strokeWidth,
|
|
9974
9975
|
strokeColor: elementStylesToCopyFrom?.strokeColor,
|
|
@@ -9981,36 +9982,36 @@ var actionPasteStyles = register({
|
|
|
9981
9982
|
element
|
|
9982
9983
|
) ? elementStylesToCopyFrom.roundness : getDefaultRoundnessTypeForElement(element) : null
|
|
9983
9984
|
});
|
|
9984
|
-
if (isTextElement3(
|
|
9985
|
+
if (isTextElement3(newElement5)) {
|
|
9985
9986
|
const fontSize = elementStylesToCopyFrom.fontSize || DEFAULT_FONT_SIZE3;
|
|
9986
9987
|
const fontFamily = elementStylesToCopyFrom.fontFamily || DEFAULT_FONT_FAMILY3;
|
|
9987
|
-
|
|
9988
|
+
newElement5 = newElementWith5(newElement5, {
|
|
9988
9989
|
fontSize,
|
|
9989
9990
|
fontFamily,
|
|
9990
9991
|
textAlign: elementStylesToCopyFrom.textAlign || DEFAULT_TEXT_ALIGN,
|
|
9991
9992
|
lineHeight: elementStylesToCopyFrom.lineHeight || getLineHeight2(fontFamily)
|
|
9992
9993
|
});
|
|
9993
9994
|
let container = null;
|
|
9994
|
-
if (
|
|
9995
|
+
if (newElement5.containerId) {
|
|
9995
9996
|
container = selectedElements.find(
|
|
9996
|
-
(element2) => isTextElement3(
|
|
9997
|
+
(element2) => isTextElement3(newElement5) && element2.id === newElement5.containerId
|
|
9997
9998
|
) || null;
|
|
9998
9999
|
}
|
|
9999
|
-
redrawTextBoundingBox2(
|
|
10000
|
+
redrawTextBoundingBox2(newElement5, container, app.scene);
|
|
10000
10001
|
}
|
|
10001
|
-
if (
|
|
10002
|
-
|
|
10002
|
+
if (newElement5.type === "arrow" && isArrowElement2(elementStylesToCopyFrom)) {
|
|
10003
|
+
newElement5 = newElementWith5(newElement5, {
|
|
10003
10004
|
startArrowhead: elementStylesToCopyFrom.startArrowhead,
|
|
10004
10005
|
endArrowhead: elementStylesToCopyFrom.endArrowhead
|
|
10005
10006
|
});
|
|
10006
10007
|
}
|
|
10007
10008
|
if (isFrameLikeElement4(element)) {
|
|
10008
|
-
|
|
10009
|
+
newElement5 = newElementWith5(newElement5, {
|
|
10009
10010
|
roundness: null,
|
|
10010
10011
|
backgroundColor: "transparent"
|
|
10011
10012
|
});
|
|
10012
10013
|
}
|
|
10013
|
-
return
|
|
10014
|
+
return newElement5;
|
|
10014
10015
|
}
|
|
10015
10016
|
return element;
|
|
10016
10017
|
}),
|
|
@@ -13412,12 +13413,10 @@ var exportToCanvas2 = ({
|
|
|
13412
13413
|
exportPadding,
|
|
13413
13414
|
exportingFrame
|
|
13414
13415
|
}) => {
|
|
13415
|
-
const
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
{ deleteInvisibleElements: true }
|
|
13420
|
-
);
|
|
13416
|
+
const restoredElements = restoreElements(elements, null, {
|
|
13417
|
+
deleteInvisibleElements: true
|
|
13418
|
+
});
|
|
13419
|
+
const restoredAppState = restoreAppState(appState, null);
|
|
13421
13420
|
const { exportBackground, viewBackgroundColor } = restoredAppState;
|
|
13422
13421
|
return exportToCanvas(
|
|
13423
13422
|
restoredElements,
|
|
@@ -13507,12 +13506,10 @@ var exportToSvg2 = async ({
|
|
|
13507
13506
|
skipInliningFonts,
|
|
13508
13507
|
reuseImages
|
|
13509
13508
|
}) => {
|
|
13510
|
-
const
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
{ deleteInvisibleElements: true }
|
|
13515
|
-
);
|
|
13509
|
+
const restoredElements = restoreElements(elements, null, {
|
|
13510
|
+
deleteInvisibleElements: true
|
|
13511
|
+
});
|
|
13512
|
+
const restoredAppState = restoreAppState(appState, null);
|
|
13516
13513
|
const exportAppState = {
|
|
13517
13514
|
...restoredAppState,
|
|
13518
13515
|
exportPadding
|
|
@@ -16506,7 +16503,7 @@ import {
|
|
|
16506
16503
|
CLASSES as CLASSES3,
|
|
16507
16504
|
KEYS as KEYS36,
|
|
16508
16505
|
capitalizeString as capitalizeString2,
|
|
16509
|
-
isTransparent as
|
|
16506
|
+
isTransparent as isTransparent4
|
|
16510
16507
|
} from "@excalidraw/common";
|
|
16511
16508
|
import {
|
|
16512
16509
|
shouldAllowVerticalAlign,
|
|
@@ -16698,8 +16695,8 @@ var SelectedShapeActions = ({
|
|
|
16698
16695
|
);
|
|
16699
16696
|
const editorInterface = useEditorInterface();
|
|
16700
16697
|
const isRTL2 = document.documentElement.getAttribute("dir") === "rtl";
|
|
16701
|
-
const showFillIcons = hasBackground(appState.activeTool.type) && !
|
|
16702
|
-
(element) => hasBackground(element.type) && !
|
|
16698
|
+
const showFillIcons = hasBackground(appState.activeTool.type) && !isTransparent4(appState.currentItemBackgroundColor) || targetElements.some(
|
|
16699
|
+
(element) => hasBackground(element.type) && !isTransparent4(element.backgroundColor)
|
|
16703
16700
|
);
|
|
16704
16701
|
const showLinkIcon = targetElements.length === 1 || isSingleElementBoundContainer;
|
|
16705
16702
|
const showLineEditorAction = !appState.selectedLinearElement?.isEditing && targetElements.length === 1 && isLinearElement5(targetElements[0]) && !isElbowArrow5(targetElements[0]);
|
|
@@ -16788,8 +16785,8 @@ var CombinedShapeProperties = ({
|
|
|
16788
16785
|
targetElements,
|
|
16789
16786
|
container
|
|
16790
16787
|
}) => {
|
|
16791
|
-
const showFillIcons = hasBackground(appState.activeTool.type) && !
|
|
16792
|
-
(element) => hasBackground(element.type) && !
|
|
16788
|
+
const showFillIcons = hasBackground(appState.activeTool.type) && !isTransparent4(appState.currentItemBackgroundColor) || targetElements.some(
|
|
16789
|
+
(element) => hasBackground(element.type) && !isTransparent4(element.backgroundColor)
|
|
16793
16790
|
);
|
|
16794
16791
|
const shouldShowCombinedProperties = targetElements.length > 0 || appState.activeTool.type !== "selection" && appState.activeTool.type !== "eraser" && appState.activeTool.type !== "hand" && appState.activeTool.type !== "laser" && appState.activeTool.type !== "lasso";
|
|
16795
16792
|
const isOpen = appState.openPopup === "compactStrokeStyles";
|
|
@@ -18431,6 +18428,7 @@ import {
|
|
|
18431
18428
|
|
|
18432
18429
|
// ../element/src/shape.ts
|
|
18433
18430
|
import { simplify } from "points-on-curve";
|
|
18431
|
+
import { getStroke } from "perfect-freehand";
|
|
18434
18432
|
|
|
18435
18433
|
// ../utils/src/shape.ts
|
|
18436
18434
|
import { pointsOnBezierCurves } from "points-on-curve";
|
|
@@ -18473,16 +18471,17 @@ import {
|
|
|
18473
18471
|
} from "@excalidraw/math";
|
|
18474
18472
|
import {
|
|
18475
18473
|
ROUGHNESS,
|
|
18476
|
-
|
|
18474
|
+
THEME as THEME10,
|
|
18475
|
+
isTransparent as isTransparent7,
|
|
18477
18476
|
assertNever as assertNever3,
|
|
18478
18477
|
COLOR_PALETTE as COLOR_PALETTE5,
|
|
18479
|
-
LINE_POLYGON_POINT_MERGE_DISTANCE
|
|
18478
|
+
LINE_POLYGON_POINT_MERGE_DISTANCE,
|
|
18479
|
+
applyDarkModeFilter as applyDarkModeFilter2
|
|
18480
18480
|
} from "@excalidraw/common";
|
|
18481
18481
|
import { RoughGenerator } from "roughjs/bin/generator";
|
|
18482
18482
|
|
|
18483
18483
|
// ../element/src/renderElement.ts
|
|
18484
18484
|
import rough2 from "roughjs/bin/rough";
|
|
18485
|
-
import { getStroke } from "perfect-freehand";
|
|
18486
18485
|
import {
|
|
18487
18486
|
isRightAngleRads,
|
|
18488
18487
|
lineSegment as lineSegment7,
|
|
@@ -18500,7 +18499,8 @@ import {
|
|
|
18500
18499
|
getFontString as getFontString5,
|
|
18501
18500
|
isRTL,
|
|
18502
18501
|
getVerticalOffset,
|
|
18503
|
-
invariant as invariant13
|
|
18502
|
+
invariant as invariant13,
|
|
18503
|
+
applyDarkModeFilter
|
|
18504
18504
|
} from "@excalidraw/common";
|
|
18505
18505
|
|
|
18506
18506
|
// ../element/src/bounds.ts
|
|
@@ -18536,7 +18536,7 @@ import {
|
|
|
18536
18536
|
import {
|
|
18537
18537
|
DRAGGING_THRESHOLD,
|
|
18538
18538
|
KEYS as KEYS39,
|
|
18539
|
-
shouldRotateWithDiscreteAngle,
|
|
18539
|
+
shouldRotateWithDiscreteAngle as shouldRotateWithDiscreteAngle2,
|
|
18540
18540
|
getGridPoint,
|
|
18541
18541
|
invariant as invariant11,
|
|
18542
18542
|
isShallowEqual as isShallowEqual2,
|
|
@@ -18544,7 +18544,6 @@ import {
|
|
|
18544
18544
|
} from "@excalidraw/common";
|
|
18545
18545
|
import {
|
|
18546
18546
|
deconstructLinearOrFreeDrawElement as deconstructLinearOrFreeDrawElement2,
|
|
18547
|
-
getHoveredElementForBinding as getHoveredElementForBinding2,
|
|
18548
18547
|
isPathALoop as isPathALoop3,
|
|
18549
18548
|
moveArrowAboveBindable,
|
|
18550
18549
|
projectFixedPointOntoDiagonal as projectFixedPointOntoDiagonal2
|
|
@@ -18556,7 +18555,7 @@ import {
|
|
|
18556
18555
|
arrayToMap as arrayToMap15,
|
|
18557
18556
|
getFeatureFlag,
|
|
18558
18557
|
invariant as invariant10,
|
|
18559
|
-
isTransparent as
|
|
18558
|
+
isTransparent as isTransparent6
|
|
18560
18559
|
} from "@excalidraw/common";
|
|
18561
18560
|
import {
|
|
18562
18561
|
PRECISION as PRECISION2,
|
|
@@ -18573,7 +18572,7 @@ import {
|
|
|
18573
18572
|
} from "@excalidraw/math";
|
|
18574
18573
|
|
|
18575
18574
|
// ../element/src/collision.ts
|
|
18576
|
-
import { invariant as invariant7, isTransparent as
|
|
18575
|
+
import { invariant as invariant7, isTransparent as isTransparent5 } from "@excalidraw/common";
|
|
18577
18576
|
import {
|
|
18578
18577
|
curveIntersectLineSegment,
|
|
18579
18578
|
isPointWithinBounds,
|
|
@@ -18713,7 +18712,11 @@ import {
|
|
|
18713
18712
|
import { ellipse, ellipseDistanceFromPoint } from "@excalidraw/math/ellipse";
|
|
18714
18713
|
|
|
18715
18714
|
// ../element/src/heading.ts
|
|
18716
|
-
import {
|
|
18715
|
+
import {
|
|
18716
|
+
invariant as invariant8,
|
|
18717
|
+
isDevEnv as isDevEnv5,
|
|
18718
|
+
isTestEnv as isTestEnv3
|
|
18719
|
+
} from "@excalidraw/common";
|
|
18717
18720
|
import {
|
|
18718
18721
|
pointFrom as pointFrom10,
|
|
18719
18722
|
pointFromVector as pointFromVector4,
|
|
@@ -19247,51 +19250,6 @@ IMAGE_ERROR_PLACEHOLDER_IMG.src = `data:${MIME_TYPES7.svg},${encodeURIComponent(
|
|
|
19247
19250
|
`<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>`
|
|
19248
19251
|
)}`;
|
|
19249
19252
|
var elementWithCanvasCache = /* @__PURE__ */ new WeakMap();
|
|
19250
|
-
var pathsCache = /* @__PURE__ */ new WeakMap([]);
|
|
19251
|
-
function generateFreeDrawShape(element) {
|
|
19252
|
-
const svgPathData = getFreeDrawSvgPath(element);
|
|
19253
|
-
const path = new Path2D(svgPathData);
|
|
19254
|
-
pathsCache.set(element, path);
|
|
19255
|
-
return path;
|
|
19256
|
-
}
|
|
19257
|
-
function getFreeDrawSvgPath(element) {
|
|
19258
|
-
return getSvgPathFromStroke(getFreedrawOutlinePoints(element));
|
|
19259
|
-
}
|
|
19260
|
-
function getFreedrawOutlinePoints(element) {
|
|
19261
|
-
const inputPoints = element.simulatePressure ? element.points : element.points.length ? element.points.map(([x, y], i) => [x, y, element.pressures[i]]) : [[0, 0, 0.5]];
|
|
19262
|
-
const options = {
|
|
19263
|
-
simulatePressure: element.simulatePressure,
|
|
19264
|
-
size: element.strokeWidth * 4.25,
|
|
19265
|
-
thinning: 0.6,
|
|
19266
|
-
smoothing: 0.5,
|
|
19267
|
-
streamline: 0.5,
|
|
19268
|
-
easing: (t2) => Math.sin(t2 * Math.PI / 2),
|
|
19269
|
-
// https://easings.net/#easeOutSine
|
|
19270
|
-
last: true
|
|
19271
|
-
};
|
|
19272
|
-
return getStroke(inputPoints, options);
|
|
19273
|
-
}
|
|
19274
|
-
function med(A, B) {
|
|
19275
|
-
return [(A[0] + B[0]) / 2, (A[1] + B[1]) / 2];
|
|
19276
|
-
}
|
|
19277
|
-
var TO_FIXED_PRECISION = /(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;
|
|
19278
|
-
function getSvgPathFromStroke(points) {
|
|
19279
|
-
if (!points.length) {
|
|
19280
|
-
return "";
|
|
19281
|
-
}
|
|
19282
|
-
const max = points.length - 1;
|
|
19283
|
-
return points.reduce(
|
|
19284
|
-
(acc, point, i, arr) => {
|
|
19285
|
-
if (i === max) {
|
|
19286
|
-
acc.push(point, med(point, arr[0]), "L", arr[0], "Z");
|
|
19287
|
-
} else {
|
|
19288
|
-
acc.push(point, med(point, arr[i + 1]));
|
|
19289
|
-
}
|
|
19290
|
-
return acc;
|
|
19291
|
-
},
|
|
19292
|
-
["M", points[0], "Q"]
|
|
19293
|
-
).join(" ").replace(TO_FIXED_PRECISION, "$1");
|
|
19294
|
-
}
|
|
19295
19253
|
|
|
19296
19254
|
// ../element/src/comparisons.ts
|
|
19297
19255
|
var canChangeRoundness2 = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "line" || type === "diamond" || type === "image";
|
|
@@ -19305,13 +19263,17 @@ __publicField(_ShapeCache, "cache", /* @__PURE__ */ new WeakMap());
|
|
|
19305
19263
|
* Retrieves shape from cache if available. Use this only if shape
|
|
19306
19264
|
* is optional and you have a fallback in case it's not cached.
|
|
19307
19265
|
*/
|
|
19308
|
-
__publicField(_ShapeCache, "get", (element) => {
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19266
|
+
__publicField(_ShapeCache, "get", (element, theme) => {
|
|
19267
|
+
const cached = _ShapeCache.cache.get(element);
|
|
19268
|
+
if (cached && (theme === null || cached.theme === theme)) {
|
|
19269
|
+
return cached.shape;
|
|
19270
|
+
}
|
|
19271
|
+
return void 0;
|
|
19272
|
+
});
|
|
19273
|
+
__publicField(_ShapeCache, "delete", (element) => {
|
|
19274
|
+
_ShapeCache.cache.delete(element);
|
|
19275
|
+
elementWithCanvasCache.delete(element);
|
|
19312
19276
|
});
|
|
19313
|
-
__publicField(_ShapeCache, "set", (element, shape) => _ShapeCache.cache.set(element, shape));
|
|
19314
|
-
__publicField(_ShapeCache, "delete", (element) => _ShapeCache.cache.delete(element));
|
|
19315
19277
|
__publicField(_ShapeCache, "destroy", () => {
|
|
19316
19278
|
_ShapeCache.cache = /* @__PURE__ */ new WeakMap();
|
|
19317
19279
|
});
|
|
@@ -19320,21 +19282,27 @@ __publicField(_ShapeCache, "destroy", () => {
|
|
|
19320
19282
|
* returns cached shape.
|
|
19321
19283
|
*/
|
|
19322
19284
|
__publicField(_ShapeCache, "generateElementShape", (element, renderConfig) => {
|
|
19323
|
-
const cachedShape = renderConfig?.isExporting ? void 0 : _ShapeCache.get(element);
|
|
19285
|
+
const cachedShape = renderConfig?.isExporting ? void 0 : _ShapeCache.get(element, renderConfig ? renderConfig.theme : null);
|
|
19324
19286
|
if (cachedShape !== void 0) {
|
|
19325
19287
|
return cachedShape;
|
|
19326
19288
|
}
|
|
19327
19289
|
elementWithCanvasCache.delete(element);
|
|
19328
|
-
const shape =
|
|
19290
|
+
const shape = _generateElementShape(
|
|
19329
19291
|
element,
|
|
19330
19292
|
_ShapeCache.rg,
|
|
19331
19293
|
renderConfig || {
|
|
19332
19294
|
isExporting: false,
|
|
19333
19295
|
canvasBackgroundColor: COLOR_PALETTE5.white,
|
|
19334
|
-
embedsValidationStatus: null
|
|
19296
|
+
embedsValidationStatus: null,
|
|
19297
|
+
theme: THEME10.LIGHT
|
|
19335
19298
|
}
|
|
19336
19299
|
);
|
|
19337
|
-
|
|
19300
|
+
if (!renderConfig?.isExporting) {
|
|
19301
|
+
_ShapeCache.cache.set(element, {
|
|
19302
|
+
shape,
|
|
19303
|
+
theme: renderConfig?.theme || THEME10.LIGHT
|
|
19304
|
+
});
|
|
19305
|
+
}
|
|
19338
19306
|
return shape;
|
|
19339
19307
|
});
|
|
19340
19308
|
var ShapeCache2 = _ShapeCache;
|
|
@@ -19354,7 +19322,7 @@ function adjustRoughness(element) {
|
|
|
19354
19322
|
}
|
|
19355
19323
|
return Math.min(roughness / (maxSize < 10 ? 3 : 2), 2.5);
|
|
19356
19324
|
}
|
|
19357
|
-
var generateRoughOptions = (element, continuousPath = false) => {
|
|
19325
|
+
var generateRoughOptions = (element, continuousPath = false, isDarkMode = false) => {
|
|
19358
19326
|
const options = {
|
|
19359
19327
|
seed: element.seed,
|
|
19360
19328
|
strokeLineDash: element.strokeStyle === "dashed" ? getDashArrayDashed(element.strokeWidth) : element.strokeStyle === "dotted" ? getDashArrayDotted(element.strokeWidth) : void 0,
|
|
@@ -19370,7 +19338,7 @@ var generateRoughOptions = (element, continuousPath = false) => {
|
|
|
19370
19338
|
fillWeight: element.strokeWidth / 2,
|
|
19371
19339
|
hachureGap: element.strokeWidth * 4,
|
|
19372
19340
|
roughness: adjustRoughness(element),
|
|
19373
|
-
stroke: element.strokeColor,
|
|
19341
|
+
stroke: isDarkMode ? applyDarkModeFilter2(element.strokeColor) : element.strokeColor,
|
|
19374
19342
|
preserveVertices: continuousPath || element.roughness < ROUGHNESS.cartoonist
|
|
19375
19343
|
};
|
|
19376
19344
|
switch (element.type) {
|
|
@@ -19380,7 +19348,7 @@ var generateRoughOptions = (element, continuousPath = false) => {
|
|
|
19380
19348
|
case "diamond":
|
|
19381
19349
|
case "ellipse": {
|
|
19382
19350
|
options.fillStyle = element.fillStyle;
|
|
19383
|
-
options.fill =
|
|
19351
|
+
options.fill = isTransparent7(element.backgroundColor) ? void 0 : isDarkMode ? applyDarkModeFilter2(element.backgroundColor) : element.backgroundColor;
|
|
19384
19352
|
if (element.type === "ellipse") {
|
|
19385
19353
|
options.curveFitting = 1;
|
|
19386
19354
|
}
|
|
@@ -19390,7 +19358,7 @@ var generateRoughOptions = (element, continuousPath = false) => {
|
|
|
19390
19358
|
case "freedraw": {
|
|
19391
19359
|
if (isPathALoop2(element.points)) {
|
|
19392
19360
|
options.fillStyle = element.fillStyle;
|
|
19393
|
-
options.fill = element.backgroundColor === "transparent" ? void 0 : element.backgroundColor;
|
|
19361
|
+
options.fill = element.backgroundColor === "transparent" ? void 0 : isDarkMode ? applyDarkModeFilter2(element.backgroundColor) : element.backgroundColor;
|
|
19394
19362
|
}
|
|
19395
19363
|
return options;
|
|
19396
19364
|
}
|
|
@@ -19402,7 +19370,7 @@ var generateRoughOptions = (element, continuousPath = false) => {
|
|
|
19402
19370
|
}
|
|
19403
19371
|
};
|
|
19404
19372
|
var modifyIframeLikeForRoughOptions = (element, isExporting, embedsValidationStatus) => {
|
|
19405
|
-
if (isIframeLikeElement(element) && (isExporting || isEmbeddableElement3(element) && embedsValidationStatus?.get(element.id) !== true) &&
|
|
19373
|
+
if (isIframeLikeElement(element) && (isExporting || isEmbeddableElement3(element) && embedsValidationStatus?.get(element.id) !== true) && isTransparent7(element.backgroundColor) && isTransparent7(element.strokeColor)) {
|
|
19406
19374
|
return {
|
|
19407
19375
|
...element,
|
|
19408
19376
|
roughness: 0,
|
|
@@ -19412,13 +19380,13 @@ var modifyIframeLikeForRoughOptions = (element, isExporting, embedsValidationSta
|
|
|
19412
19380
|
} else if (isIframeElement(element)) {
|
|
19413
19381
|
return {
|
|
19414
19382
|
...element,
|
|
19415
|
-
strokeColor:
|
|
19416
|
-
backgroundColor:
|
|
19383
|
+
strokeColor: isTransparent7(element.strokeColor) ? "#000000" : element.strokeColor,
|
|
19384
|
+
backgroundColor: isTransparent7(element.backgroundColor) ? "#f4f4f6" : element.backgroundColor
|
|
19417
19385
|
};
|
|
19418
19386
|
}
|
|
19419
19387
|
return element;
|
|
19420
19388
|
};
|
|
19421
|
-
var getArrowheadShapes = (element, shape, position, arrowhead, generator, options, canvasBackgroundColor) => {
|
|
19389
|
+
var getArrowheadShapes = (element, shape, position, arrowhead, generator, options, canvasBackgroundColor, isDarkMode) => {
|
|
19422
19390
|
const arrowheadPoints = getArrowheadPoints(
|
|
19423
19391
|
element,
|
|
19424
19392
|
shape,
|
|
@@ -19435,6 +19403,7 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
|
|
|
19435
19403
|
const [, , x3, y3, x4, y4] = arrowheadPoints2;
|
|
19436
19404
|
return [generator.line(x3, y3, x4, y4, options2)];
|
|
19437
19405
|
};
|
|
19406
|
+
const strokeColor = isDarkMode ? applyDarkModeFilter2(element.strokeColor) : element.strokeColor;
|
|
19438
19407
|
switch (arrowhead) {
|
|
19439
19408
|
case "dot":
|
|
19440
19409
|
case "circle":
|
|
@@ -19444,9 +19413,9 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
|
|
|
19444
19413
|
return [
|
|
19445
19414
|
generator.circle(x, y, diameter, {
|
|
19446
19415
|
...options,
|
|
19447
|
-
fill: arrowhead === "circle_outline" ? canvasBackgroundColor :
|
|
19416
|
+
fill: arrowhead === "circle_outline" ? canvasBackgroundColor : strokeColor,
|
|
19448
19417
|
fillStyle: "solid",
|
|
19449
|
-
stroke:
|
|
19418
|
+
stroke: strokeColor,
|
|
19450
19419
|
roughness: Math.min(0.5, options.roughness || 0)
|
|
19451
19420
|
})
|
|
19452
19421
|
];
|
|
@@ -19465,7 +19434,7 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
|
|
|
19465
19434
|
],
|
|
19466
19435
|
{
|
|
19467
19436
|
...options,
|
|
19468
|
-
fill: arrowhead === "triangle_outline" ? canvasBackgroundColor :
|
|
19437
|
+
fill: arrowhead === "triangle_outline" ? canvasBackgroundColor : strokeColor,
|
|
19469
19438
|
fillStyle: "solid",
|
|
19470
19439
|
roughness: Math.min(1, options.roughness || 0)
|
|
19471
19440
|
}
|
|
@@ -19487,7 +19456,7 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
|
|
|
19487
19456
|
],
|
|
19488
19457
|
{
|
|
19489
19458
|
...options,
|
|
19490
|
-
fill: arrowhead === "diamond_outline" ? canvasBackgroundColor :
|
|
19459
|
+
fill: arrowhead === "diamond_outline" ? canvasBackgroundColor : strokeColor,
|
|
19491
19460
|
fillStyle: "solid",
|
|
19492
19461
|
roughness: Math.min(1, options.roughness || 0)
|
|
19493
19462
|
}
|
|
@@ -19520,11 +19489,13 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
|
|
|
19520
19489
|
}
|
|
19521
19490
|
}
|
|
19522
19491
|
};
|
|
19523
|
-
var
|
|
19492
|
+
var _generateElementShape = (element, generator, {
|
|
19524
19493
|
isExporting,
|
|
19525
19494
|
canvasBackgroundColor,
|
|
19526
|
-
embedsValidationStatus
|
|
19495
|
+
embedsValidationStatus,
|
|
19496
|
+
theme
|
|
19527
19497
|
}) => {
|
|
19498
|
+
const isDarkMode = theme === THEME10.DARK;
|
|
19528
19499
|
switch (element.type) {
|
|
19529
19500
|
case "rectangle":
|
|
19530
19501
|
case "iframe":
|
|
@@ -19542,7 +19513,8 @@ var generateElementShape = (element, generator, {
|
|
|
19542
19513
|
isExporting,
|
|
19543
19514
|
embedsValidationStatus
|
|
19544
19515
|
),
|
|
19545
|
-
true
|
|
19516
|
+
true,
|
|
19517
|
+
isDarkMode
|
|
19546
19518
|
)
|
|
19547
19519
|
);
|
|
19548
19520
|
} else {
|
|
@@ -19557,7 +19529,8 @@ var generateElementShape = (element, generator, {
|
|
|
19557
19529
|
isExporting,
|
|
19558
19530
|
embedsValidationStatus
|
|
19559
19531
|
),
|
|
19560
|
-
false
|
|
19532
|
+
false,
|
|
19533
|
+
isDarkMode
|
|
19561
19534
|
)
|
|
19562
19535
|
);
|
|
19563
19536
|
}
|
|
@@ -19581,7 +19554,7 @@ var generateElementShape = (element, generator, {
|
|
|
19581
19554
|
C ${leftX} ${leftY}, ${leftX} ${leftY}, ${leftX + verticalRadius} ${leftY - horizontalRadius}
|
|
19582
19555
|
L ${topX - verticalRadius} ${topY + horizontalRadius}
|
|
19583
19556
|
C ${topX} ${topY}, ${topX} ${topY}, ${topX + verticalRadius} ${topY + horizontalRadius}`,
|
|
19584
|
-
generateRoughOptions(element, true)
|
|
19557
|
+
generateRoughOptions(element, true, isDarkMode)
|
|
19585
19558
|
);
|
|
19586
19559
|
} else {
|
|
19587
19560
|
shape = generator.polygon(
|
|
@@ -19591,7 +19564,7 @@ var generateElementShape = (element, generator, {
|
|
|
19591
19564
|
[bottomX, bottomY],
|
|
19592
19565
|
[leftX, leftY]
|
|
19593
19566
|
],
|
|
19594
|
-
generateRoughOptions(element)
|
|
19567
|
+
generateRoughOptions(element, false, isDarkMode)
|
|
19595
19568
|
);
|
|
19596
19569
|
}
|
|
19597
19570
|
return shape;
|
|
@@ -19602,14 +19575,14 @@ var generateElementShape = (element, generator, {
|
|
|
19602
19575
|
element.height / 2,
|
|
19603
19576
|
element.width,
|
|
19604
19577
|
element.height,
|
|
19605
|
-
generateRoughOptions(element)
|
|
19578
|
+
generateRoughOptions(element, false, isDarkMode)
|
|
19606
19579
|
);
|
|
19607
19580
|
return shape;
|
|
19608
19581
|
}
|
|
19609
19582
|
case "line":
|
|
19610
19583
|
case "arrow": {
|
|
19611
19584
|
let shape;
|
|
19612
|
-
const options = generateRoughOptions(element);
|
|
19585
|
+
const options = generateRoughOptions(element, false, isDarkMode);
|
|
19613
19586
|
const points = element.points.length ? element.points : [pointFrom19(0, 0)];
|
|
19614
19587
|
if (isElbowArrow6(element)) {
|
|
19615
19588
|
if (!points.every(
|
|
@@ -19625,7 +19598,7 @@ var generateElementShape = (element, generator, {
|
|
|
19625
19598
|
shape = [
|
|
19626
19599
|
generator.path(
|
|
19627
19600
|
generateElbowArrowShape(points, 16),
|
|
19628
|
-
generateRoughOptions(element, true)
|
|
19601
|
+
generateRoughOptions(element, true, isDarkMode)
|
|
19629
19602
|
)
|
|
19630
19603
|
];
|
|
19631
19604
|
}
|
|
@@ -19652,7 +19625,8 @@ var generateElementShape = (element, generator, {
|
|
|
19652
19625
|
startArrowhead,
|
|
19653
19626
|
generator,
|
|
19654
19627
|
options,
|
|
19655
|
-
canvasBackgroundColor
|
|
19628
|
+
canvasBackgroundColor,
|
|
19629
|
+
isDarkMode
|
|
19656
19630
|
);
|
|
19657
19631
|
shape.push(...shapes);
|
|
19658
19632
|
}
|
|
@@ -19666,7 +19640,8 @@ var generateElementShape = (element, generator, {
|
|
|
19666
19640
|
endArrowhead,
|
|
19667
19641
|
generator,
|
|
19668
19642
|
options,
|
|
19669
|
-
canvasBackgroundColor
|
|
19643
|
+
canvasBackgroundColor,
|
|
19644
|
+
isDarkMode
|
|
19670
19645
|
);
|
|
19671
19646
|
shape.push(...shapes);
|
|
19672
19647
|
}
|
|
@@ -19674,21 +19649,21 @@ var generateElementShape = (element, generator, {
|
|
|
19674
19649
|
return shape;
|
|
19675
19650
|
}
|
|
19676
19651
|
case "freedraw": {
|
|
19677
|
-
|
|
19678
|
-
generateFreeDrawShape(element);
|
|
19652
|
+
const shapes = [];
|
|
19679
19653
|
if (isPathALoop2(element.points)) {
|
|
19680
19654
|
const simplifiedPoints = simplify(
|
|
19681
19655
|
element.points,
|
|
19682
19656
|
0.75
|
|
19683
19657
|
);
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19688
|
-
|
|
19689
|
-
|
|
19658
|
+
shapes.push(
|
|
19659
|
+
generator.curve(simplifiedPoints, {
|
|
19660
|
+
...generateRoughOptions(element, false, isDarkMode),
|
|
19661
|
+
stroke: "none"
|
|
19662
|
+
})
|
|
19663
|
+
);
|
|
19690
19664
|
}
|
|
19691
|
-
|
|
19665
|
+
shapes.push(getFreeDrawSvgPath(element));
|
|
19666
|
+
return shapes;
|
|
19692
19667
|
}
|
|
19693
19668
|
case "frame":
|
|
19694
19669
|
case "magicframe":
|
|
@@ -19753,6 +19728,45 @@ var generateElbowArrowShape = (points, radius) => {
|
|
|
19753
19728
|
d.push(`L ${points[points.length - 1][0]} ${points[points.length - 1][1]}`);
|
|
19754
19729
|
return d.join(" ");
|
|
19755
19730
|
};
|
|
19731
|
+
var getFreeDrawSvgPath = (element) => {
|
|
19732
|
+
return getSvgPathFromStroke(
|
|
19733
|
+
getFreedrawOutlinePoints(element)
|
|
19734
|
+
);
|
|
19735
|
+
};
|
|
19736
|
+
var getFreedrawOutlinePoints = (element) => {
|
|
19737
|
+
const inputPoints = element.simulatePressure ? element.points : element.points.length ? element.points.map(([x, y], i) => [x, y, element.pressures[i]]) : [[0, 0, 0.5]];
|
|
19738
|
+
return getStroke(inputPoints, {
|
|
19739
|
+
simulatePressure: element.simulatePressure,
|
|
19740
|
+
size: element.strokeWidth * 4.25,
|
|
19741
|
+
thinning: 0.6,
|
|
19742
|
+
smoothing: 0.5,
|
|
19743
|
+
streamline: 0.5,
|
|
19744
|
+
easing: (t2) => Math.sin(t2 * Math.PI / 2),
|
|
19745
|
+
// https://easings.net/#easeOutSine
|
|
19746
|
+
last: true
|
|
19747
|
+
});
|
|
19748
|
+
};
|
|
19749
|
+
var med = (A, B) => {
|
|
19750
|
+
return [(A[0] + B[0]) / 2, (A[1] + B[1]) / 2];
|
|
19751
|
+
};
|
|
19752
|
+
var TO_FIXED_PRECISION = /(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;
|
|
19753
|
+
var getSvgPathFromStroke = (points) => {
|
|
19754
|
+
if (!points.length) {
|
|
19755
|
+
return "";
|
|
19756
|
+
}
|
|
19757
|
+
const max = points.length - 1;
|
|
19758
|
+
return points.reduce(
|
|
19759
|
+
(acc, point, i, arr) => {
|
|
19760
|
+
if (i === max) {
|
|
19761
|
+
acc.push(point, med(point, arr[0]), "L", arr[0], "Z");
|
|
19762
|
+
} else {
|
|
19763
|
+
acc.push(point, med(point, arr[i + 1]));
|
|
19764
|
+
}
|
|
19765
|
+
return acc;
|
|
19766
|
+
},
|
|
19767
|
+
["M", points[0], "Q"]
|
|
19768
|
+
).join(" ").replace(TO_FIXED_PRECISION, "$1");
|
|
19769
|
+
};
|
|
19756
19770
|
|
|
19757
19771
|
// ../element/src/mutateElement.ts
|
|
19758
19772
|
var newElementWith9 = (element, updates, force = false) => {
|
|
@@ -21588,8 +21602,8 @@ var snapResizingElements = (selectedElements, selectedOriginalElements, app, eve
|
|
|
21588
21602
|
snapLines: pointSnapLines
|
|
21589
21603
|
};
|
|
21590
21604
|
};
|
|
21591
|
-
var snapNewElement = (
|
|
21592
|
-
if (!isSnappingEnabled({ event, selectedElements: [
|
|
21605
|
+
var snapNewElement = (newElement5, app, event, origin, dragOffset, elementsMap) => {
|
|
21606
|
+
if (!isSnappingEnabled({ event, selectedElements: [newElement5], app })) {
|
|
21593
21607
|
return {
|
|
21594
21608
|
snapOffset: { x: 0, y: 0 },
|
|
21595
21609
|
snapLines: []
|
|
@@ -21606,7 +21620,7 @@ var snapNewElement = (newElement6, app, event, origin, dragOffset, elementsMap)
|
|
|
21606
21620
|
const nearestSnapsX = [];
|
|
21607
21621
|
const nearestSnapsY = [];
|
|
21608
21622
|
getPointSnaps(
|
|
21609
|
-
[
|
|
21623
|
+
[newElement5],
|
|
21610
21624
|
selectionSnapPoints,
|
|
21611
21625
|
app,
|
|
21612
21626
|
event,
|
|
@@ -21622,12 +21636,12 @@ var snapNewElement = (newElement6, app, event, origin, dragOffset, elementsMap)
|
|
|
21622
21636
|
minOffset.y = 0;
|
|
21623
21637
|
nearestSnapsX.length = 0;
|
|
21624
21638
|
nearestSnapsY.length = 0;
|
|
21625
|
-
const corners = getElementsCorners([
|
|
21639
|
+
const corners = getElementsCorners([newElement5], elementsMap, {
|
|
21626
21640
|
boundingBoxCorners: true,
|
|
21627
21641
|
omitCenter: true
|
|
21628
21642
|
});
|
|
21629
21643
|
getPointSnaps(
|
|
21630
|
-
[
|
|
21644
|
+
[newElement5],
|
|
21631
21645
|
corners,
|
|
21632
21646
|
app,
|
|
21633
21647
|
event,
|
|
@@ -21702,533 +21716,9 @@ var isActiveToolNonLinearSnappable = (activeToolType) => {
|
|
|
21702
21716
|
return activeToolType === TOOL_TYPE.rectangle || activeToolType === TOOL_TYPE.ellipse || activeToolType === TOOL_TYPE.diamond || activeToolType === TOOL_TYPE.frame || activeToolType === TOOL_TYPE.magicframe || activeToolType === TOOL_TYPE.image || activeToolType === TOOL_TYPE.text;
|
|
21703
21717
|
};
|
|
21704
21718
|
|
|
21705
|
-
// data/transform.ts
|
|
21706
|
-
import { pointFrom as pointFrom21 } from "@excalidraw/math";
|
|
21707
|
-
import {
|
|
21708
|
-
DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY5,
|
|
21709
|
-
DEFAULT_FONT_SIZE as DEFAULT_FONT_SIZE6,
|
|
21710
|
-
TEXT_ALIGN as TEXT_ALIGN3,
|
|
21711
|
-
VERTICAL_ALIGN as VERTICAL_ALIGN5,
|
|
21712
|
-
getSizeFromPoints as getSizeFromPoints3,
|
|
21713
|
-
randomId as randomId6,
|
|
21714
|
-
arrayToMap as arrayToMap22,
|
|
21715
|
-
assertNever as assertNever4,
|
|
21716
|
-
cloneJSON as cloneJSON3,
|
|
21717
|
-
getFontString as getFontString7,
|
|
21718
|
-
isDevEnv as isDevEnv7,
|
|
21719
|
-
toBrandedType,
|
|
21720
|
-
getLineHeight as getLineHeight3
|
|
21721
|
-
} from "@excalidraw/common";
|
|
21722
|
-
import { bindBindingElement as bindBindingElement2 } from "@excalidraw/element";
|
|
21723
|
-
import {
|
|
21724
|
-
newArrowElement as newArrowElement2,
|
|
21725
|
-
newElement as newElement4,
|
|
21726
|
-
newFrameElement as newFrameElement2,
|
|
21727
|
-
newImageElement,
|
|
21728
|
-
newLinearElement as newLinearElement3,
|
|
21729
|
-
newMagicFrameElement,
|
|
21730
|
-
newTextElement as newTextElement2
|
|
21731
|
-
} from "@excalidraw/element";
|
|
21732
|
-
import { measureText as measureText5, normalizeText } from "@excalidraw/element";
|
|
21733
|
-
import { isArrowElement as isArrowElement9 } from "@excalidraw/element";
|
|
21734
|
-
import { syncInvalidIndices } from "@excalidraw/element";
|
|
21735
|
-
import { redrawTextBoundingBox as redrawTextBoundingBox5 } from "@excalidraw/element";
|
|
21736
|
-
import { LinearElementEditor as LinearElementEditor8 } from "@excalidraw/element";
|
|
21737
|
-
import { getCommonBounds as getCommonBounds5 } from "@excalidraw/element";
|
|
21738
|
-
import { Scene } from "@excalidraw/element";
|
|
21739
|
-
var DEFAULT_LINEAR_ELEMENT_PROPS = {
|
|
21740
|
-
width: 100,
|
|
21741
|
-
height: 0
|
|
21742
|
-
};
|
|
21743
|
-
var DEFAULT_DIMENSION = 100;
|
|
21744
|
-
var bindTextToContainer = (container, textProps, scene) => {
|
|
21745
|
-
const textElement = newTextElement2({
|
|
21746
|
-
x: 0,
|
|
21747
|
-
y: 0,
|
|
21748
|
-
textAlign: TEXT_ALIGN3.CENTER,
|
|
21749
|
-
verticalAlign: VERTICAL_ALIGN5.MIDDLE,
|
|
21750
|
-
...textProps,
|
|
21751
|
-
containerId: container.id,
|
|
21752
|
-
strokeColor: textProps.strokeColor || container.strokeColor
|
|
21753
|
-
});
|
|
21754
|
-
Object.assign(container, {
|
|
21755
|
-
boundElements: (container.boundElements || []).concat({
|
|
21756
|
-
type: "text",
|
|
21757
|
-
id: textElement.id
|
|
21758
|
-
})
|
|
21759
|
-
});
|
|
21760
|
-
redrawTextBoundingBox5(textElement, container, scene);
|
|
21761
|
-
return [container, textElement];
|
|
21762
|
-
};
|
|
21763
|
-
var bindLinearElementToElement = (linearElement, start2, end, elementStore, scene) => {
|
|
21764
|
-
let startBoundElement;
|
|
21765
|
-
let endBoundElement;
|
|
21766
|
-
Object.assign(linearElement, {
|
|
21767
|
-
startBinding: linearElement?.startBinding || null,
|
|
21768
|
-
endBinding: linearElement.endBinding || null
|
|
21769
|
-
});
|
|
21770
|
-
if (start2) {
|
|
21771
|
-
const width = start2?.width ?? DEFAULT_DIMENSION;
|
|
21772
|
-
const height = start2?.height ?? DEFAULT_DIMENSION;
|
|
21773
|
-
let existingElement;
|
|
21774
|
-
if (start2.id) {
|
|
21775
|
-
existingElement = elementStore.getElement(start2.id);
|
|
21776
|
-
if (!existingElement) {
|
|
21777
|
-
console.error(`No element for start binding with id ${start2.id} found`);
|
|
21778
|
-
}
|
|
21779
|
-
}
|
|
21780
|
-
const startX = start2.x || linearElement.x - width;
|
|
21781
|
-
const startY = start2.y || linearElement.y - height / 2;
|
|
21782
|
-
const startType = existingElement ? existingElement.type : start2.type;
|
|
21783
|
-
if (startType) {
|
|
21784
|
-
if (startType === "text") {
|
|
21785
|
-
let text = "";
|
|
21786
|
-
if (existingElement && existingElement.type === "text") {
|
|
21787
|
-
text = existingElement.text;
|
|
21788
|
-
} else if (start2.type === "text") {
|
|
21789
|
-
text = start2.text;
|
|
21790
|
-
}
|
|
21791
|
-
if (!text) {
|
|
21792
|
-
console.error(
|
|
21793
|
-
`No text found for start binding text element for ${linearElement.id}`
|
|
21794
|
-
);
|
|
21795
|
-
}
|
|
21796
|
-
startBoundElement = newTextElement2({
|
|
21797
|
-
x: startX,
|
|
21798
|
-
y: startY,
|
|
21799
|
-
type: "text",
|
|
21800
|
-
...existingElement,
|
|
21801
|
-
...start2,
|
|
21802
|
-
text
|
|
21803
|
-
});
|
|
21804
|
-
Object.assign(startBoundElement, {
|
|
21805
|
-
x: start2.x || linearElement.x - startBoundElement.width,
|
|
21806
|
-
y: start2.y || linearElement.y - startBoundElement.height / 2
|
|
21807
|
-
});
|
|
21808
|
-
} else {
|
|
21809
|
-
switch (startType) {
|
|
21810
|
-
case "rectangle":
|
|
21811
|
-
case "ellipse":
|
|
21812
|
-
case "diamond": {
|
|
21813
|
-
startBoundElement = newElement4({
|
|
21814
|
-
x: startX,
|
|
21815
|
-
y: startY,
|
|
21816
|
-
width,
|
|
21817
|
-
height,
|
|
21818
|
-
...existingElement,
|
|
21819
|
-
...start2,
|
|
21820
|
-
type: startType
|
|
21821
|
-
});
|
|
21822
|
-
break;
|
|
21823
|
-
}
|
|
21824
|
-
default: {
|
|
21825
|
-
assertNever4(
|
|
21826
|
-
linearElement,
|
|
21827
|
-
`Unhandled element start type "${start2.type}"`,
|
|
21828
|
-
true
|
|
21829
|
-
);
|
|
21830
|
-
}
|
|
21831
|
-
}
|
|
21832
|
-
}
|
|
21833
|
-
bindBindingElement2(
|
|
21834
|
-
linearElement,
|
|
21835
|
-
startBoundElement,
|
|
21836
|
-
"orbit",
|
|
21837
|
-
"start",
|
|
21838
|
-
scene
|
|
21839
|
-
);
|
|
21840
|
-
}
|
|
21841
|
-
}
|
|
21842
|
-
if (end) {
|
|
21843
|
-
const height = end?.height ?? DEFAULT_DIMENSION;
|
|
21844
|
-
const width = end?.width ?? DEFAULT_DIMENSION;
|
|
21845
|
-
let existingElement;
|
|
21846
|
-
if (end.id) {
|
|
21847
|
-
existingElement = elementStore.getElement(end.id);
|
|
21848
|
-
if (!existingElement) {
|
|
21849
|
-
console.error(`No element for end binding with id ${end.id} found`);
|
|
21850
|
-
}
|
|
21851
|
-
}
|
|
21852
|
-
const endX = end.x || linearElement.x + linearElement.width;
|
|
21853
|
-
const endY = end.y || linearElement.y - height / 2;
|
|
21854
|
-
const endType = existingElement ? existingElement.type : end.type;
|
|
21855
|
-
if (endType) {
|
|
21856
|
-
if (endType === "text") {
|
|
21857
|
-
let text = "";
|
|
21858
|
-
if (existingElement && existingElement.type === "text") {
|
|
21859
|
-
text = existingElement.text;
|
|
21860
|
-
} else if (end.type === "text") {
|
|
21861
|
-
text = end.text;
|
|
21862
|
-
}
|
|
21863
|
-
if (!text) {
|
|
21864
|
-
console.error(
|
|
21865
|
-
`No text found for end binding text element for ${linearElement.id}`
|
|
21866
|
-
);
|
|
21867
|
-
}
|
|
21868
|
-
endBoundElement = newTextElement2({
|
|
21869
|
-
x: endX,
|
|
21870
|
-
y: endY,
|
|
21871
|
-
type: "text",
|
|
21872
|
-
...existingElement,
|
|
21873
|
-
...end,
|
|
21874
|
-
text
|
|
21875
|
-
});
|
|
21876
|
-
Object.assign(endBoundElement, {
|
|
21877
|
-
y: end.y || linearElement.y - endBoundElement.height / 2
|
|
21878
|
-
});
|
|
21879
|
-
} else {
|
|
21880
|
-
switch (endType) {
|
|
21881
|
-
case "rectangle":
|
|
21882
|
-
case "ellipse":
|
|
21883
|
-
case "diamond": {
|
|
21884
|
-
endBoundElement = newElement4({
|
|
21885
|
-
x: endX,
|
|
21886
|
-
y: endY,
|
|
21887
|
-
width,
|
|
21888
|
-
height,
|
|
21889
|
-
...existingElement,
|
|
21890
|
-
...end,
|
|
21891
|
-
type: endType
|
|
21892
|
-
});
|
|
21893
|
-
break;
|
|
21894
|
-
}
|
|
21895
|
-
default: {
|
|
21896
|
-
assertNever4(
|
|
21897
|
-
linearElement,
|
|
21898
|
-
`Unhandled element end type "${endType}"`,
|
|
21899
|
-
true
|
|
21900
|
-
);
|
|
21901
|
-
}
|
|
21902
|
-
}
|
|
21903
|
-
}
|
|
21904
|
-
bindBindingElement2(
|
|
21905
|
-
linearElement,
|
|
21906
|
-
endBoundElement,
|
|
21907
|
-
"orbit",
|
|
21908
|
-
"end",
|
|
21909
|
-
scene
|
|
21910
|
-
);
|
|
21911
|
-
}
|
|
21912
|
-
}
|
|
21913
|
-
if (linearElement.points.length < 2) {
|
|
21914
|
-
return {
|
|
21915
|
-
linearElement,
|
|
21916
|
-
startBoundElement,
|
|
21917
|
-
endBoundElement
|
|
21918
|
-
};
|
|
21919
|
-
}
|
|
21920
|
-
const endPointIndex = linearElement.points.length - 1;
|
|
21921
|
-
const delta = 0.5;
|
|
21922
|
-
const newPoints = cloneJSON3(linearElement.points);
|
|
21923
|
-
if (linearElement.points[endPointIndex][0] > linearElement.points[endPointIndex - 1][0]) {
|
|
21924
|
-
newPoints[0][0] = delta;
|
|
21925
|
-
newPoints[endPointIndex][0] -= delta;
|
|
21926
|
-
}
|
|
21927
|
-
if (linearElement.points[endPointIndex][0] < linearElement.points[endPointIndex - 1][0]) {
|
|
21928
|
-
newPoints[0][0] = -delta;
|
|
21929
|
-
newPoints[endPointIndex][0] += delta;
|
|
21930
|
-
}
|
|
21931
|
-
if (linearElement.points[endPointIndex][1] > linearElement.points[endPointIndex - 1][1]) {
|
|
21932
|
-
newPoints[0][1] = delta;
|
|
21933
|
-
newPoints[endPointIndex][1] -= delta;
|
|
21934
|
-
}
|
|
21935
|
-
if (linearElement.points[endPointIndex][1] < linearElement.points[endPointIndex - 1][1]) {
|
|
21936
|
-
newPoints[0][1] = -delta;
|
|
21937
|
-
newPoints[endPointIndex][1] += delta;
|
|
21938
|
-
}
|
|
21939
|
-
Object.assign(
|
|
21940
|
-
linearElement,
|
|
21941
|
-
LinearElementEditor8.getNormalizeElementPointsAndCoords({
|
|
21942
|
-
...linearElement,
|
|
21943
|
-
points: newPoints
|
|
21944
|
-
})
|
|
21945
|
-
);
|
|
21946
|
-
return {
|
|
21947
|
-
linearElement,
|
|
21948
|
-
startBoundElement,
|
|
21949
|
-
endBoundElement
|
|
21950
|
-
};
|
|
21951
|
-
};
|
|
21952
|
-
var ElementStore = class {
|
|
21953
|
-
constructor() {
|
|
21954
|
-
__publicField(this, "excalidrawElements", /* @__PURE__ */ new Map());
|
|
21955
|
-
__publicField(this, "add", (ele) => {
|
|
21956
|
-
if (!ele) {
|
|
21957
|
-
return;
|
|
21958
|
-
}
|
|
21959
|
-
this.excalidrawElements.set(ele.id, ele);
|
|
21960
|
-
});
|
|
21961
|
-
__publicField(this, "getElements", () => {
|
|
21962
|
-
return syncInvalidIndices(Array.from(this.excalidrawElements.values()));
|
|
21963
|
-
});
|
|
21964
|
-
__publicField(this, "getElementsMap", () => {
|
|
21965
|
-
return toBrandedType(
|
|
21966
|
-
arrayToMap22(this.getElements())
|
|
21967
|
-
);
|
|
21968
|
-
});
|
|
21969
|
-
__publicField(this, "getElement", (id) => {
|
|
21970
|
-
return this.excalidrawElements.get(id);
|
|
21971
|
-
});
|
|
21972
|
-
}
|
|
21973
|
-
};
|
|
21974
|
-
var convertToExcalidrawElements = (elementsSkeleton, opts) => {
|
|
21975
|
-
if (!elementsSkeleton) {
|
|
21976
|
-
return [];
|
|
21977
|
-
}
|
|
21978
|
-
const elements = cloneJSON3(elementsSkeleton);
|
|
21979
|
-
const elementStore = new ElementStore();
|
|
21980
|
-
const elementsWithIds = /* @__PURE__ */ new Map();
|
|
21981
|
-
const oldToNewElementIdMap = /* @__PURE__ */ new Map();
|
|
21982
|
-
for (const element of elements) {
|
|
21983
|
-
let excalidrawElement;
|
|
21984
|
-
const originalId = element.id;
|
|
21985
|
-
if (opts?.regenerateIds !== false) {
|
|
21986
|
-
Object.assign(element, { id: randomId6() });
|
|
21987
|
-
}
|
|
21988
|
-
switch (element.type) {
|
|
21989
|
-
case "rectangle":
|
|
21990
|
-
case "ellipse":
|
|
21991
|
-
case "diamond": {
|
|
21992
|
-
const width = element?.label?.text && element.width === void 0 ? 0 : element?.width || DEFAULT_DIMENSION;
|
|
21993
|
-
const height = element?.label?.text && element.height === void 0 ? 0 : element?.height || DEFAULT_DIMENSION;
|
|
21994
|
-
excalidrawElement = newElement4({
|
|
21995
|
-
...element,
|
|
21996
|
-
width,
|
|
21997
|
-
height
|
|
21998
|
-
});
|
|
21999
|
-
break;
|
|
22000
|
-
}
|
|
22001
|
-
case "line": {
|
|
22002
|
-
const width = element.width || DEFAULT_LINEAR_ELEMENT_PROPS.width;
|
|
22003
|
-
const height = element.height || DEFAULT_LINEAR_ELEMENT_PROPS.height;
|
|
22004
|
-
excalidrawElement = newLinearElement3({
|
|
22005
|
-
width,
|
|
22006
|
-
height,
|
|
22007
|
-
points: [pointFrom21(0, 0), pointFrom21(width, height)],
|
|
22008
|
-
...element
|
|
22009
|
-
});
|
|
22010
|
-
break;
|
|
22011
|
-
}
|
|
22012
|
-
case "arrow": {
|
|
22013
|
-
const width = element.width || DEFAULT_LINEAR_ELEMENT_PROPS.width;
|
|
22014
|
-
const height = element.height || DEFAULT_LINEAR_ELEMENT_PROPS.height;
|
|
22015
|
-
excalidrawElement = newArrowElement2({
|
|
22016
|
-
width,
|
|
22017
|
-
height,
|
|
22018
|
-
endArrowhead: "arrow",
|
|
22019
|
-
points: [pointFrom21(0, 0), pointFrom21(width, height)],
|
|
22020
|
-
...element,
|
|
22021
|
-
type: "arrow"
|
|
22022
|
-
});
|
|
22023
|
-
Object.assign(
|
|
22024
|
-
excalidrawElement,
|
|
22025
|
-
getSizeFromPoints3(excalidrawElement.points)
|
|
22026
|
-
);
|
|
22027
|
-
break;
|
|
22028
|
-
}
|
|
22029
|
-
case "text": {
|
|
22030
|
-
const fontFamily = element?.fontFamily || DEFAULT_FONT_FAMILY5;
|
|
22031
|
-
const fontSize = element?.fontSize || DEFAULT_FONT_SIZE6;
|
|
22032
|
-
const lineHeight = element?.lineHeight || getLineHeight3(fontFamily);
|
|
22033
|
-
const text = element.text ?? "";
|
|
22034
|
-
const normalizedText = normalizeText(text);
|
|
22035
|
-
const metrics = measureText5(
|
|
22036
|
-
normalizedText,
|
|
22037
|
-
getFontString7({ fontFamily, fontSize }),
|
|
22038
|
-
lineHeight
|
|
22039
|
-
);
|
|
22040
|
-
excalidrawElement = newTextElement2({
|
|
22041
|
-
width: metrics.width,
|
|
22042
|
-
height: metrics.height,
|
|
22043
|
-
fontFamily,
|
|
22044
|
-
fontSize,
|
|
22045
|
-
...element
|
|
22046
|
-
});
|
|
22047
|
-
break;
|
|
22048
|
-
}
|
|
22049
|
-
case "image": {
|
|
22050
|
-
excalidrawElement = newImageElement({
|
|
22051
|
-
width: element?.width || DEFAULT_DIMENSION,
|
|
22052
|
-
height: element?.height || DEFAULT_DIMENSION,
|
|
22053
|
-
...element
|
|
22054
|
-
});
|
|
22055
|
-
break;
|
|
22056
|
-
}
|
|
22057
|
-
case "frame": {
|
|
22058
|
-
excalidrawElement = newFrameElement2({
|
|
22059
|
-
x: 0,
|
|
22060
|
-
y: 0,
|
|
22061
|
-
...element
|
|
22062
|
-
});
|
|
22063
|
-
break;
|
|
22064
|
-
}
|
|
22065
|
-
case "magicframe": {
|
|
22066
|
-
excalidrawElement = newMagicFrameElement({
|
|
22067
|
-
x: 0,
|
|
22068
|
-
y: 0,
|
|
22069
|
-
...element
|
|
22070
|
-
});
|
|
22071
|
-
break;
|
|
22072
|
-
}
|
|
22073
|
-
case "freedraw":
|
|
22074
|
-
case "iframe":
|
|
22075
|
-
case "embeddable": {
|
|
22076
|
-
excalidrawElement = element;
|
|
22077
|
-
break;
|
|
22078
|
-
}
|
|
22079
|
-
default: {
|
|
22080
|
-
excalidrawElement = element;
|
|
22081
|
-
assertNever4(
|
|
22082
|
-
element,
|
|
22083
|
-
`Unhandled element type "${element.type}"`,
|
|
22084
|
-
true
|
|
22085
|
-
);
|
|
22086
|
-
}
|
|
22087
|
-
}
|
|
22088
|
-
const existingElement = elementStore.getElement(excalidrawElement.id);
|
|
22089
|
-
if (existingElement) {
|
|
22090
|
-
console.error(`Duplicate id found for ${excalidrawElement.id}`);
|
|
22091
|
-
} else {
|
|
22092
|
-
elementStore.add(excalidrawElement);
|
|
22093
|
-
elementsWithIds.set(excalidrawElement.id, element);
|
|
22094
|
-
if (originalId) {
|
|
22095
|
-
oldToNewElementIdMap.set(originalId, excalidrawElement.id);
|
|
22096
|
-
}
|
|
22097
|
-
}
|
|
22098
|
-
}
|
|
22099
|
-
const elementsMap = elementStore.getElementsMap();
|
|
22100
|
-
const scene = new Scene(elementsMap);
|
|
22101
|
-
for (const [id, element] of elementsWithIds) {
|
|
22102
|
-
const excalidrawElement = elementStore.getElement(id);
|
|
22103
|
-
switch (element.type) {
|
|
22104
|
-
case "rectangle":
|
|
22105
|
-
case "ellipse":
|
|
22106
|
-
case "diamond":
|
|
22107
|
-
case "arrow": {
|
|
22108
|
-
if (element.label?.text) {
|
|
22109
|
-
let [container, text] = bindTextToContainer(
|
|
22110
|
-
excalidrawElement,
|
|
22111
|
-
element?.label,
|
|
22112
|
-
scene
|
|
22113
|
-
);
|
|
22114
|
-
elementStore.add(container);
|
|
22115
|
-
elementStore.add(text);
|
|
22116
|
-
if (isArrowElement9(container)) {
|
|
22117
|
-
const originalStart = element.type === "arrow" ? element?.start : void 0;
|
|
22118
|
-
const originalEnd = element.type === "arrow" ? element?.end : void 0;
|
|
22119
|
-
if (originalStart && originalStart.id) {
|
|
22120
|
-
const newStartId = oldToNewElementIdMap.get(originalStart.id);
|
|
22121
|
-
if (newStartId) {
|
|
22122
|
-
Object.assign(originalStart, { id: newStartId });
|
|
22123
|
-
}
|
|
22124
|
-
}
|
|
22125
|
-
if (originalEnd && originalEnd.id) {
|
|
22126
|
-
const newEndId = oldToNewElementIdMap.get(originalEnd.id);
|
|
22127
|
-
if (newEndId) {
|
|
22128
|
-
Object.assign(originalEnd, { id: newEndId });
|
|
22129
|
-
}
|
|
22130
|
-
}
|
|
22131
|
-
const { linearElement, startBoundElement, endBoundElement } = bindLinearElementToElement(
|
|
22132
|
-
container,
|
|
22133
|
-
originalStart,
|
|
22134
|
-
originalEnd,
|
|
22135
|
-
elementStore,
|
|
22136
|
-
scene
|
|
22137
|
-
);
|
|
22138
|
-
container = linearElement;
|
|
22139
|
-
elementStore.add(linearElement);
|
|
22140
|
-
elementStore.add(startBoundElement);
|
|
22141
|
-
elementStore.add(endBoundElement);
|
|
22142
|
-
}
|
|
22143
|
-
} else {
|
|
22144
|
-
switch (element.type) {
|
|
22145
|
-
case "arrow": {
|
|
22146
|
-
const { start: start2, end } = element;
|
|
22147
|
-
if (start2 && start2.id) {
|
|
22148
|
-
const newStartId = oldToNewElementIdMap.get(start2.id);
|
|
22149
|
-
Object.assign(start2, { id: newStartId });
|
|
22150
|
-
}
|
|
22151
|
-
if (end && end.id) {
|
|
22152
|
-
const newEndId = oldToNewElementIdMap.get(end.id);
|
|
22153
|
-
Object.assign(end, { id: newEndId });
|
|
22154
|
-
}
|
|
22155
|
-
const { linearElement, startBoundElement, endBoundElement } = bindLinearElementToElement(
|
|
22156
|
-
excalidrawElement,
|
|
22157
|
-
start2,
|
|
22158
|
-
end,
|
|
22159
|
-
elementStore,
|
|
22160
|
-
scene
|
|
22161
|
-
);
|
|
22162
|
-
elementStore.add(linearElement);
|
|
22163
|
-
elementStore.add(startBoundElement);
|
|
22164
|
-
elementStore.add(endBoundElement);
|
|
22165
|
-
break;
|
|
22166
|
-
}
|
|
22167
|
-
}
|
|
22168
|
-
}
|
|
22169
|
-
break;
|
|
22170
|
-
}
|
|
22171
|
-
}
|
|
22172
|
-
}
|
|
22173
|
-
for (const [id, element] of elementsWithIds) {
|
|
22174
|
-
if (element.type !== "frame" && element.type !== "magicframe") {
|
|
22175
|
-
continue;
|
|
22176
|
-
}
|
|
22177
|
-
const frame = elementStore.getElement(id);
|
|
22178
|
-
if (!frame) {
|
|
22179
|
-
throw new Error(`Excalidraw element with id ${id} doesn't exist`);
|
|
22180
|
-
}
|
|
22181
|
-
const childrenElements = [];
|
|
22182
|
-
element.children.forEach((id2) => {
|
|
22183
|
-
const newElementId = oldToNewElementIdMap.get(id2);
|
|
22184
|
-
if (!newElementId) {
|
|
22185
|
-
throw new Error(`Element with ${id2} wasn't mapped correctly`);
|
|
22186
|
-
}
|
|
22187
|
-
const elementInFrame = elementStore.getElement(newElementId);
|
|
22188
|
-
if (!elementInFrame) {
|
|
22189
|
-
throw new Error(`Frame element with id ${newElementId} doesn't exist`);
|
|
22190
|
-
}
|
|
22191
|
-
Object.assign(elementInFrame, { frameId: frame.id });
|
|
22192
|
-
elementInFrame?.boundElements?.forEach((boundElement) => {
|
|
22193
|
-
const ele = elementStore.getElement(boundElement.id);
|
|
22194
|
-
if (!ele) {
|
|
22195
|
-
throw new Error(
|
|
22196
|
-
`Bound element with id ${boundElement.id} doesn't exist`
|
|
22197
|
-
);
|
|
22198
|
-
}
|
|
22199
|
-
Object.assign(ele, { frameId: frame.id });
|
|
22200
|
-
childrenElements.push(ele);
|
|
22201
|
-
});
|
|
22202
|
-
childrenElements.push(elementInFrame);
|
|
22203
|
-
});
|
|
22204
|
-
let [minX, minY, maxX, maxY] = getCommonBounds5(childrenElements);
|
|
22205
|
-
const PADDING = 10;
|
|
22206
|
-
minX = minX - PADDING;
|
|
22207
|
-
minY = minY - PADDING;
|
|
22208
|
-
maxX = maxX + PADDING;
|
|
22209
|
-
maxY = maxY + PADDING;
|
|
22210
|
-
const frameX = frame?.x || minX;
|
|
22211
|
-
const frameY = frame?.y || minY;
|
|
22212
|
-
const frameWidth = frame?.width || maxX - minX;
|
|
22213
|
-
const frameHeight = frame?.height || maxY - minY;
|
|
22214
|
-
Object.assign(frame, {
|
|
22215
|
-
x: frameX,
|
|
22216
|
-
y: frameY,
|
|
22217
|
-
width: frameWidth,
|
|
22218
|
-
height: frameHeight
|
|
22219
|
-
});
|
|
22220
|
-
if (isDevEnv7() && element.children.length && (frame?.x || frame?.y || frame?.width || frame?.height)) {
|
|
22221
|
-
console.info(
|
|
22222
|
-
"User provided frame attributes are being considered, if you find this inaccurate, please remove any of the attributes - x, y, width and height so frame coordinates and dimensions are calculated automatically"
|
|
22223
|
-
);
|
|
22224
|
-
}
|
|
22225
|
-
}
|
|
22226
|
-
return elementStore.getElements();
|
|
22227
|
-
};
|
|
22228
|
-
|
|
22229
21719
|
// scene/Renderer.ts
|
|
22230
21720
|
import { isElementInViewport as isElementInViewport2 } from "@excalidraw/element";
|
|
22231
|
-
import { memoize, toBrandedType
|
|
21721
|
+
import { memoize, toBrandedType } from "@excalidraw/common";
|
|
22232
21722
|
var Renderer = class {
|
|
22233
21723
|
constructor(scene) {
|
|
22234
21724
|
__publicField(this, "scene");
|
|
@@ -22268,7 +21758,7 @@ var Renderer = class {
|
|
|
22268
21758
|
editingTextElement,
|
|
22269
21759
|
newElementId
|
|
22270
21760
|
}) => {
|
|
22271
|
-
const elementsMap =
|
|
21761
|
+
const elementsMap = toBrandedType(/* @__PURE__ */ new Map());
|
|
22272
21762
|
for (const element of elements) {
|
|
22273
21763
|
if (newElementId === element.id) {
|
|
22274
21764
|
continue;
|
|
@@ -22636,23 +22126,25 @@ import {
|
|
|
22636
22126
|
KEYS as KEYS44,
|
|
22637
22127
|
CLASSES as CLASSES5,
|
|
22638
22128
|
POINTER_BUTTON,
|
|
22129
|
+
THEME as THEME11,
|
|
22639
22130
|
isWritableElement as isWritableElement4,
|
|
22640
|
-
getFontString as
|
|
22131
|
+
getFontString as getFontString7,
|
|
22641
22132
|
getFontFamilyString as getFontFamilyString3,
|
|
22642
22133
|
isTestEnv as isTestEnv4,
|
|
22643
|
-
MIME_TYPES as MIME_TYPES8
|
|
22134
|
+
MIME_TYPES as MIME_TYPES8,
|
|
22135
|
+
applyDarkModeFilter as applyDarkModeFilter3
|
|
22644
22136
|
} from "@excalidraw/common";
|
|
22645
22137
|
import {
|
|
22646
22138
|
originalContainerCache,
|
|
22647
22139
|
updateOriginalContainerCache as updateOriginalContainerCache3
|
|
22648
22140
|
} from "@excalidraw/element";
|
|
22649
|
-
import { LinearElementEditor as
|
|
22141
|
+
import { LinearElementEditor as LinearElementEditor8 } from "@excalidraw/element";
|
|
22650
22142
|
import { bumpVersion as bumpVersion2 } from "@excalidraw/element";
|
|
22651
22143
|
import {
|
|
22652
22144
|
getBoundTextElementId,
|
|
22653
22145
|
getContainerElement as getContainerElement3,
|
|
22654
22146
|
getTextElementAngle,
|
|
22655
|
-
redrawTextBoundingBox as
|
|
22147
|
+
redrawTextBoundingBox as redrawTextBoundingBox5,
|
|
22656
22148
|
getBoundTextMaxHeight as getBoundTextMaxHeight3,
|
|
22657
22149
|
getBoundTextMaxWidth as getBoundTextMaxWidth3,
|
|
22658
22150
|
computeContainerDimensionForBoundText as computeContainerDimensionForBoundText2,
|
|
@@ -22660,10 +22152,10 @@ import {
|
|
|
22660
22152
|
getBoundTextElement as getBoundTextElement6
|
|
22661
22153
|
} from "@excalidraw/element";
|
|
22662
22154
|
import { getTextWidth } from "@excalidraw/element";
|
|
22663
|
-
import { normalizeText
|
|
22155
|
+
import { normalizeText } from "@excalidraw/element";
|
|
22664
22156
|
import { wrapText as wrapText3 } from "@excalidraw/element";
|
|
22665
22157
|
import {
|
|
22666
|
-
isArrowElement as
|
|
22158
|
+
isArrowElement as isArrowElement9,
|
|
22667
22159
|
isBoundToContainer as isBoundToContainer7,
|
|
22668
22160
|
isTextElement as isTextElement10
|
|
22669
22161
|
} from "@excalidraw/element";
|
|
@@ -22724,8 +22216,8 @@ var textWysiwyg = ({
|
|
|
22724
22216
|
let maxWidth = updatedTextElement.width;
|
|
22725
22217
|
let maxHeight = updatedTextElement.height;
|
|
22726
22218
|
if (container && updatedTextElement.containerId) {
|
|
22727
|
-
if (
|
|
22728
|
-
const boundTextCoords =
|
|
22219
|
+
if (isArrowElement9(container)) {
|
|
22220
|
+
const boundTextCoords = LinearElementEditor8.getBoundTextElementPosition(
|
|
22729
22221
|
container,
|
|
22730
22222
|
updatedTextElement,
|
|
22731
22223
|
elementsMap
|
|
@@ -22757,7 +22249,7 @@ var textWysiwyg = ({
|
|
|
22757
22249
|
container,
|
|
22758
22250
|
updatedTextElement
|
|
22759
22251
|
);
|
|
22760
|
-
if (!
|
|
22252
|
+
if (!isArrowElement9(container) && height > maxHeight) {
|
|
22761
22253
|
const targetContainerHeight = computeContainerDimensionForBoundText2(
|
|
22762
22254
|
height,
|
|
22763
22255
|
container.type
|
|
@@ -22767,7 +22259,7 @@ var textWysiwyg = ({
|
|
|
22767
22259
|
} else if (
|
|
22768
22260
|
// autoshrink container height until original container height
|
|
22769
22261
|
// is reached when text is removed
|
|
22770
|
-
!
|
|
22262
|
+
!isArrowElement9(container) && container.height > originalContainerData.height && height < maxHeight
|
|
22771
22263
|
) {
|
|
22772
22264
|
const targetContainerHeight = computeContainerDimensionForBoundText2(
|
|
22773
22265
|
height,
|
|
@@ -22792,7 +22284,7 @@ var textWysiwyg = ({
|
|
|
22792
22284
|
width += 0.5;
|
|
22793
22285
|
}
|
|
22794
22286
|
height *= 1.05;
|
|
22795
|
-
const font =
|
|
22287
|
+
const font = getFontString7(updatedTextElement);
|
|
22796
22288
|
const editorMaxHeight = (appState.height - viewportY) / appState.zoom.value;
|
|
22797
22289
|
Object.assign(editable.style, {
|
|
22798
22290
|
font,
|
|
@@ -22812,9 +22304,8 @@ var textWysiwyg = ({
|
|
|
22812
22304
|
),
|
|
22813
22305
|
textAlign,
|
|
22814
22306
|
verticalAlign,
|
|
22815
|
-
color: updatedTextElement.strokeColor,
|
|
22307
|
+
color: appState.theme === THEME11.DARK ? applyDarkModeFilter3(updatedTextElement.strokeColor) : updatedTextElement.strokeColor,
|
|
22816
22308
|
opacity: updatedTextElement.opacity / 100,
|
|
22817
|
-
filter: "var(--theme-filter)",
|
|
22818
22309
|
maxHeight: `${editorMaxHeight}px`
|
|
22819
22310
|
});
|
|
22820
22311
|
editable.scrollTop = 0;
|
|
@@ -22866,7 +22357,7 @@ var textWysiwyg = ({
|
|
|
22866
22357
|
if (!textItem) {
|
|
22867
22358
|
return;
|
|
22868
22359
|
}
|
|
22869
|
-
const text =
|
|
22360
|
+
const text = normalizeText(textItem.value);
|
|
22870
22361
|
if (!text) {
|
|
22871
22362
|
return;
|
|
22872
22363
|
}
|
|
@@ -22874,7 +22365,7 @@ var textWysiwyg = ({
|
|
|
22874
22365
|
element,
|
|
22875
22366
|
app.scene.getNonDeletedElementsMap()
|
|
22876
22367
|
);
|
|
22877
|
-
const font =
|
|
22368
|
+
const font = getFontString7({
|
|
22878
22369
|
fontSize: app.state.currentItemFontSize,
|
|
22879
22370
|
fontFamily: app.state.currentItemFontFamily
|
|
22880
22371
|
});
|
|
@@ -22893,7 +22384,7 @@ var textWysiwyg = ({
|
|
|
22893
22384
|
}
|
|
22894
22385
|
};
|
|
22895
22386
|
editable.oninput = () => {
|
|
22896
|
-
const normalized =
|
|
22387
|
+
const normalized = normalizeText(editable.value);
|
|
22897
22388
|
if (editable.value !== normalized) {
|
|
22898
22389
|
const selectionStart = editable.selectionStart;
|
|
22899
22390
|
editable.value = normalized;
|
|
@@ -23044,7 +22535,7 @@ var textWysiwyg = ({
|
|
|
23044
22535
|
id: element.id
|
|
23045
22536
|
})
|
|
23046
22537
|
});
|
|
23047
|
-
} else if (
|
|
22538
|
+
} else if (isArrowElement9(container)) {
|
|
23048
22539
|
bumpVersion2(container);
|
|
23049
22540
|
}
|
|
23050
22541
|
} else {
|
|
@@ -23056,7 +22547,7 @@ var textWysiwyg = ({
|
|
|
23056
22547
|
)
|
|
23057
22548
|
});
|
|
23058
22549
|
}
|
|
23059
|
-
|
|
22550
|
+
redrawTextBoundingBox5(updateElement, container, app.scene);
|
|
23060
22551
|
}
|
|
23061
22552
|
onSubmit({
|
|
23062
22553
|
viaKeyboard: submittedViaKeyboard,
|
|
@@ -23160,7 +22651,7 @@ var textWysiwyg = ({
|
|
|
23160
22651
|
|
|
23161
22652
|
// scene/scrollbars.ts
|
|
23162
22653
|
import { getGlobalCSSVariable } from "@excalidraw/common";
|
|
23163
|
-
import { getCommonBounds as
|
|
22654
|
+
import { getCommonBounds as getCommonBounds5 } from "@excalidraw/element";
|
|
23164
22655
|
var SCROLLBAR_MARGIN = 4;
|
|
23165
22656
|
var SCROLLBAR_WIDTH = 6;
|
|
23166
22657
|
var SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
|
|
@@ -23171,7 +22662,7 @@ var getScrollBars = (elements, viewportWidth, viewportHeight, appState) => {
|
|
|
23171
22662
|
vertical: null
|
|
23172
22663
|
};
|
|
23173
22664
|
}
|
|
23174
|
-
const [elementsMinX, elementsMinY, elementsMaxX, elementsMaxY] =
|
|
22665
|
+
const [elementsMinX, elementsMinY, elementsMaxX, elementsMaxY] = getCommonBounds5(elements);
|
|
23175
22666
|
const viewportWidthWithZoom = viewportWidth / appState.zoom.value;
|
|
23176
22667
|
const viewportHeightWithZoom = viewportHeight / appState.zoom.value;
|
|
23177
22668
|
const safeArea = {
|
|
@@ -23259,10 +22750,10 @@ var isMaybeMermaidDefinition = (text) => {
|
|
|
23259
22750
|
|
|
23260
22751
|
// lasso/index.ts
|
|
23261
22752
|
import {
|
|
23262
|
-
pointFrom as
|
|
22753
|
+
pointFrom as pointFrom21
|
|
23263
22754
|
} from "@excalidraw/math";
|
|
23264
22755
|
import { getElementLineSegments as getElementLineSegments2 } from "@excalidraw/element";
|
|
23265
|
-
import { LinearElementEditor as
|
|
22756
|
+
import { LinearElementEditor as LinearElementEditor9 } from "@excalidraw/element";
|
|
23266
22757
|
import {
|
|
23267
22758
|
isFrameLikeElement as isFrameLikeElement9,
|
|
23268
22759
|
isLinearElement as isLinearElement9,
|
|
@@ -23271,7 +22762,7 @@ import {
|
|
|
23271
22762
|
import { getFrameChildren as getFrameChildren4 } from "@excalidraw/element";
|
|
23272
22763
|
import { selectGroupsForSelectedElements as selectGroupsForSelectedElements5 } from "@excalidraw/element";
|
|
23273
22764
|
import { getContainerElement as getContainerElement4 } from "@excalidraw/element";
|
|
23274
|
-
import { arrayToMap as
|
|
22765
|
+
import { arrayToMap as arrayToMap22, easeOut as easeOut2, isShallowEqual as isShallowEqual4 } from "@excalidraw/common";
|
|
23275
22766
|
|
|
23276
22767
|
// lasso/utils.ts
|
|
23277
22768
|
import { simplify as simplify2 } from "points-on-curve";
|
|
@@ -23443,7 +22934,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
23443
22934
|
return {
|
|
23444
22935
|
selectedElementIds: nextSelection.selectedElementIds,
|
|
23445
22936
|
selectedGroupIds: nextSelection.selectedGroupIds,
|
|
23446
|
-
selectedLinearElement: selectedIds.length === 1 && !selectedGroupIds.length && isLinearElement9(this.app.scene.getNonDeletedElement(selectedIds[0])) ? new
|
|
22937
|
+
selectedLinearElement: selectedIds.length === 1 && !selectedGroupIds.length && isLinearElement9(this.app.scene.getNonDeletedElement(selectedIds[0])) ? new LinearElementEditor9(
|
|
23447
22938
|
this.app.scene.getNonDeletedElement(
|
|
23448
22939
|
selectedIds[0]
|
|
23449
22940
|
),
|
|
@@ -23458,7 +22949,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
23458
22949
|
this.updateSelection();
|
|
23459
22950
|
});
|
|
23460
22951
|
__publicField(this, "updateSelection", () => {
|
|
23461
|
-
const lassoPath = super.getCurrentTrail()?.originalPoints?.map((p) =>
|
|
22952
|
+
const lassoPath = super.getCurrentTrail()?.originalPoints?.map((p) => pointFrom21(p[0], p[1]));
|
|
23462
22953
|
const currentCanvasTranslate = {
|
|
23463
22954
|
scrollX: this.app.state.scrollX,
|
|
23464
22955
|
scrollY: this.app.state.scrollY,
|
|
@@ -23467,7 +22958,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
23467
22958
|
if (!this.elementsSegments || !isShallowEqual4(currentCanvasTranslate, this.canvasTranslate ?? {})) {
|
|
23468
22959
|
this.canvasTranslate = currentCanvasTranslate;
|
|
23469
22960
|
this.elementsSegments = /* @__PURE__ */ new Map();
|
|
23470
|
-
const visibleElementsMap =
|
|
22961
|
+
const visibleElementsMap = arrayToMap22(this.app.visibleElements);
|
|
23471
22962
|
for (const element of this.app.visibleElements) {
|
|
23472
22963
|
const segments = getElementLineSegments2(element, visibleElementsMap);
|
|
23473
22964
|
this.elementsSegments.set(element.id, segments);
|
|
@@ -23511,7 +23002,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
23511
23002
|
};
|
|
23512
23003
|
|
|
23513
23004
|
// eraser/index.ts
|
|
23514
|
-
import { arrayToMap as
|
|
23005
|
+
import { arrayToMap as arrayToMap23, easeOut as easeOut3, THEME as THEME12 } from "@excalidraw/common";
|
|
23515
23006
|
import {
|
|
23516
23007
|
computeBoundTextPosition as computeBoundTextPosition4,
|
|
23517
23008
|
doBoundsIntersect as doBoundsIntersect3,
|
|
@@ -23521,7 +23012,7 @@ import {
|
|
|
23521
23012
|
getFreedrawOutlineAsSegments,
|
|
23522
23013
|
getFreedrawOutlinePoints as getFreedrawOutlinePoints2,
|
|
23523
23014
|
intersectElementWithLineSegment as intersectElementWithLineSegment3,
|
|
23524
|
-
isArrowElement as
|
|
23015
|
+
isArrowElement as isArrowElement10,
|
|
23525
23016
|
isFreeDrawElement as isFreeDrawElement4,
|
|
23526
23017
|
isLineElement as isLineElement5,
|
|
23527
23018
|
isPointInElement as isPointInElement2
|
|
@@ -23529,7 +23020,7 @@ import {
|
|
|
23529
23020
|
import {
|
|
23530
23021
|
lineSegment as lineSegment9,
|
|
23531
23022
|
lineSegmentsDistance,
|
|
23532
|
-
pointFrom as
|
|
23023
|
+
pointFrom as pointFrom22,
|
|
23533
23024
|
polygon as polygon2,
|
|
23534
23025
|
polygonIncludesPointNonZero as polygonIncludesPointNonZero2
|
|
23535
23026
|
} from "@excalidraw/math";
|
|
@@ -23553,7 +23044,7 @@ var EraserTrail = class extends AnimatedTrail {
|
|
|
23553
23044
|
const l = (DECAY_LENGTH - Math.min(DECAY_LENGTH, c.totalLength - c.currentIndex)) / DECAY_LENGTH;
|
|
23554
23045
|
return Math.min(easeOut3(l), easeOut3(t2));
|
|
23555
23046
|
},
|
|
23556
|
-
fill: () => app.state.theme ===
|
|
23047
|
+
fill: () => app.state.theme === THEME12.LIGHT ? "rgba(0, 0, 0, 0.2)" : "rgba(255, 255, 255, 0.2)"
|
|
23557
23048
|
});
|
|
23558
23049
|
__publicField(this, "elementsToErase", /* @__PURE__ */ new Set());
|
|
23559
23050
|
__publicField(this, "groupsToErase", /* @__PURE__ */ new Set());
|
|
@@ -23563,13 +23054,13 @@ var EraserTrail = class extends AnimatedTrail {
|
|
|
23563
23054
|
super.startPath(x, y);
|
|
23564
23055
|
this.elementsToErase.clear();
|
|
23565
23056
|
}
|
|
23566
|
-
addPointToPath(x, y,
|
|
23057
|
+
addPointToPath(x, y, restore = false) {
|
|
23567
23058
|
super.addPointToPath(x, y);
|
|
23568
|
-
const elementsToEraser = this.updateElementsToBeErased(
|
|
23059
|
+
const elementsToEraser = this.updateElementsToBeErased(restore);
|
|
23569
23060
|
return elementsToEraser;
|
|
23570
23061
|
}
|
|
23571
23062
|
updateElementsToBeErased(restoreToErase) {
|
|
23572
|
-
const eraserPath = super.getCurrentTrail()?.originalPoints?.map((p) =>
|
|
23063
|
+
const eraserPath = super.getCurrentTrail()?.originalPoints?.map((p) => pointFrom22(p[0], p[1])) || [];
|
|
23573
23064
|
if (eraserPath.length < 2) {
|
|
23574
23065
|
return [];
|
|
23575
23066
|
}
|
|
@@ -23580,7 +23071,7 @@ var EraserTrail = class extends AnimatedTrail {
|
|
|
23580
23071
|
const candidateElements = this.app.visibleElements.filter(
|
|
23581
23072
|
(el) => !el.locked
|
|
23582
23073
|
);
|
|
23583
|
-
const candidateElementsMap =
|
|
23074
|
+
const candidateElementsMap = arrayToMap23(candidateElements);
|
|
23584
23075
|
for (const element of candidateElements) {
|
|
23585
23076
|
if (restoreToErase && this.elementsToErase.has(element.id)) {
|
|
23586
23077
|
const intersects = eraserTest(
|
|
@@ -23690,7 +23181,7 @@ var eraserTest = (pathSegment, element, elementsMap, zoom) => {
|
|
|
23690
23181
|
}
|
|
23691
23182
|
const poly = polygon2(
|
|
23692
23183
|
...outlinePoints.map(
|
|
23693
|
-
([x, y]) =>
|
|
23184
|
+
([x, y]) => pointFrom22(element.x + x, element.y + y)
|
|
23694
23185
|
)
|
|
23695
23186
|
);
|
|
23696
23187
|
if (polygonIncludesPointNonZero2(pathSegment[0], poly)) {
|
|
@@ -23699,7 +23190,7 @@ var eraserTest = (pathSegment, element, elementsMap, zoom) => {
|
|
|
23699
23190
|
return false;
|
|
23700
23191
|
}
|
|
23701
23192
|
const boundTextElement = getBoundTextElement8(element, elementsMap);
|
|
23702
|
-
if (
|
|
23193
|
+
if (isArrowElement10(element) || isLineElement5(element) && !element.polygon) {
|
|
23703
23194
|
const tolerance = Math.max(
|
|
23704
23195
|
element.strokeWidth,
|
|
23705
23196
|
element.strokeWidth * 2 / zoom
|
|
@@ -24011,7 +23502,7 @@ import {
|
|
|
24011
23502
|
CLASSES as CLASSES8,
|
|
24012
23503
|
DEFAULT_SIDEBAR as DEFAULT_SIDEBAR6,
|
|
24013
23504
|
TOOL_TYPE as TOOL_TYPE2,
|
|
24014
|
-
arrayToMap as
|
|
23505
|
+
arrayToMap as arrayToMap24,
|
|
24015
23506
|
capitalizeString as capitalizeString5,
|
|
24016
23507
|
isShallowEqual as isShallowEqual6
|
|
24017
23508
|
} from "@excalidraw/common";
|
|
@@ -24022,7 +23513,7 @@ import { ShapeCache as ShapeCache3 } from "@excalidraw/element";
|
|
|
24022
23513
|
// components/LoadingMessage.tsx
|
|
24023
23514
|
import clsx38 from "clsx";
|
|
24024
23515
|
import { useState as useState26, useEffect as useEffect31 } from "react";
|
|
24025
|
-
import { THEME as
|
|
23516
|
+
import { THEME as THEME13 } from "@excalidraw/common";
|
|
24026
23517
|
import { jsx as jsx83, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
24027
23518
|
var LoadingMessage = ({
|
|
24028
23519
|
delay,
|
|
@@ -24045,7 +23536,7 @@ var LoadingMessage = ({
|
|
|
24045
23536
|
"div",
|
|
24046
23537
|
{
|
|
24047
23538
|
className: clsx38("LoadingMessage", {
|
|
24048
|
-
"LoadingMessage--dark": theme ===
|
|
23539
|
+
"LoadingMessage--dark": theme === THEME13.DARK
|
|
24049
23540
|
}),
|
|
24050
23541
|
children: [
|
|
24051
23542
|
/* @__PURE__ */ jsx83("div", { children: /* @__PURE__ */ jsx83(Spinner_default, {}) }),
|
|
@@ -25112,7 +24603,7 @@ import {
|
|
|
25112
24603
|
import {
|
|
25113
24604
|
CLASSES as CLASSES6,
|
|
25114
24605
|
EVENT as EVENT11,
|
|
25115
|
-
isDevEnv as
|
|
24606
|
+
isDevEnv as isDevEnv7,
|
|
25116
24607
|
KEYS as KEYS48,
|
|
25117
24608
|
updateObject
|
|
25118
24609
|
} from "@excalidraw/common";
|
|
@@ -25300,7 +24791,7 @@ var SidebarInner = forwardRef4(
|
|
|
25300
24791
|
className,
|
|
25301
24792
|
...rest
|
|
25302
24793
|
}, ref) => {
|
|
25303
|
-
if (
|
|
24794
|
+
if (isDevEnv7() && onDock && docked == null) {
|
|
25304
24795
|
console.warn(
|
|
25305
24796
|
"Sidebar: `docked` must be set when `onDock` is supplied for the sidebar to be user-dockable. To hide this message, either pass `docked` or remove `onDock`"
|
|
25306
24797
|
);
|
|
@@ -25491,7 +24982,7 @@ __export(DefaultItems_exports, {
|
|
|
25491
24982
|
ToggleTheme: () => ToggleTheme
|
|
25492
24983
|
});
|
|
25493
24984
|
import clsx50 from "clsx";
|
|
25494
|
-
import { THEME as
|
|
24985
|
+
import { THEME as THEME14 } from "@excalidraw/common";
|
|
25495
24986
|
|
|
25496
24987
|
// components/OverwriteConfirm/OverwriteConfirmState.ts
|
|
25497
24988
|
var overwriteConfirmStateAtom = atom({
|
|
@@ -25746,12 +25237,12 @@ var ToggleTheme = (props) => {
|
|
|
25746
25237
|
onChange: (value) => props.onSelect(value),
|
|
25747
25238
|
choices: [
|
|
25748
25239
|
{
|
|
25749
|
-
value:
|
|
25240
|
+
value: THEME14.LIGHT,
|
|
25750
25241
|
label: SunIcon,
|
|
25751
25242
|
ariaLabel: `${t2("buttons.lightMode")} - ${shortcut}`
|
|
25752
25243
|
},
|
|
25753
25244
|
{
|
|
25754
|
-
value:
|
|
25245
|
+
value: THEME14.DARK,
|
|
25755
25246
|
label: MoonIcon,
|
|
25756
25247
|
ariaLabel: `${t2("buttons.darkMode")} - ${shortcut}`
|
|
25757
25248
|
},
|
|
@@ -25772,17 +25263,17 @@ var ToggleTheme = (props) => {
|
|
|
25772
25263
|
event.preventDefault();
|
|
25773
25264
|
if (props?.onSelect) {
|
|
25774
25265
|
props.onSelect(
|
|
25775
|
-
appState.theme ===
|
|
25266
|
+
appState.theme === THEME14.DARK ? THEME14.LIGHT : THEME14.DARK
|
|
25776
25267
|
);
|
|
25777
25268
|
} else {
|
|
25778
25269
|
return actionManager.executeAction(actionToggleTheme);
|
|
25779
25270
|
}
|
|
25780
25271
|
},
|
|
25781
|
-
icon: appState.theme ===
|
|
25272
|
+
icon: appState.theme === THEME14.DARK ? SunIcon : MoonIcon,
|
|
25782
25273
|
"data-testid": "toggle-dark-mode",
|
|
25783
25274
|
shortcut,
|
|
25784
|
-
"aria-label": appState.theme ===
|
|
25785
|
-
children: appState.theme ===
|
|
25275
|
+
"aria-label": appState.theme === THEME14.DARK ? t2("buttons.lightMode") : t2("buttons.darkMode"),
|
|
25276
|
+
children: appState.theme === THEME14.DARK ? t2("buttons.lightMode") : t2("buttons.darkMode")
|
|
25786
25277
|
}
|
|
25787
25278
|
);
|
|
25788
25279
|
};
|
|
@@ -26153,17 +25644,17 @@ import {
|
|
|
26153
25644
|
EVENT as EVENT12,
|
|
26154
25645
|
FONT_FAMILY as FONT_FAMILY4,
|
|
26155
25646
|
FRAME_STYLE as FRAME_STYLE2,
|
|
26156
|
-
getLineHeight as
|
|
25647
|
+
getLineHeight as getLineHeight3
|
|
26157
25648
|
} from "@excalidraw/common";
|
|
26158
25649
|
import { isElementCompletelyInViewport } from "@excalidraw/element";
|
|
26159
|
-
import { measureText as
|
|
25650
|
+
import { measureText as measureText5 } from "@excalidraw/element";
|
|
26160
25651
|
import {
|
|
26161
25652
|
KEYS as KEYS49,
|
|
26162
25653
|
randomInteger as randomInteger3,
|
|
26163
25654
|
addEventListener as addEventListener2,
|
|
26164
|
-
getFontString as
|
|
25655
|
+
getFontString as getFontString8
|
|
26165
25656
|
} from "@excalidraw/common";
|
|
26166
|
-
import { newTextElement as
|
|
25657
|
+
import { newTextElement as newTextElement2 } from "@excalidraw/element";
|
|
26167
25658
|
import { isTextElement as isTextElement12, isFrameLikeElement as isFrameLikeElement10 } from "@excalidraw/element";
|
|
26168
25659
|
import { getDefaultFrameName } from "@excalidraw/element/frame";
|
|
26169
25660
|
import { Fragment as Fragment18, jsx as jsx110, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -26263,7 +25754,7 @@ var SearchMenu2 = () => {
|
|
|
26263
25754
|
const match = searchMatches.items[focusIndex];
|
|
26264
25755
|
if (match) {
|
|
26265
25756
|
const zoomValue = app.state.zoom.value;
|
|
26266
|
-
const matchAsElement =
|
|
25757
|
+
const matchAsElement = newTextElement2({
|
|
26267
25758
|
text: match.searchQuery,
|
|
26268
25759
|
x: match.element.x + (match.matchedLines[0]?.offsetX ?? 0),
|
|
26269
25760
|
y: match.element.y + (match.matchedLines[0]?.offsetY ?? 0),
|
|
@@ -26622,26 +26113,26 @@ var getMatchedLines = (textElement, searchQuery, index) => {
|
|
|
26622
26113
|
);
|
|
26623
26114
|
const matchedWord = remainingQuery.slice(0, matchCapacity);
|
|
26624
26115
|
remainingQuery = remainingQuery.slice(matchCapacity);
|
|
26625
|
-
const offset =
|
|
26116
|
+
const offset = measureText5(
|
|
26626
26117
|
textToStart,
|
|
26627
|
-
|
|
26118
|
+
getFontString8(textElement),
|
|
26628
26119
|
textElement.lineHeight
|
|
26629
26120
|
);
|
|
26630
26121
|
if (textToStart === "") {
|
|
26631
26122
|
offset.width = 0;
|
|
26632
26123
|
}
|
|
26633
26124
|
if (textElement.textAlign !== "left" && lineIndexRange.line.length > 0) {
|
|
26634
|
-
const lineLength =
|
|
26125
|
+
const lineLength = measureText5(
|
|
26635
26126
|
lineIndexRange.line,
|
|
26636
|
-
|
|
26127
|
+
getFontString8(textElement),
|
|
26637
26128
|
textElement.lineHeight
|
|
26638
26129
|
);
|
|
26639
26130
|
const spaceToStart = textElement.textAlign === "center" ? (textElement.width - lineLength.width) / 2 : textElement.width - lineLength.width;
|
|
26640
26131
|
offset.width += spaceToStart;
|
|
26641
26132
|
}
|
|
26642
|
-
const { width, height } =
|
|
26133
|
+
const { width, height } = measureText5(
|
|
26643
26134
|
matchedWord,
|
|
26644
|
-
|
|
26135
|
+
getFontString8(textElement),
|
|
26645
26136
|
textElement.lineHeight
|
|
26646
26137
|
);
|
|
26647
26138
|
const offsetX = offset.width;
|
|
@@ -26662,16 +26153,16 @@ var getMatchInFrame = (frame, searchQuery, index, zoomValue) => {
|
|
|
26662
26153
|
const text = frame.name ?? getDefaultFrameName(frame);
|
|
26663
26154
|
const matchedText = text.slice(index, index + searchQuery.length);
|
|
26664
26155
|
const prefixText = text.slice(0, index);
|
|
26665
|
-
const font =
|
|
26156
|
+
const font = getFontString8({
|
|
26666
26157
|
fontSize: FRAME_STYLE2.nameFontSize,
|
|
26667
26158
|
fontFamily: FONT_FAMILY4.Assistant
|
|
26668
26159
|
});
|
|
26669
|
-
const lineHeight =
|
|
26670
|
-
const offset =
|
|
26160
|
+
const lineHeight = getLineHeight3(FONT_FAMILY4.Assistant);
|
|
26161
|
+
const offset = measureText5(prefixText, font, lineHeight);
|
|
26671
26162
|
if (prefixText === "") {
|
|
26672
26163
|
offset.width = 0;
|
|
26673
26164
|
}
|
|
26674
|
-
const matchedMetrics =
|
|
26165
|
+
const matchedMetrics = measureText5(matchedText, font, lineHeight);
|
|
26675
26166
|
const offsetX = offset.width;
|
|
26676
26167
|
const offsetY = -offset.height - FRAME_STYLE2.strokeWidth;
|
|
26677
26168
|
const width = matchedMetrics.width;
|
|
@@ -26838,7 +26329,7 @@ import { isFiniteNumber } from "@excalidraw/math";
|
|
|
26838
26329
|
|
|
26839
26330
|
// components/TTDDialog/MermaidToExcalidraw.tsx
|
|
26840
26331
|
import { useState as useState32, useRef as useRef31, useEffect as useEffect36, useDeferredValue } from "react";
|
|
26841
|
-
import { EDITOR_LS_KEYS as EDITOR_LS_KEYS3, debounce as debounce3, isDevEnv as
|
|
26332
|
+
import { EDITOR_LS_KEYS as EDITOR_LS_KEYS3, debounce as debounce3, isDevEnv as isDevEnv8 } from "@excalidraw/common";
|
|
26842
26333
|
|
|
26843
26334
|
// components/TTDDialog/TTDDialogInput.tsx
|
|
26844
26335
|
import { useEffect as useEffect35, useRef as useRef30 } from "react";
|
|
@@ -27039,7 +26530,11 @@ var convertMermaidToExcalidraw = async ({
|
|
|
27039
26530
|
elements: data.current.elements,
|
|
27040
26531
|
files: data.current.files,
|
|
27041
26532
|
exportPadding: DEFAULT_EXPORT_PADDING3,
|
|
27042
|
-
maxWidthOrHeight: Math.max(parent.offsetWidth, parent.offsetHeight) * window.devicePixelRatio
|
|
26533
|
+
maxWidthOrHeight: Math.max(parent.offsetWidth, parent.offsetHeight) * window.devicePixelRatio,
|
|
26534
|
+
appState: {
|
|
26535
|
+
// TODO hack (will be refactored in TTD v2)
|
|
26536
|
+
exportWithDarkMode: document.querySelector(".excalidraw-container")?.classList.contains("theme--dark")
|
|
26537
|
+
}
|
|
27043
26538
|
});
|
|
27044
26539
|
try {
|
|
27045
26540
|
await canvasToBlob(canvas);
|
|
@@ -27110,7 +26605,7 @@ var MermaidToExcalidraw = ({
|
|
|
27110
26605
|
setError,
|
|
27111
26606
|
mermaidDefinition: deferredText
|
|
27112
26607
|
}).catch((err) => {
|
|
27113
|
-
if (
|
|
26608
|
+
if (isDevEnv8()) {
|
|
27114
26609
|
console.error("Failed to parse mermaid definition", err);
|
|
27115
26610
|
}
|
|
27116
26611
|
});
|
|
@@ -27551,7 +27046,7 @@ import clsx56 from "clsx";
|
|
|
27551
27046
|
import throttle2 from "lodash.throttle";
|
|
27552
27047
|
import { useEffect as useEffect39, useMemo as useMemo11, useState as useState35, memo as memo5 } from "react";
|
|
27553
27048
|
import { STATS_PANELS } from "@excalidraw/common";
|
|
27554
|
-
import { getCommonBounds as
|
|
27049
|
+
import { getCommonBounds as getCommonBounds8 } from "@excalidraw/element";
|
|
27555
27050
|
import { getUncroppedWidthAndHeight as getUncroppedWidthAndHeight3 } from "@excalidraw/element";
|
|
27556
27051
|
import { isImageElement as isImageElement6 } from "@excalidraw/element";
|
|
27557
27052
|
import { frameAndChildrenSelectedTogether as frameAndChildrenSelectedTogether2 } from "@excalidraw/element";
|
|
@@ -27560,18 +27055,18 @@ import { elementsAreInSameGroup as elementsAreInSameGroup2 } from "@excalidraw/e
|
|
|
27560
27055
|
// components/Stats/Angle.tsx
|
|
27561
27056
|
import { degreesToRadians as degreesToRadians2, radiansToDegrees } from "@excalidraw/math";
|
|
27562
27057
|
import { getBoundTextElement as getBoundTextElement10 } from "@excalidraw/element";
|
|
27563
|
-
import { isArrowElement as
|
|
27058
|
+
import { isArrowElement as isArrowElement11, isElbowArrow as isElbowArrow8 } from "@excalidraw/element";
|
|
27564
27059
|
import { updateBindings as updateBindings3 } from "@excalidraw/element";
|
|
27565
27060
|
|
|
27566
27061
|
// components/Stats/DragInput.tsx
|
|
27567
27062
|
import clsx55 from "clsx";
|
|
27568
27063
|
import { useEffect as useEffect38, useRef as useRef34, useState as useState34 } from "react";
|
|
27569
|
-
import { EVENT as EVENT14, KEYS as KEYS51, cloneJSON as
|
|
27064
|
+
import { EVENT as EVENT14, KEYS as KEYS51, cloneJSON as cloneJSON3 } from "@excalidraw/common";
|
|
27570
27065
|
import { deepCopyElement as deepCopyElement4 } from "@excalidraw/element";
|
|
27571
27066
|
import { CaptureUpdateAction as CaptureUpdateAction36 } from "@excalidraw/element";
|
|
27572
27067
|
|
|
27573
27068
|
// components/Stats/utils.ts
|
|
27574
|
-
import { pointFrom as
|
|
27069
|
+
import { pointFrom as pointFrom23, pointRotateRads as pointRotateRads16 } from "@excalidraw/math";
|
|
27575
27070
|
import {
|
|
27576
27071
|
getBoundTextElement as getBoundTextElement9,
|
|
27577
27072
|
isBindingElement as isBindingElement3,
|
|
@@ -27622,15 +27117,15 @@ var moveElement = (newTopLeftX, newTopLeftY, originalElement, scene, appState, o
|
|
|
27622
27117
|
originalElement.y + originalElement.height / 2
|
|
27623
27118
|
];
|
|
27624
27119
|
const [topLeftX, topLeftY] = pointRotateRads16(
|
|
27625
|
-
|
|
27626
|
-
|
|
27120
|
+
pointFrom23(originalElement.x, originalElement.y),
|
|
27121
|
+
pointFrom23(cx, cy),
|
|
27627
27122
|
originalElement.angle
|
|
27628
27123
|
);
|
|
27629
27124
|
const changeInX = newTopLeftX - topLeftX;
|
|
27630
27125
|
const changeInY = newTopLeftY - topLeftY;
|
|
27631
27126
|
const [x, y] = pointRotateRads16(
|
|
27632
|
-
|
|
27633
|
-
|
|
27127
|
+
pointFrom23(newTopLeftX, newTopLeftY),
|
|
27128
|
+
pointFrom23(cx + changeInX, cy + changeInY),
|
|
27634
27129
|
-originalElement.angle
|
|
27635
27130
|
);
|
|
27636
27131
|
scene.mutateElement(
|
|
@@ -27672,15 +27167,15 @@ var moveElement = (newTopLeftX, newTopLeftY, originalElement, scene, appState, o
|
|
|
27672
27167
|
child.y + child.height / 2
|
|
27673
27168
|
];
|
|
27674
27169
|
const [childTopLeftX, childTopLeftY] = pointRotateRads16(
|
|
27675
|
-
|
|
27676
|
-
|
|
27170
|
+
pointFrom23(child.x, child.y),
|
|
27171
|
+
pointFrom23(childCX, childCY),
|
|
27677
27172
|
child.angle
|
|
27678
27173
|
);
|
|
27679
27174
|
const childNewTopLeftX = Math.round(childTopLeftX + changeInX);
|
|
27680
27175
|
const childNewTopLeftY = Math.round(childTopLeftY + changeInY);
|
|
27681
27176
|
const [childX, childY] = pointRotateRads16(
|
|
27682
|
-
|
|
27683
|
-
|
|
27177
|
+
pointFrom23(childNewTopLeftX, childNewTopLeftY),
|
|
27178
|
+
pointFrom23(childCX + changeInX, childCY + changeInY),
|
|
27684
27179
|
-child.angle
|
|
27685
27180
|
);
|
|
27686
27181
|
scene.mutateElement(
|
|
@@ -27737,7 +27232,7 @@ var StatsDragInput = ({
|
|
|
27737
27232
|
const stateRef = useRef34(null);
|
|
27738
27233
|
if (!stateRef.current) {
|
|
27739
27234
|
stateRef.current = {
|
|
27740
|
-
originalAppState:
|
|
27235
|
+
originalAppState: cloneJSON3(appState),
|
|
27741
27236
|
originalElements: elements,
|
|
27742
27237
|
lastUpdatedValue: inputValue,
|
|
27743
27238
|
updatePending: false
|
|
@@ -27845,7 +27340,7 @@ var StatsDragInput = ({
|
|
|
27845
27340
|
let originalElements = elements.map(
|
|
27846
27341
|
(element) => originalElementsMap.get(element.id)
|
|
27847
27342
|
);
|
|
27848
|
-
const originalAppState =
|
|
27343
|
+
const originalAppState = cloneJSON3(appState);
|
|
27849
27344
|
let accumulatedChange = 0;
|
|
27850
27345
|
let stepChange = 0;
|
|
27851
27346
|
const onPointerMove = (event2) => {
|
|
@@ -27940,7 +27435,7 @@ var StatsDragInput = ({
|
|
|
27940
27435
|
onFocus: (event) => {
|
|
27941
27436
|
event.target.select();
|
|
27942
27437
|
stateRef.current.originalElements = elements;
|
|
27943
|
-
stateRef.current.originalAppState =
|
|
27438
|
+
stateRef.current.originalAppState = cloneJSON3(appState);
|
|
27944
27439
|
},
|
|
27945
27440
|
onBlur: (event) => {
|
|
27946
27441
|
if (!inputValue) {
|
|
@@ -27987,7 +27482,7 @@ var handleDegreeChange = ({
|
|
|
27987
27482
|
});
|
|
27988
27483
|
updateBindings3(latestElement, scene, app.state);
|
|
27989
27484
|
const boundTextElement2 = getBoundTextElement10(latestElement, elementsMap);
|
|
27990
|
-
if (boundTextElement2 && !
|
|
27485
|
+
if (boundTextElement2 && !isArrowElement11(latestElement)) {
|
|
27991
27486
|
scene.mutateElement(boundTextElement2, { angle: nextAngle2 });
|
|
27992
27487
|
}
|
|
27993
27488
|
return;
|
|
@@ -28005,7 +27500,7 @@ var handleDegreeChange = ({
|
|
|
28005
27500
|
});
|
|
28006
27501
|
updateBindings3(latestElement, scene, app.state);
|
|
28007
27502
|
const boundTextElement = getBoundTextElement10(latestElement, elementsMap);
|
|
28008
|
-
if (boundTextElement && !
|
|
27503
|
+
if (boundTextElement && !isArrowElement11(latestElement)) {
|
|
28009
27504
|
scene.mutateElement(boundTextElement, { angle: nextAngle });
|
|
28010
27505
|
}
|
|
28011
27506
|
}
|
|
@@ -28349,7 +27844,7 @@ var Dimension_default = DimensionDragInput;
|
|
|
28349
27844
|
// components/Stats/FontSize.tsx
|
|
28350
27845
|
import {
|
|
28351
27846
|
getBoundTextElement as getBoundTextElement11,
|
|
28352
|
-
redrawTextBoundingBox as
|
|
27847
|
+
redrawTextBoundingBox as redrawTextBoundingBox6
|
|
28353
27848
|
} from "@excalidraw/element";
|
|
28354
27849
|
import { hasBoundTextElement as hasBoundTextElement7, isTextElement as isTextElement13 } from "@excalidraw/element";
|
|
28355
27850
|
import { jsx as jsx127 } from "react/jsx-runtime";
|
|
@@ -28387,7 +27882,7 @@ var handleFontSizeChange = ({
|
|
|
28387
27882
|
scene.mutateElement(latestElement, {
|
|
28388
27883
|
fontSize: nextFontSize
|
|
28389
27884
|
});
|
|
28390
|
-
|
|
27885
|
+
redrawTextBoundingBox6(
|
|
28391
27886
|
latestElement,
|
|
28392
27887
|
scene.getContainerElement(latestElement),
|
|
28393
27888
|
scene
|
|
@@ -28419,7 +27914,7 @@ var FontSize_default = FontSize;
|
|
|
28419
27914
|
// components/Stats/MultiAngle.tsx
|
|
28420
27915
|
import { degreesToRadians as degreesToRadians3, radiansToDegrees as radiansToDegrees2 } from "@excalidraw/math";
|
|
28421
27916
|
import { getBoundTextElement as getBoundTextElement12 } from "@excalidraw/element";
|
|
28422
|
-
import { isArrowElement as
|
|
27917
|
+
import { isArrowElement as isArrowElement12 } from "@excalidraw/element";
|
|
28423
27918
|
import { isInGroup as isInGroup2 } from "@excalidraw/element";
|
|
28424
27919
|
import { jsx as jsx128 } from "react/jsx-runtime";
|
|
28425
27920
|
var STEP_SIZE6 = 15;
|
|
@@ -28446,7 +27941,7 @@ var handleDegreeChange2 = ({
|
|
|
28446
27941
|
angle: nextAngle
|
|
28447
27942
|
});
|
|
28448
27943
|
const boundTextElement = getBoundTextElement12(element, elementsMap);
|
|
28449
|
-
if (boundTextElement && !
|
|
27944
|
+
if (boundTextElement && !isArrowElement12(element)) {
|
|
28450
27945
|
scene.mutateElement(boundTextElement, { angle: nextAngle });
|
|
28451
27946
|
}
|
|
28452
27947
|
}
|
|
@@ -28471,7 +27966,7 @@ var handleDegreeChange2 = ({
|
|
|
28471
27966
|
angle: nextAngle
|
|
28472
27967
|
});
|
|
28473
27968
|
const boundTextElement = getBoundTextElement12(latestElement, elementsMap);
|
|
28474
|
-
if (boundTextElement && !
|
|
27969
|
+
if (boundTextElement && !isArrowElement12(latestElement)) {
|
|
28475
27970
|
scene.mutateElement(boundTextElement, { angle: nextAngle });
|
|
28476
27971
|
}
|
|
28477
27972
|
}
|
|
@@ -28511,7 +28006,7 @@ var MultiAngle = ({
|
|
|
28511
28006
|
var MultiAngle_default = MultiAngle;
|
|
28512
28007
|
|
|
28513
28008
|
// components/Stats/MultiDimension.tsx
|
|
28514
|
-
import { pointFrom as
|
|
28009
|
+
import { pointFrom as pointFrom24 } from "@excalidraw/math";
|
|
28515
28010
|
import { useMemo as useMemo9 } from "react";
|
|
28516
28011
|
import { MIN_WIDTH_OR_HEIGHT as MIN_WIDTH_OR_HEIGHT2 } from "@excalidraw/common";
|
|
28517
28012
|
import {
|
|
@@ -28528,7 +28023,7 @@ import { getBoundTextElement as getBoundTextElement13, handleBindTextResize as h
|
|
|
28528
28023
|
import { isTextElement as isTextElement14 } from "@excalidraw/element";
|
|
28529
28024
|
|
|
28530
28025
|
// ../utils/src/index.ts
|
|
28531
|
-
import { getCommonBounds as
|
|
28026
|
+
import { getCommonBounds as getCommonBounds6 } from "@excalidraw/element";
|
|
28532
28027
|
|
|
28533
28028
|
// components/Stats/MultiDimension.tsx
|
|
28534
28029
|
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
@@ -28620,7 +28115,7 @@ var handleDimensionChange2 = ({
|
|
|
28620
28115
|
if (elementsInUnit.length > 1) {
|
|
28621
28116
|
const latestElements = elementsInUnit.map((el) => el.latest);
|
|
28622
28117
|
const originalElements2 = elementsInUnit.map((el) => el.original);
|
|
28623
|
-
const [x1, y1, x2, y2] =
|
|
28118
|
+
const [x1, y1, x2, y2] = getCommonBounds6(originalElements2);
|
|
28624
28119
|
const initialWidth = x2 - x1;
|
|
28625
28120
|
const initialHeight = y2 - y1;
|
|
28626
28121
|
const aspectRatio = initialWidth / initialHeight;
|
|
@@ -28637,7 +28132,7 @@ var handleDimensionChange2 = ({
|
|
|
28637
28132
|
nextHeight,
|
|
28638
28133
|
initialHeight,
|
|
28639
28134
|
aspectRatio,
|
|
28640
|
-
|
|
28135
|
+
pointFrom24(x1, y1),
|
|
28641
28136
|
property,
|
|
28642
28137
|
latestElements,
|
|
28643
28138
|
originalElements2,
|
|
@@ -28712,7 +28207,7 @@ var handleDimensionChange2 = ({
|
|
|
28712
28207
|
if (elementsInUnit.length > 1) {
|
|
28713
28208
|
const latestElements = elementsInUnit.map((el) => el.latest);
|
|
28714
28209
|
const originalElements2 = elementsInUnit.map((el) => el.original);
|
|
28715
|
-
const [x1, y1, x2, y2] =
|
|
28210
|
+
const [x1, y1, x2, y2] = getCommonBounds6(originalElements2);
|
|
28716
28211
|
const initialWidth = x2 - x1;
|
|
28717
28212
|
const initialHeight = y2 - y1;
|
|
28718
28213
|
const aspectRatio = initialWidth / initialHeight;
|
|
@@ -28739,7 +28234,7 @@ var handleDimensionChange2 = ({
|
|
|
28739
28234
|
nextHeight,
|
|
28740
28235
|
initialHeight,
|
|
28741
28236
|
aspectRatio,
|
|
28742
|
-
|
|
28237
|
+
pointFrom24(x1, y1),
|
|
28743
28238
|
property,
|
|
28744
28239
|
latestElements,
|
|
28745
28240
|
originalElements2,
|
|
@@ -28838,7 +28333,7 @@ var MultiDimension = ({
|
|
|
28838
28333
|
() => atomicUnits.map((atomicUnit) => {
|
|
28839
28334
|
const elementsInUnit = getElementsInAtomicUnit(atomicUnit, elementsMap);
|
|
28840
28335
|
if (elementsInUnit.length > 1) {
|
|
28841
|
-
const [x1, y1, x2, y2] =
|
|
28336
|
+
const [x1, y1, x2, y2] = getCommonBounds6(
|
|
28842
28337
|
elementsInUnit.map((el2) => el2.latest)
|
|
28843
28338
|
);
|
|
28844
28339
|
return Math.round((property === "width" ? x2 - x1 : y2 - y1) * 100) / 100;
|
|
@@ -28872,7 +28367,7 @@ var MultiDimension_default = MultiDimension;
|
|
|
28872
28367
|
// components/Stats/MultiFontSize.tsx
|
|
28873
28368
|
import {
|
|
28874
28369
|
getBoundTextElement as getBoundTextElement14,
|
|
28875
|
-
redrawTextBoundingBox as
|
|
28370
|
+
redrawTextBoundingBox as redrawTextBoundingBox7
|
|
28876
28371
|
} from "@excalidraw/element";
|
|
28877
28372
|
import { hasBoundTextElement as hasBoundTextElement8, isTextElement as isTextElement15 } from "@excalidraw/element";
|
|
28878
28373
|
import { isInGroup as isInGroup3 } from "@excalidraw/element";
|
|
@@ -28917,7 +28412,7 @@ var handleFontSizeChange2 = ({
|
|
|
28917
28412
|
scene.mutateElement(textElement, {
|
|
28918
28413
|
fontSize: nextFontSize
|
|
28919
28414
|
});
|
|
28920
|
-
|
|
28415
|
+
redrawTextBoundingBox7(
|
|
28921
28416
|
textElement,
|
|
28922
28417
|
scene.getContainerElement(textElement),
|
|
28923
28418
|
scene
|
|
@@ -28941,7 +28436,7 @@ var handleFontSizeChange2 = ({
|
|
|
28941
28436
|
scene.mutateElement(latestElement, {
|
|
28942
28437
|
fontSize: nextFontSize2
|
|
28943
28438
|
});
|
|
28944
|
-
|
|
28439
|
+
redrawTextBoundingBox7(
|
|
28945
28440
|
latestElement,
|
|
28946
28441
|
scene.getContainerElement(latestElement),
|
|
28947
28442
|
scene
|
|
@@ -28984,10 +28479,10 @@ var MultiFontSize = ({
|
|
|
28984
28479
|
var MultiFontSize_default = MultiFontSize;
|
|
28985
28480
|
|
|
28986
28481
|
// components/Stats/MultiPosition.tsx
|
|
28987
|
-
import { pointFrom as
|
|
28482
|
+
import { pointFrom as pointFrom25, pointRotateRads as pointRotateRads17 } from "@excalidraw/math";
|
|
28988
28483
|
import { useMemo as useMemo10 } from "react";
|
|
28989
28484
|
import { isTextElement as isTextElement16 } from "@excalidraw/element";
|
|
28990
|
-
import { getCommonBounds as
|
|
28485
|
+
import { getCommonBounds as getCommonBounds7 } from "@excalidraw/element";
|
|
28991
28486
|
import { jsx as jsx131 } from "react/jsx-runtime";
|
|
28992
28487
|
var moveElements = (property, changeInTopX, changeInTopY, originalElements, originalElementsMap, scene, appState) => {
|
|
28993
28488
|
for (let i = 0; i < originalElements.length; i++) {
|
|
@@ -28997,8 +28492,8 @@ var moveElements = (property, changeInTopX, changeInTopY, originalElements, orig
|
|
|
28997
28492
|
origElement.y + origElement.height / 2
|
|
28998
28493
|
];
|
|
28999
28494
|
const [topLeftX, topLeftY] = pointRotateRads17(
|
|
29000
|
-
|
|
29001
|
-
|
|
28495
|
+
pointFrom25(origElement.x, origElement.y),
|
|
28496
|
+
pointFrom25(cx, cy),
|
|
29002
28497
|
origElement.angle
|
|
29003
28498
|
);
|
|
29004
28499
|
const newTopLeftX = property === "x" ? Math.round(topLeftX + changeInTopX) : topLeftX;
|
|
@@ -29016,7 +28511,7 @@ var moveElements = (property, changeInTopX, changeInTopY, originalElements, orig
|
|
|
29016
28511
|
};
|
|
29017
28512
|
var moveGroupTo = (nextX, nextY, originalElements, originalElementsMap, scene, appState) => {
|
|
29018
28513
|
const elementsMap = scene.getNonDeletedElementsMap();
|
|
29019
|
-
const [x1, y1, ,] =
|
|
28514
|
+
const [x1, y1, ,] = getCommonBounds7(originalElements);
|
|
29020
28515
|
const offsetX = nextX - x1;
|
|
29021
28516
|
const offsetY = nextY - y1;
|
|
29022
28517
|
for (let i = 0; i < originalElements.length; i++) {
|
|
@@ -29031,8 +28526,8 @@ var moveGroupTo = (nextX, nextY, originalElements, originalElementsMap, scene, a
|
|
|
29031
28526
|
latestElement.y + latestElement.height / 2
|
|
29032
28527
|
];
|
|
29033
28528
|
const [topLeftX, topLeftY] = pointRotateRads17(
|
|
29034
|
-
|
|
29035
|
-
|
|
28529
|
+
pointFrom25(latestElement.x, latestElement.y),
|
|
28530
|
+
pointFrom25(cx, cy),
|
|
29036
28531
|
latestElement.angle
|
|
29037
28532
|
);
|
|
29038
28533
|
moveElement(
|
|
@@ -29070,7 +28565,7 @@ var handlePositionChange = ({
|
|
|
29070
28565
|
originalElementsMap
|
|
29071
28566
|
);
|
|
29072
28567
|
if (elementsInUnit.length > 1) {
|
|
29073
|
-
const [x1, y1, ,] =
|
|
28568
|
+
const [x1, y1, ,] = getCommonBounds7(
|
|
29074
28569
|
elementsInUnit.map((el) => el.latest)
|
|
29075
28570
|
);
|
|
29076
28571
|
const newTopLeftX = property === "x" ? nextValue : x1;
|
|
@@ -29092,8 +28587,8 @@ var handlePositionChange = ({
|
|
|
29092
28587
|
origElement.y + origElement.height / 2
|
|
29093
28588
|
];
|
|
29094
28589
|
const [topLeftX, topLeftY] = pointRotateRads17(
|
|
29095
|
-
|
|
29096
|
-
|
|
28590
|
+
pointFrom25(origElement.x, origElement.y),
|
|
28591
|
+
pointFrom25(cx, cy),
|
|
29097
28592
|
origElement.angle
|
|
29098
28593
|
);
|
|
29099
28594
|
const newTopLeftX = property === "x" ? nextValue : topLeftX;
|
|
@@ -29139,14 +28634,14 @@ var MultiPosition = ({
|
|
|
29139
28634
|
() => atomicUnits.map((atomicUnit) => {
|
|
29140
28635
|
const elementsInUnit = Object.keys(atomicUnit).map((id) => elementsMap.get(id)).filter((el2) => el2 !== void 0);
|
|
29141
28636
|
if (elementsInUnit.length > 1) {
|
|
29142
|
-
const [x1, y1] =
|
|
28637
|
+
const [x1, y1] = getCommonBounds7(elementsInUnit);
|
|
29143
28638
|
return Math.round((property === "x" ? x1 : y1) * 100) / 100;
|
|
29144
28639
|
}
|
|
29145
28640
|
const [el] = elementsInUnit;
|
|
29146
28641
|
const [cx, cy] = [el.x + el.width / 2, el.y + el.height / 2];
|
|
29147
28642
|
const [topLeftX, topLeftY] = pointRotateRads17(
|
|
29148
|
-
|
|
29149
|
-
|
|
28643
|
+
pointFrom25(el.x, el.y),
|
|
28644
|
+
pointFrom25(cx, cy),
|
|
29150
28645
|
el.angle
|
|
29151
28646
|
);
|
|
29152
28647
|
return Math.round((property === "x" ? topLeftX : topLeftY) * 100) / 100;
|
|
@@ -29170,7 +28665,7 @@ var MultiPosition = ({
|
|
|
29170
28665
|
var MultiPosition_default = MultiPosition;
|
|
29171
28666
|
|
|
29172
28667
|
// components/Stats/Position.tsx
|
|
29173
|
-
import { clamp as clamp6, pointFrom as
|
|
28668
|
+
import { clamp as clamp6, pointFrom as pointFrom26, pointRotateRads as pointRotateRads18, round as round4 } from "@excalidraw/math";
|
|
29174
28669
|
import {
|
|
29175
28670
|
getFlipAdjustedCropPosition,
|
|
29176
28671
|
getUncroppedWidthAndHeight as getUncroppedWidthAndHeight2
|
|
@@ -29196,8 +28691,8 @@ var handlePositionChange2 = ({
|
|
|
29196
28691
|
origElement.y + origElement.height / 2
|
|
29197
28692
|
];
|
|
29198
28693
|
const [topLeftX, topLeftY] = pointRotateRads18(
|
|
29199
|
-
|
|
29200
|
-
|
|
28694
|
+
pointFrom26(origElement.x, origElement.y),
|
|
28695
|
+
pointFrom26(cx, cy),
|
|
29201
28696
|
origElement.angle
|
|
29202
28697
|
);
|
|
29203
28698
|
if (originalAppState.croppingElementId === origElement.id) {
|
|
@@ -29298,8 +28793,8 @@ var Position = ({
|
|
|
29298
28793
|
appState
|
|
29299
28794
|
}) => {
|
|
29300
28795
|
const [topLeftX, topLeftY] = pointRotateRads18(
|
|
29301
|
-
|
|
29302
|
-
|
|
28796
|
+
pointFrom26(element.x, element.y),
|
|
28797
|
+
pointFrom26(element.x + element.width / 2, element.y + element.height / 2),
|
|
29303
28798
|
element.angle
|
|
29304
28799
|
);
|
|
29305
28800
|
let value = round4(property === "x" ? topLeftX : topLeftY, 2);
|
|
@@ -29401,7 +28896,7 @@ var StatsInner = memo5(
|
|
|
29401
28896
|
});
|
|
29402
28897
|
const throttledSetSceneDimension = useMemo11(
|
|
29403
28898
|
() => throttle2((elements2) => {
|
|
29404
|
-
const boundingBox =
|
|
28899
|
+
const boundingBox = getCommonBounds8(elements2);
|
|
29405
28900
|
setSceneDimension({
|
|
29406
28901
|
width: Math.round(boundingBox[2]) - Math.round(boundingBox[0]),
|
|
29407
28902
|
height: Math.round(boundingBox[3]) - Math.round(boundingBox[1])
|
|
@@ -30548,6 +30043,13 @@ var getHints = ({
|
|
|
30548
30043
|
shortcut: getTaggedShortcutKey("Alt")
|
|
30549
30044
|
});
|
|
30550
30045
|
}
|
|
30046
|
+
const selectedElements = app.scene.getSelectedElements(appState);
|
|
30047
|
+
if (appState.selectedLinearElement?.isDragging && selectedElements[0]?.type === "arrow") {
|
|
30048
|
+
return t("hints.arrowBindModifiers", {
|
|
30049
|
+
shortcut_1: getTaggedShortcutKey("Ctrl"),
|
|
30050
|
+
shortcut_2: getTaggedShortcutKey("Alt")
|
|
30051
|
+
});
|
|
30052
|
+
}
|
|
30551
30053
|
if (activeTool.type === "arrow" || activeTool.type === "line") {
|
|
30552
30054
|
if (multiMode) {
|
|
30553
30055
|
return t("hints.linearElementMulti", {
|
|
@@ -30571,7 +30073,6 @@ var getHints = ({
|
|
|
30571
30073
|
if (activeTool.type === "embeddable") {
|
|
30572
30074
|
return t("hints.embeddable");
|
|
30573
30075
|
}
|
|
30574
|
-
const selectedElements = app.scene.getSelectedElements(appState);
|
|
30575
30076
|
if (isResizing && lastPointerDownWith === "mouse" && selectedElements.length === 1) {
|
|
30576
30077
|
const targetElement = selectedElements[0];
|
|
30577
30078
|
if (isLinearElement10(targetElement) && targetElement.points.length === 2) {
|
|
@@ -30704,7 +30205,7 @@ import {
|
|
|
30704
30205
|
EXPORT_IMAGE_TYPES,
|
|
30705
30206
|
isFirefox as isFirefox4,
|
|
30706
30207
|
EXPORT_SCALES as EXPORT_SCALES2,
|
|
30707
|
-
cloneJSON as
|
|
30208
|
+
cloneJSON as cloneJSON4
|
|
30708
30209
|
} from "@excalidraw/common";
|
|
30709
30210
|
|
|
30710
30211
|
// hooks/useCopiedIndicator.ts
|
|
@@ -30761,7 +30262,6 @@ var Switch = ({
|
|
|
30761
30262
|
|
|
30762
30263
|
// components/ImageExportDialog.tsx
|
|
30763
30264
|
import { jsx as jsx139, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
30764
|
-
var supportsContextFilters = "filter" in document.createElement("canvas").getContext("2d");
|
|
30765
30265
|
var ErrorCanvasPreview = () => {
|
|
30766
30266
|
return /* @__PURE__ */ jsxs75("div", { children: [
|
|
30767
30267
|
/* @__PURE__ */ jsx139("h3", { children: t("canvasError.cannotShowPreview") }),
|
|
@@ -30927,7 +30427,7 @@ var ImageExportModal = ({
|
|
|
30927
30427
|
)
|
|
30928
30428
|
}
|
|
30929
30429
|
),
|
|
30930
|
-
|
|
30430
|
+
/* @__PURE__ */ jsx139(
|
|
30931
30431
|
ExportSetting,
|
|
30932
30432
|
{
|
|
30933
30433
|
label: t("imageExportDialog.label.darkMode"),
|
|
@@ -31075,8 +30575,8 @@ var ImageExportDialog = ({
|
|
|
31075
30575
|
}) => {
|
|
31076
30576
|
const [{ appStateSnapshot, elementsSnapshot }] = useState39(() => {
|
|
31077
30577
|
return {
|
|
31078
|
-
appStateSnapshot:
|
|
31079
|
-
elementsSnapshot:
|
|
30578
|
+
appStateSnapshot: cloneJSON4(appState),
|
|
30579
|
+
elementsSnapshot: cloneJSON4(elements)
|
|
31080
30580
|
};
|
|
31081
30581
|
});
|
|
31082
30582
|
return /* @__PURE__ */ jsx139(Dialog, { onCloseRequest, size: "wide", title: false, children: /* @__PURE__ */ jsx139(
|
|
@@ -31610,7 +31110,7 @@ var LayerUI = ({
|
|
|
31610
31110
|
}
|
|
31611
31111
|
if (selectedElements.length) {
|
|
31612
31112
|
for (const element of selectedElements) {
|
|
31613
|
-
mutateElement5(element,
|
|
31113
|
+
mutateElement5(element, arrayToMap24(elements), {
|
|
31614
31114
|
[altKey && eyeDropperState.swapPreviewOnAlt ? colorPickerType === "elementBackground" ? "strokeColor" : "backgroundColor" : colorPickerType === "elementBackground" ? "backgroundColor" : "strokeColor"]: color
|
|
31615
31115
|
});
|
|
31616
31116
|
ShapeCache3.delete(element);
|
|
@@ -31727,14 +31227,7 @@ var LayerUI = ({
|
|
|
31727
31227
|
return /* @__PURE__ */ jsx143(UIAppStateContext.Provider, { value: appState, children: /* @__PURE__ */ jsx143(TunnelsJotaiProvider, { children: /* @__PURE__ */ jsx143(TunnelsContext.Provider, { value: tunnels, children: layerUIJSX }) }) });
|
|
31728
31228
|
};
|
|
31729
31229
|
var stripIrrelevantAppStateProps = (appState) => {
|
|
31730
|
-
const {
|
|
31731
|
-
suggestedBinding,
|
|
31732
|
-
startBoundElement,
|
|
31733
|
-
cursorButton,
|
|
31734
|
-
scrollX,
|
|
31735
|
-
scrollY,
|
|
31736
|
-
...ret
|
|
31737
|
-
} = appState;
|
|
31230
|
+
const { startBoundElement, cursorButton, scrollX, scrollY, ...ret } = appState;
|
|
31738
31231
|
return ret;
|
|
31739
31232
|
};
|
|
31740
31233
|
var areEqual2 = (prevProps, nextProps) => {
|
|
@@ -31882,18 +31375,18 @@ var AnimationController = _AnimationController;
|
|
|
31882
31375
|
// renderer/interactiveScene.ts
|
|
31883
31376
|
import {
|
|
31884
31377
|
clamp as clamp7,
|
|
31885
|
-
pointFrom as
|
|
31378
|
+
pointFrom as pointFrom28,
|
|
31886
31379
|
pointsEqual as pointsEqual7
|
|
31887
31380
|
} from "@excalidraw/math";
|
|
31888
31381
|
import oc3 from "open-color";
|
|
31889
31382
|
import {
|
|
31890
|
-
arrayToMap as
|
|
31383
|
+
arrayToMap as arrayToMap25,
|
|
31891
31384
|
BIND_MODE_TIMEOUT,
|
|
31892
31385
|
DEFAULT_TRANSFORM_HANDLE_SPACING,
|
|
31893
31386
|
FRAME_STYLE as FRAME_STYLE3,
|
|
31894
31387
|
getFeatureFlag as getFeatureFlag3,
|
|
31895
31388
|
invariant as invariant15,
|
|
31896
|
-
THEME as
|
|
31389
|
+
THEME as THEME16
|
|
31897
31390
|
} from "@excalidraw/common";
|
|
31898
31391
|
import {
|
|
31899
31392
|
deconstructDiamondElement as deconstructDiamondElement2,
|
|
@@ -31909,7 +31402,7 @@ import {
|
|
|
31909
31402
|
isLinearElement as isLinearElement11,
|
|
31910
31403
|
isLineElement as isLineElement7,
|
|
31911
31404
|
isTextElement as isTextElement18,
|
|
31912
|
-
LinearElementEditor as
|
|
31405
|
+
LinearElementEditor as LinearElementEditor10
|
|
31913
31406
|
} from "@excalidraw/element";
|
|
31914
31407
|
import { renderSelectionElement } from "@excalidraw/element";
|
|
31915
31408
|
import {
|
|
@@ -31918,11 +31411,11 @@ import {
|
|
|
31918
31411
|
isSelectedViaGroup,
|
|
31919
31412
|
selectGroupsFromGivenElements as selectGroupsFromGivenElements3
|
|
31920
31413
|
} from "@excalidraw/element";
|
|
31921
|
-
import { getCommonBounds as
|
|
31414
|
+
import { getCommonBounds as getCommonBounds9, getElementAbsoluteCoords as getElementAbsoluteCoords7 } from "@excalidraw/element";
|
|
31922
31415
|
|
|
31923
31416
|
// renderer/renderSnaps.ts
|
|
31924
|
-
import { pointFrom as
|
|
31925
|
-
import { THEME as
|
|
31417
|
+
import { pointFrom as pointFrom27 } from "@excalidraw/math";
|
|
31418
|
+
import { THEME as THEME15 } from "@excalidraw/common";
|
|
31926
31419
|
var SNAP_COLOR_LIGHT = "#ff6b6b";
|
|
31927
31420
|
var SNAP_COLOR_DARK = "#ff0000";
|
|
31928
31421
|
var SNAP_WIDTH = 1;
|
|
@@ -31931,7 +31424,7 @@ var renderSnaps = (context, appState) => {
|
|
|
31931
31424
|
if (!appState.snapLines.length) {
|
|
31932
31425
|
return;
|
|
31933
31426
|
}
|
|
31934
|
-
const snapColor = appState.theme ===
|
|
31427
|
+
const snapColor = appState.theme === THEME15.LIGHT || appState.zenModeEnabled ? SNAP_COLOR_LIGHT : SNAP_COLOR_DARK;
|
|
31935
31428
|
const snapWidth = (appState.zenModeEnabled ? SNAP_WIDTH * 1.5 : SNAP_WIDTH) / appState.zoom.value;
|
|
31936
31429
|
context.save();
|
|
31937
31430
|
context.translate(appState.scrollX, appState.scrollY);
|
|
@@ -31999,25 +31492,25 @@ var drawGapLine = (from, to, direction, appState, context) => {
|
|
|
31999
31492
|
const halfPoint = [(from[0] + to[0]) / 2, from[1]];
|
|
32000
31493
|
if (!appState.zenModeEnabled) {
|
|
32001
31494
|
drawLine(
|
|
32002
|
-
|
|
32003
|
-
|
|
31495
|
+
pointFrom27(from[0], from[1] - FULL),
|
|
31496
|
+
pointFrom27(from[0], from[1] + FULL),
|
|
32004
31497
|
context
|
|
32005
31498
|
);
|
|
32006
31499
|
}
|
|
32007
31500
|
drawLine(
|
|
32008
|
-
|
|
32009
|
-
|
|
31501
|
+
pointFrom27(halfPoint[0] - QUARTER, halfPoint[1] - HALF),
|
|
31502
|
+
pointFrom27(halfPoint[0] - QUARTER, halfPoint[1] + HALF),
|
|
32010
31503
|
context
|
|
32011
31504
|
);
|
|
32012
31505
|
drawLine(
|
|
32013
|
-
|
|
32014
|
-
|
|
31506
|
+
pointFrom27(halfPoint[0] + QUARTER, halfPoint[1] - HALF),
|
|
31507
|
+
pointFrom27(halfPoint[0] + QUARTER, halfPoint[1] + HALF),
|
|
32015
31508
|
context
|
|
32016
31509
|
);
|
|
32017
31510
|
if (!appState.zenModeEnabled) {
|
|
32018
31511
|
drawLine(
|
|
32019
|
-
|
|
32020
|
-
|
|
31512
|
+
pointFrom27(to[0], to[1] - FULL),
|
|
31513
|
+
pointFrom27(to[0], to[1] + FULL),
|
|
32021
31514
|
context
|
|
32022
31515
|
);
|
|
32023
31516
|
drawLine(from, to, context);
|
|
@@ -32026,25 +31519,25 @@ var drawGapLine = (from, to, direction, appState, context) => {
|
|
|
32026
31519
|
const halfPoint = [from[0], (from[1] + to[1]) / 2];
|
|
32027
31520
|
if (!appState.zenModeEnabled) {
|
|
32028
31521
|
drawLine(
|
|
32029
|
-
|
|
32030
|
-
|
|
31522
|
+
pointFrom27(from[0] - FULL, from[1]),
|
|
31523
|
+
pointFrom27(from[0] + FULL, from[1]),
|
|
32031
31524
|
context
|
|
32032
31525
|
);
|
|
32033
31526
|
}
|
|
32034
31527
|
drawLine(
|
|
32035
|
-
|
|
32036
|
-
|
|
31528
|
+
pointFrom27(halfPoint[0] - HALF, halfPoint[1] - QUARTER),
|
|
31529
|
+
pointFrom27(halfPoint[0] + HALF, halfPoint[1] - QUARTER),
|
|
32037
31530
|
context
|
|
32038
31531
|
);
|
|
32039
31532
|
drawLine(
|
|
32040
|
-
|
|
32041
|
-
|
|
31533
|
+
pointFrom27(halfPoint[0] - HALF, halfPoint[1] + QUARTER),
|
|
31534
|
+
pointFrom27(halfPoint[0] + HALF, halfPoint[1] + QUARTER),
|
|
32042
31535
|
context
|
|
32043
31536
|
);
|
|
32044
31537
|
if (!appState.zenModeEnabled) {
|
|
32045
31538
|
drawLine(
|
|
32046
|
-
|
|
32047
|
-
|
|
31539
|
+
pointFrom27(to[0] - FULL, to[1]),
|
|
31540
|
+
pointFrom27(to[0] + FULL, to[1]),
|
|
32048
31541
|
context
|
|
32049
31542
|
);
|
|
32050
31543
|
drawLine(from, to, context);
|
|
@@ -32069,11 +31562,11 @@ var renderLinearElementPointHighlight = (context, appState, elementsMap) => {
|
|
|
32069
31562
|
)) {
|
|
32070
31563
|
return;
|
|
32071
31564
|
}
|
|
32072
|
-
const element =
|
|
31565
|
+
const element = LinearElementEditor10.getElement(elementId, elementsMap);
|
|
32073
31566
|
if (!element) {
|
|
32074
31567
|
return;
|
|
32075
31568
|
}
|
|
32076
|
-
const point =
|
|
31569
|
+
const point = LinearElementEditor10.getPointAtIndexGlobalCoordinates(
|
|
32077
31570
|
element,
|
|
32078
31571
|
hoverPointIndex,
|
|
32079
31572
|
elementsMap
|
|
@@ -32089,7 +31582,7 @@ var highlightPoint = (point, context, appState) => {
|
|
|
32089
31582
|
context,
|
|
32090
31583
|
point[0],
|
|
32091
31584
|
point[1],
|
|
32092
|
-
|
|
31585
|
+
LinearElementEditor10.POINT_HANDLE_SIZE / appState.zoom.value,
|
|
32093
31586
|
false
|
|
32094
31587
|
);
|
|
32095
31588
|
};
|
|
@@ -32114,10 +31607,7 @@ var renderSingleLinearPoint = (context, appState, point, radius, isSelected, isP
|
|
|
32114
31607
|
var renderBindingHighlightForBindableElement_simple = (context, element, elementsMap, appState) => {
|
|
32115
31608
|
const enclosingFrame = element.frameId && elementsMap.get(element.frameId);
|
|
32116
31609
|
if (enclosingFrame && isFrameLikeElement14(enclosingFrame)) {
|
|
32117
|
-
context.translate(
|
|
32118
|
-
enclosingFrame.x + appState.scrollX,
|
|
32119
|
-
enclosingFrame.y + appState.scrollY
|
|
32120
|
-
);
|
|
31610
|
+
context.translate(enclosingFrame.x, enclosingFrame.y);
|
|
32121
31611
|
context.beginPath();
|
|
32122
31612
|
if (FRAME_STYLE3.radius && context.roundRect) {
|
|
32123
31613
|
context.roundRect(
|
|
@@ -32131,21 +31621,15 @@ var renderBindingHighlightForBindableElement_simple = (context, element, element
|
|
|
32131
31621
|
context.rect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1);
|
|
32132
31622
|
}
|
|
32133
31623
|
context.clip();
|
|
32134
|
-
context.translate(
|
|
32135
|
-
-(enclosingFrame.x + appState.scrollX),
|
|
32136
|
-
-(enclosingFrame.y + appState.scrollY)
|
|
32137
|
-
);
|
|
31624
|
+
context.translate(-enclosingFrame.x, -enclosingFrame.y);
|
|
32138
31625
|
}
|
|
32139
31626
|
switch (element.type) {
|
|
32140
31627
|
case "magicframe":
|
|
32141
31628
|
case "frame":
|
|
32142
31629
|
context.save();
|
|
32143
|
-
context.translate(
|
|
32144
|
-
element.x + appState.scrollX,
|
|
32145
|
-
element.y + appState.scrollY
|
|
32146
|
-
);
|
|
31630
|
+
context.translate(element.x, element.y);
|
|
32147
31631
|
context.lineWidth = FRAME_STYLE3.strokeWidth / appState.zoom.value;
|
|
32148
|
-
context.strokeStyle = appState.theme ===
|
|
31632
|
+
context.strokeStyle = appState.theme === THEME16.DARK ? `rgba(3, 93, 161, 1)` : `rgba(106, 189, 252, 1)`;
|
|
32149
31633
|
if (FRAME_STYLE3.radius && context.roundRect) {
|
|
32150
31634
|
context.beginPath();
|
|
32151
31635
|
context.roundRect(
|
|
@@ -32170,7 +31654,7 @@ var renderBindingHighlightForBindableElement_simple = (context, element, element
|
|
|
32170
31654
|
context.translate(-center[0], -center[1]);
|
|
32171
31655
|
context.translate(element.x, element.y);
|
|
32172
31656
|
context.lineWidth = clamp7(1.75, element.strokeWidth, 4) / Math.max(0.25, appState.zoom.value);
|
|
32173
|
-
context.strokeStyle = appState.theme ===
|
|
31657
|
+
context.strokeStyle = appState.theme === THEME16.DARK ? `rgba(3, 93, 161, 1)` : `rgba(106, 189, 252, 1)`;
|
|
32174
31658
|
switch (element.type) {
|
|
32175
31659
|
case "ellipse":
|
|
32176
31660
|
context.beginPath();
|
|
@@ -32260,10 +31744,7 @@ var renderBindingHighlightForBindableElement_complex = (app, context, element, a
|
|
|
32260
31744
|
const offset = element.strokeWidth / 2;
|
|
32261
31745
|
const enclosingFrame = element.frameId && allElementsMap.get(element.frameId);
|
|
32262
31746
|
if (enclosingFrame && isFrameLikeElement14(enclosingFrame)) {
|
|
32263
|
-
context.translate(
|
|
32264
|
-
enclosingFrame.x + appState.scrollX,
|
|
32265
|
-
enclosingFrame.y + appState.scrollY
|
|
32266
|
-
);
|
|
31747
|
+
context.translate(enclosingFrame.x, enclosingFrame.y);
|
|
32267
31748
|
context.beginPath();
|
|
32268
31749
|
if (FRAME_STYLE3.radius && context.roundRect) {
|
|
32269
31750
|
context.roundRect(
|
|
@@ -32277,21 +31758,15 @@ var renderBindingHighlightForBindableElement_complex = (app, context, element, a
|
|
|
32277
31758
|
context.rect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1);
|
|
32278
31759
|
}
|
|
32279
31760
|
context.clip();
|
|
32280
|
-
context.translate(
|
|
32281
|
-
-(enclosingFrame.x + appState.scrollX),
|
|
32282
|
-
-(enclosingFrame.y + appState.scrollY)
|
|
32283
|
-
);
|
|
31761
|
+
context.translate(-enclosingFrame.x, -enclosingFrame.y);
|
|
32284
31762
|
}
|
|
32285
31763
|
switch (element.type) {
|
|
32286
31764
|
case "magicframe":
|
|
32287
31765
|
case "frame":
|
|
32288
31766
|
context.save();
|
|
32289
|
-
context.translate(
|
|
32290
|
-
element.x + appState.scrollX,
|
|
32291
|
-
element.y + appState.scrollY
|
|
32292
|
-
);
|
|
31767
|
+
context.translate(element.x, element.y);
|
|
32293
31768
|
context.lineWidth = FRAME_STYLE3.strokeWidth / appState.zoom.value;
|
|
32294
|
-
context.strokeStyle = appState.theme ===
|
|
31769
|
+
context.strokeStyle = appState.theme === THEME16.DARK ? `rgba(3, 93, 161, ${opacity})` : `rgba(106, 189, 252, ${opacity})`;
|
|
32295
31770
|
if (FRAME_STYLE3.radius && context.roundRect) {
|
|
32296
31771
|
context.beginPath();
|
|
32297
31772
|
context.roundRect(
|
|
@@ -32321,7 +31796,7 @@ var renderBindingHighlightForBindableElement_complex = (app, context, element, a
|
|
|
32321
31796
|
element.y + appState.scrollY - offset
|
|
32322
31797
|
);
|
|
32323
31798
|
context.lineWidth = clamp7(2.5, element.strokeWidth * 1.75, 4) / Math.max(0.25, appState.zoom.value);
|
|
32324
|
-
context.strokeStyle = appState.theme ===
|
|
31799
|
+
context.strokeStyle = appState.theme === THEME16.DARK ? `rgba(3, 93, 161, ${opacity / 2})` : `rgba(106, 189, 252, ${opacity / 2})`;
|
|
32325
31800
|
switch (element.type) {
|
|
32326
31801
|
case "ellipse":
|
|
32327
31802
|
context.beginPath();
|
|
@@ -32557,7 +32032,7 @@ var renderElementsBoxHighlight = (context, appState, elements, config) => {
|
|
|
32557
32032
|
(element) => element.groupIds.length > 0
|
|
32558
32033
|
);
|
|
32559
32034
|
const getSelectionFromElements = (elements2) => {
|
|
32560
|
-
const [x1, y1, x2, y2] =
|
|
32035
|
+
const [x1, y1, x2, y2] = getCommonBounds9(elements2);
|
|
32561
32036
|
return {
|
|
32562
32037
|
angle: 0,
|
|
32563
32038
|
x1,
|
|
@@ -32588,11 +32063,11 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
32588
32063
|
context.save();
|
|
32589
32064
|
context.translate(appState.scrollX, appState.scrollY);
|
|
32590
32065
|
context.lineWidth = 1 / appState.zoom.value;
|
|
32591
|
-
const points =
|
|
32066
|
+
const points = LinearElementEditor10.getPointsGlobalCoordinates(
|
|
32592
32067
|
element,
|
|
32593
32068
|
elementsMap
|
|
32594
32069
|
);
|
|
32595
|
-
const { POINT_HANDLE_SIZE } =
|
|
32070
|
+
const { POINT_HANDLE_SIZE } = LinearElementEditor10;
|
|
32596
32071
|
const radius = appState.selectedLinearElement?.isEditing ? POINT_HANDLE_SIZE : POINT_HANDLE_SIZE / 2;
|
|
32597
32072
|
const _isElbowArrow = isElbowArrow9(element);
|
|
32598
32073
|
const _isLineElement = isLineElement7(element);
|
|
@@ -32622,7 +32097,7 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
32622
32097
|
if (isElbowArrow9(element)) {
|
|
32623
32098
|
const fixedSegments = element.fixedSegments?.map((segment) => segment.index) || [];
|
|
32624
32099
|
points.slice(0, -1).forEach((p, idx) => {
|
|
32625
|
-
if (!
|
|
32100
|
+
if (!LinearElementEditor10.isSegmentTooShort(
|
|
32626
32101
|
element,
|
|
32627
32102
|
points[idx + 1],
|
|
32628
32103
|
points[idx],
|
|
@@ -32632,7 +32107,7 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
32632
32107
|
renderSingleLinearPoint(
|
|
32633
32108
|
context,
|
|
32634
32109
|
appState,
|
|
32635
|
-
|
|
32110
|
+
pointFrom28(
|
|
32636
32111
|
(p[0] + points[idx + 1][0]) / 2,
|
|
32637
32112
|
(p[1] + points[idx + 1][1]) / 2
|
|
32638
32113
|
),
|
|
@@ -32644,7 +32119,7 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
32644
32119
|
}
|
|
32645
32120
|
});
|
|
32646
32121
|
} else {
|
|
32647
|
-
const midPoints =
|
|
32122
|
+
const midPoints = LinearElementEditor10.getEditorMidPoints(
|
|
32648
32123
|
element,
|
|
32649
32124
|
elementsMap,
|
|
32650
32125
|
appState
|
|
@@ -32946,7 +32421,7 @@ var _renderInteractiveScene = ({
|
|
|
32946
32421
|
}
|
|
32947
32422
|
const selectionColor = renderConfig.selectionColor || oc3.black;
|
|
32948
32423
|
if (showBoundingBox) {
|
|
32949
|
-
const locallySelectedIds =
|
|
32424
|
+
const locallySelectedIds = arrayToMap25(selectedElements);
|
|
32950
32425
|
const selections = [];
|
|
32951
32426
|
for (const element of elementsMap.values()) {
|
|
32952
32427
|
const selectionColors = [];
|
|
@@ -32993,7 +32468,7 @@ var _renderInteractiveScene = ({
|
|
|
32993
32468
|
}
|
|
32994
32469
|
const addSelectionForGroupId = (groupId) => {
|
|
32995
32470
|
const groupElements = getElementsInGroup7(elementsMap, groupId);
|
|
32996
|
-
const [x1, y1, x2, y2] =
|
|
32471
|
+
const [x1, y1, x2, y2] = getCommonBounds9(groupElements);
|
|
32997
32472
|
selections.push({
|
|
32998
32473
|
angle: 0,
|
|
32999
32474
|
x1,
|
|
@@ -33055,7 +32530,7 @@ var _renderInteractiveScene = ({
|
|
|
33055
32530
|
} else if (selectedElements.length > 1 && !appState.isRotating && !selectedElements.some((el) => el.locked)) {
|
|
33056
32531
|
const dashedLinePadding = DEFAULT_TRANSFORM_HANDLE_SPACING * 2 / appState.zoom.value;
|
|
33057
32532
|
context.fillStyle = oc3.white;
|
|
33058
|
-
const [x1, y1, x2, y2] =
|
|
32533
|
+
const [x1, y1, x2, y2] = getCommonBounds9(selectedElements, elementsMap);
|
|
33059
32534
|
const initialLineDash = context.getLineDash();
|
|
33060
32535
|
context.setLineDash([2 / appState.zoom.value]);
|
|
33061
32536
|
const lineWidth = context.lineWidth;
|
|
@@ -33104,7 +32579,7 @@ var _renderInteractiveScene = ({
|
|
|
33104
32579
|
true
|
|
33105
32580
|
);
|
|
33106
32581
|
context.save();
|
|
33107
|
-
if (appState.theme ===
|
|
32582
|
+
if (appState.theme === THEME16.LIGHT) {
|
|
33108
32583
|
if (focus) {
|
|
33109
32584
|
context.fillStyle = "rgba(255, 124, 0, 0.4)";
|
|
33110
32585
|
} else {
|
|
@@ -33450,7 +32925,7 @@ import {
|
|
|
33450
32925
|
var _renderNewElementScene = ({
|
|
33451
32926
|
canvas,
|
|
33452
32927
|
rc,
|
|
33453
|
-
newElement:
|
|
32928
|
+
newElement: newElement5,
|
|
33454
32929
|
elementsMap,
|
|
33455
32930
|
allElementsMap,
|
|
33456
32931
|
scale,
|
|
@@ -33470,19 +32945,19 @@ var _renderNewElementScene = ({
|
|
|
33470
32945
|
});
|
|
33471
32946
|
context.save();
|
|
33472
32947
|
context.scale(appState.zoom.value, appState.zoom.value);
|
|
33473
|
-
if (
|
|
33474
|
-
if (isInvisiblySmallElement2(
|
|
32948
|
+
if (newElement5 && newElement5.type !== "selection") {
|
|
32949
|
+
if (isInvisiblySmallElement2(newElement5)) {
|
|
33475
32950
|
return;
|
|
33476
32951
|
}
|
|
33477
|
-
const frameId =
|
|
32952
|
+
const frameId = newElement5.frameId || appState.frameToHighlight?.id;
|
|
33478
32953
|
if (frameId && appState.frameRendering.enabled && appState.frameRendering.clip) {
|
|
33479
|
-
const frame = getTargetFrame(
|
|
33480
|
-
if (frame && shouldApplyFrameClip(
|
|
32954
|
+
const frame = getTargetFrame(newElement5, elementsMap, appState);
|
|
32955
|
+
if (frame && shouldApplyFrameClip(newElement5, frame, appState, elementsMap)) {
|
|
33481
32956
|
frameClip(frame, context, renderConfig, appState);
|
|
33482
32957
|
}
|
|
33483
32958
|
}
|
|
33484
32959
|
renderElement(
|
|
33485
|
-
|
|
32960
|
+
newElement5,
|
|
33486
32961
|
elementsMap,
|
|
33487
32962
|
allElementsMap,
|
|
33488
32963
|
rc,
|
|
@@ -33603,7 +33078,7 @@ var Toast = ({
|
|
|
33603
33078
|
|
|
33604
33079
|
// components/UnlockPopup.tsx
|
|
33605
33080
|
import {
|
|
33606
|
-
getCommonBounds as
|
|
33081
|
+
getCommonBounds as getCommonBounds10,
|
|
33607
33082
|
getElementsInGroup as getElementsInGroup8,
|
|
33608
33083
|
selectGroupsFromGivenElements as selectGroupsFromGivenElements4
|
|
33609
33084
|
} from "@excalidraw/element";
|
|
@@ -33619,7 +33094,7 @@ var UnlockPopup = ({
|
|
|
33619
33094
|
if (elements.length === 0) {
|
|
33620
33095
|
return null;
|
|
33621
33096
|
}
|
|
33622
|
-
const [x, y] =
|
|
33097
|
+
const [x, y] = getCommonBounds10(elements);
|
|
33623
33098
|
const { x: viewX, y: viewY } = sceneCoordsToViewportCoords6(
|
|
33624
33099
|
{ sceneX: x, sceneY: y },
|
|
33625
33100
|
app.state
|
|
@@ -33883,7 +33358,7 @@ var App = class _App extends React45.Component {
|
|
|
33883
33358
|
}
|
|
33884
33359
|
return null;
|
|
33885
33360
|
}
|
|
33886
|
-
const isDarkTheme = this.state.theme ===
|
|
33361
|
+
const isDarkTheme = this.state.theme === THEME17.DARK;
|
|
33887
33362
|
const nonDeletedFramesLikes = this.scene.getNonDeletedFramesLikes();
|
|
33888
33363
|
const focusedSearchMatch = nonDeletedFramesLikes.length > 0 ? this.state.searchMatches?.focusedId && isFrameLikeElement15(
|
|
33889
33364
|
this.scene.getElement(this.state.searchMatches.focusedId)
|
|
@@ -33934,8 +33409,7 @@ var App = class _App extends React45.Component {
|
|
|
33934
33409
|
}
|
|
33935
33410
|
},
|
|
33936
33411
|
style: {
|
|
33937
|
-
background: this.state.viewBackgroundColor,
|
|
33938
|
-
filter: isDarkTheme ? THEME_FILTER : "none",
|
|
33412
|
+
background: isDarkTheme ? applyDarkModeFilter4(this.state.viewBackgroundColor) : this.state.viewBackgroundColor,
|
|
33939
33413
|
zIndex: 2,
|
|
33940
33414
|
border: "none",
|
|
33941
33415
|
display: "block",
|
|
@@ -33945,7 +33419,7 @@ var App = class _App extends React45.Component {
|
|
|
33945
33419
|
fontFamily: "Assistant",
|
|
33946
33420
|
fontSize: `${FRAME_STYLE4.nameFontSize}px`,
|
|
33947
33421
|
transform: `translate(-${FRAME_NAME_EDIT_PADDING}px, ${FRAME_NAME_EDIT_PADDING}px)`,
|
|
33948
|
-
color:
|
|
33422
|
+
color: isDarkTheme ? FRAME_STYLE4.nameColorDarkTheme : FRAME_STYLE4.nameColorLightTheme,
|
|
33949
33423
|
overflow: "hidden",
|
|
33950
33424
|
maxWidth: `${document.body.clientWidth - x1 - FRAME_NAME_EDIT_PADDING}px`
|
|
33951
33425
|
},
|
|
@@ -34083,9 +33557,9 @@ var App = class _App extends React45.Component {
|
|
|
34083
33557
|
if (selectedMagicFrame) {
|
|
34084
33558
|
frame = selectedMagicFrame;
|
|
34085
33559
|
} else {
|
|
34086
|
-
const [minX, minY, maxX, maxY] =
|
|
33560
|
+
const [minX, minY, maxX, maxY] = getCommonBounds11(selectedElements);
|
|
34087
33561
|
const padding = 50;
|
|
34088
|
-
frame =
|
|
33562
|
+
frame = newMagicFrameElement({
|
|
34089
33563
|
...FRAME_STYLE4,
|
|
34090
33564
|
x: minX - padding,
|
|
34091
33565
|
y: minY - padding,
|
|
@@ -34171,7 +33645,7 @@ var App = class _App extends React45.Component {
|
|
|
34171
33645
|
if (actionResult.appState || editingTextElement || this.state.contextMenu) {
|
|
34172
33646
|
let viewModeEnabled = actionResult?.appState?.viewModeEnabled || false;
|
|
34173
33647
|
let zenModeEnabled = actionResult?.appState?.zenModeEnabled || false;
|
|
34174
|
-
const theme = actionResult?.appState?.theme || this.props.theme ||
|
|
33648
|
+
const theme = actionResult?.appState?.theme || this.props.theme || THEME17.LIGHT;
|
|
34175
33649
|
const name = actionResult?.appState?.name ?? this.state.name;
|
|
34176
33650
|
const errorMessage = actionResult?.appState?.errorMessage ?? this.state.errorMessage;
|
|
34177
33651
|
if (typeof this.props.viewModeEnabled !== "undefined") {
|
|
@@ -34292,37 +33766,38 @@ var App = class _App extends React45.Component {
|
|
|
34292
33766
|
}
|
|
34293
33767
|
};
|
|
34294
33768
|
}
|
|
34295
|
-
const
|
|
33769
|
+
const restoredElements = restoreElements(initialData?.elements, null, {
|
|
34296
33770
|
repairBindings: true,
|
|
34297
33771
|
deleteInvisibleElements: true
|
|
34298
33772
|
});
|
|
34299
|
-
|
|
34300
|
-
|
|
34301
|
-
|
|
33773
|
+
let restoredAppState = restoreAppState(initialData?.appState, null);
|
|
33774
|
+
const activeTool = restoredAppState.activeTool;
|
|
33775
|
+
if (!restoredAppState.preferredSelectionTool.initialized) {
|
|
33776
|
+
restoredAppState.preferredSelectionTool = {
|
|
34302
33777
|
type: this.editorInterface.formFactor === "phone" ? "lasso" : "selection",
|
|
34303
33778
|
initialized: true
|
|
34304
33779
|
};
|
|
34305
33780
|
}
|
|
34306
|
-
|
|
34307
|
-
...
|
|
34308
|
-
theme: this.props.theme ||
|
|
33781
|
+
restoredAppState = {
|
|
33782
|
+
...restoredAppState,
|
|
33783
|
+
theme: this.props.theme || restoredAppState.theme,
|
|
34309
33784
|
// we're falling back to current (pre-init) state when deciding
|
|
34310
33785
|
// whether to open the library, to handle a case where we
|
|
34311
33786
|
// update the state outside of initialData (e.g. when loading the app
|
|
34312
33787
|
// with a library install link, which should auto-open the library)
|
|
34313
|
-
openSidebar:
|
|
33788
|
+
openSidebar: restoredAppState?.openSidebar || this.state.openSidebar,
|
|
34314
33789
|
activeTool: activeTool.type === "image" || activeTool.type === "lasso" || activeTool.type === "selection" ? {
|
|
34315
33790
|
...activeTool,
|
|
34316
|
-
type:
|
|
34317
|
-
} :
|
|
33791
|
+
type: restoredAppState.preferredSelectionTool.type
|
|
33792
|
+
} : restoredAppState.activeTool,
|
|
34318
33793
|
isLoading: false,
|
|
34319
33794
|
toast: this.state.toast
|
|
34320
33795
|
};
|
|
34321
33796
|
if (initialData?.scrollToContent) {
|
|
34322
|
-
|
|
34323
|
-
...
|
|
34324
|
-
...calculateScrollCenter(
|
|
34325
|
-
...
|
|
33797
|
+
restoredAppState = {
|
|
33798
|
+
...restoredAppState,
|
|
33799
|
+
...calculateScrollCenter(restoredElements, {
|
|
33800
|
+
...restoredAppState,
|
|
34326
33801
|
width: this.state.width,
|
|
34327
33802
|
height: this.state.height,
|
|
34328
33803
|
offsetTop: this.state.offsetTop,
|
|
@@ -34333,7 +33808,9 @@ var App = class _App extends React45.Component {
|
|
|
34333
33808
|
this.resetStore();
|
|
34334
33809
|
this.resetHistory();
|
|
34335
33810
|
this.syncActionResult({
|
|
34336
|
-
|
|
33811
|
+
elements: restoredElements,
|
|
33812
|
+
appState: restoredAppState,
|
|
33813
|
+
files: initialData?.files,
|
|
34337
33814
|
captureUpdate: CaptureUpdateAction37.NEVER
|
|
34338
33815
|
});
|
|
34339
33816
|
this.clearImageShapeCache();
|
|
@@ -34480,8 +33957,8 @@ var App = class _App extends React45.Component {
|
|
|
34480
33957
|
if (didTapTwice && event.touches.length === 1 && firstTapPosition) {
|
|
34481
33958
|
const touch = event.touches[0];
|
|
34482
33959
|
const distance3 = pointDistance8(
|
|
34483
|
-
|
|
34484
|
-
|
|
33960
|
+
pointFrom29(touch.clientX, touch.clientY),
|
|
33961
|
+
pointFrom29(firstTapPosition.x, firstTapPosition.y)
|
|
34485
33962
|
);
|
|
34486
33963
|
if (distance3 <= DOUBLE_TAP_POSITION_THRESHOLD) {
|
|
34487
33964
|
this.lassoTrail.endPath();
|
|
@@ -34554,7 +34031,7 @@ var App = class _App extends React45.Component {
|
|
|
34554
34031
|
const elements = restoreElements(opts.elements, null, {
|
|
34555
34032
|
deleteInvisibleElements: true
|
|
34556
34033
|
});
|
|
34557
|
-
const [minX, minY, maxX, maxY] =
|
|
34034
|
+
const [minX, minY, maxX, maxY] = getCommonBounds11(elements);
|
|
34558
34035
|
const elementsCenterX = distance2(minX, maxX) / 2;
|
|
34559
34036
|
const elementsCenterY = distance2(minY, maxY) / 2;
|
|
34560
34037
|
const clientX = typeof opts.position === "object" ? opts.position.clientX : opts.position === "cursor" ? this.lastViewportPosition.x : this.state.width / 2 + this.state.offsetLeft;
|
|
@@ -34583,7 +34060,7 @@ var App = class _App extends React45.Component {
|
|
|
34583
34060
|
prevElements
|
|
34584
34061
|
);
|
|
34585
34062
|
nextElements = mappedNewSceneElements || nextElements;
|
|
34586
|
-
syncMovedIndices4(nextElements,
|
|
34063
|
+
syncMovedIndices4(nextElements, arrayToMap26(duplicatedElements));
|
|
34587
34064
|
const topLayerFrame = this.getTopLayerFrameAtSceneCoords({ x, y });
|
|
34588
34065
|
if (topLayerFrame) {
|
|
34589
34066
|
const eligibleElements = filterElementsEligibleAsFrameChildren(
|
|
@@ -34598,13 +34075,13 @@ var App = class _App extends React45.Component {
|
|
|
34598
34075
|
);
|
|
34599
34076
|
}
|
|
34600
34077
|
this.scene.replaceAllElements(nextElements);
|
|
34601
|
-
duplicatedElements.forEach((
|
|
34602
|
-
if (isTextElement19(
|
|
34078
|
+
duplicatedElements.forEach((newElement5) => {
|
|
34079
|
+
if (isTextElement19(newElement5) && isBoundToContainer9(newElement5)) {
|
|
34603
34080
|
const container = getContainerElement5(
|
|
34604
|
-
|
|
34081
|
+
newElement5,
|
|
34605
34082
|
this.scene.getElementsMapIncludingDeleted()
|
|
34606
34083
|
);
|
|
34607
|
-
|
|
34084
|
+
redrawTextBoundingBox8(newElement5, container, this.scene);
|
|
34608
34085
|
}
|
|
34609
34086
|
});
|
|
34610
34087
|
if (isSafari) {
|
|
@@ -35399,13 +34876,13 @@ var App = class _App extends React45.Component {
|
|
|
35399
34876
|
},
|
|
35400
34877
|
this.state
|
|
35401
34878
|
);
|
|
35402
|
-
const hoveredElement =
|
|
35403
|
-
|
|
34879
|
+
const hoveredElement = getHoveredElementForBinding2(
|
|
34880
|
+
pointFrom29(scenePointer.x, scenePointer.y),
|
|
35404
34881
|
this.scene.getNonDeletedElements(),
|
|
35405
34882
|
this.scene.getNonDeletedElementsMap()
|
|
35406
34883
|
);
|
|
35407
34884
|
if (this.state.selectedLinearElement) {
|
|
35408
|
-
const element =
|
|
34885
|
+
const element = LinearElementEditor11.getElement(
|
|
35409
34886
|
this.state.selectedLinearElement.elementId,
|
|
35410
34887
|
this.scene.getNonDeletedElementsMap()
|
|
35411
34888
|
);
|
|
@@ -35420,7 +34897,7 @@ var App = class _App extends React45.Component {
|
|
|
35420
34897
|
}
|
|
35421
34898
|
if (isArrowKey2(event.key)) {
|
|
35422
34899
|
bindOrUnbindBindingElements2(
|
|
35423
|
-
this.scene.getSelectedElements(this.state).filter(
|
|
34900
|
+
this.scene.getSelectedElements(this.state).filter(isArrowElement13),
|
|
35424
34901
|
this.scene,
|
|
35425
34902
|
this.state
|
|
35426
34903
|
);
|
|
@@ -35686,15 +35163,15 @@ var App = class _App extends React45.Component {
|
|
|
35686
35163
|
existingTextElement = this.getTextElementAtPosition(sceneX, sceneY);
|
|
35687
35164
|
}
|
|
35688
35165
|
const fontFamily = existingTextElement?.fontFamily || this.state.currentItemFontFamily;
|
|
35689
|
-
const lineHeight = existingTextElement?.lineHeight ||
|
|
35166
|
+
const lineHeight = existingTextElement?.lineHeight || getLineHeight4(fontFamily);
|
|
35690
35167
|
const fontSize = this.state.currentItemFontSize;
|
|
35691
|
-
if (!existingTextElement && shouldBindToContainer && container && !
|
|
35168
|
+
if (!existingTextElement && shouldBindToContainer && container && !isArrowElement13(container)) {
|
|
35692
35169
|
const fontString = {
|
|
35693
35170
|
fontSize,
|
|
35694
35171
|
fontFamily
|
|
35695
35172
|
};
|
|
35696
35173
|
const minWidth = getApproxMinLineWidth(
|
|
35697
|
-
|
|
35174
|
+
getFontString9(fontString),
|
|
35698
35175
|
lineHeight
|
|
35699
35176
|
);
|
|
35700
35177
|
const minHeight = getApproxMinLineHeight(fontSize, lineHeight);
|
|
@@ -35719,7 +35196,7 @@ var App = class _App extends React45.Component {
|
|
|
35719
35196
|
x: sceneX,
|
|
35720
35197
|
y: sceneY
|
|
35721
35198
|
});
|
|
35722
|
-
const element = existingTextElement ||
|
|
35199
|
+
const element = existingTextElement || newTextElement3({
|
|
35723
35200
|
x: parentCenterPosition ? parentCenterPosition.elementCenterX : sceneX,
|
|
35724
35201
|
y: parentCenterPosition ? parentCenterPosition.elementCenterY : sceneY,
|
|
35725
35202
|
strokeColor: this.state.currentItemStrokeColor,
|
|
@@ -35733,11 +35210,11 @@ var App = class _App extends React45.Component {
|
|
|
35733
35210
|
fontSize,
|
|
35734
35211
|
fontFamily,
|
|
35735
35212
|
textAlign: parentCenterPosition ? "center" : this.state.currentItemTextAlign,
|
|
35736
|
-
verticalAlign: parentCenterPosition ?
|
|
35213
|
+
verticalAlign: parentCenterPosition ? VERTICAL_ALIGN5.MIDDLE : DEFAULT_VERTICAL_ALIGN,
|
|
35737
35214
|
containerId: shouldBindToContainer ? container?.id : void 0,
|
|
35738
35215
|
groupIds: container?.groupIds ?? [],
|
|
35739
35216
|
lineHeight,
|
|
35740
|
-
angle: container ?
|
|
35217
|
+
angle: container ? isArrowElement13(container) ? 0 : container.angle : 0,
|
|
35741
35218
|
frameId: topLayerFrame ? topLayerFrame.id : null
|
|
35742
35219
|
});
|
|
35743
35220
|
if (!existingTextElement && shouldBindToContainer && container) {
|
|
@@ -35800,13 +35277,13 @@ var App = class _App extends React45.Component {
|
|
|
35800
35277
|
this.actionManager.executeAction(actionToggleLinearEditor);
|
|
35801
35278
|
return;
|
|
35802
35279
|
} else if (this.state.selectedLinearElement && isElbowArrow10(selectedElements[0])) {
|
|
35803
|
-
const hitCoords =
|
|
35280
|
+
const hitCoords = LinearElementEditor11.getSegmentMidpointHitCoords(
|
|
35804
35281
|
this.state.selectedLinearElement,
|
|
35805
35282
|
{ x: sceneX, y: sceneY },
|
|
35806
35283
|
this.state,
|
|
35807
35284
|
this.scene.getNonDeletedElementsMap()
|
|
35808
35285
|
);
|
|
35809
|
-
const midPoint = hitCoords ?
|
|
35286
|
+
const midPoint = hitCoords ? LinearElementEditor11.getSegmentMidPointIndex(
|
|
35810
35287
|
this.state.selectedLinearElement,
|
|
35811
35288
|
this.state,
|
|
35812
35289
|
hitCoords,
|
|
@@ -35814,12 +35291,12 @@ var App = class _App extends React45.Component {
|
|
|
35814
35291
|
) : -1;
|
|
35815
35292
|
if (midPoint && midPoint > -1) {
|
|
35816
35293
|
this.store.scheduleCapture();
|
|
35817
|
-
|
|
35294
|
+
LinearElementEditor11.deleteFixedSegment(
|
|
35818
35295
|
selectedElements[0],
|
|
35819
35296
|
this.scene,
|
|
35820
35297
|
midPoint
|
|
35821
35298
|
);
|
|
35822
|
-
const nextCoords =
|
|
35299
|
+
const nextCoords = LinearElementEditor11.getSegmentMidpointHitCoords(
|
|
35823
35300
|
{
|
|
35824
35301
|
...this.state.selectedLinearElement,
|
|
35825
35302
|
segmentMidPointHoveredCoords: null
|
|
@@ -35828,7 +35305,7 @@ var App = class _App extends React45.Component {
|
|
|
35828
35305
|
this.state,
|
|
35829
35306
|
this.scene.getNonDeletedElementsMap()
|
|
35830
35307
|
);
|
|
35831
|
-
const nextIndex = nextCoords ?
|
|
35308
|
+
const nextIndex = nextCoords ? LinearElementEditor11.getSegmentMidPointIndex(
|
|
35832
35309
|
this.state.selectedLinearElement,
|
|
35833
35310
|
this.state,
|
|
35834
35311
|
nextCoords,
|
|
@@ -35895,8 +35372,8 @@ var App = class _App extends React45.Component {
|
|
|
35895
35372
|
sceneY
|
|
35896
35373
|
);
|
|
35897
35374
|
if (container) {
|
|
35898
|
-
if (hasBoundTextElement9(container) || !
|
|
35899
|
-
point:
|
|
35375
|
+
if (hasBoundTextElement9(container) || !isTransparent8(container.backgroundColor) || hitElementItself({
|
|
35376
|
+
point: pointFrom29(sceneX, sceneY),
|
|
35900
35377
|
element: container,
|
|
35901
35378
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
35902
35379
|
threshold: this.getElementHitThreshold(container)
|
|
@@ -35934,7 +35411,7 @@ var App = class _App extends React45.Component {
|
|
|
35934
35411
|
element,
|
|
35935
35412
|
this.scene.getNonDeletedElementsMap(),
|
|
35936
35413
|
this.state,
|
|
35937
|
-
|
|
35414
|
+
pointFrom29(scenePointer.x, scenePointer.y),
|
|
35938
35415
|
this.editorInterface.formFactor === "phone"
|
|
35939
35416
|
)) {
|
|
35940
35417
|
return element;
|
|
@@ -35943,11 +35420,11 @@ var App = class _App extends React45.Component {
|
|
|
35943
35420
|
});
|
|
35944
35421
|
__publicField(this, "redirectToLink", (event, isTouchScreen) => {
|
|
35945
35422
|
const draggedDistance = pointDistance8(
|
|
35946
|
-
|
|
35423
|
+
pointFrom29(
|
|
35947
35424
|
this.lastPointerDownEvent.clientX,
|
|
35948
35425
|
this.lastPointerDownEvent.clientY
|
|
35949
35426
|
),
|
|
35950
|
-
|
|
35427
|
+
pointFrom29(
|
|
35951
35428
|
this.lastPointerUpEvent.clientX,
|
|
35952
35429
|
this.lastPointerUpEvent.clientY
|
|
35953
35430
|
)
|
|
@@ -35964,7 +35441,7 @@ var App = class _App extends React45.Component {
|
|
|
35964
35441
|
this.hitLinkElement,
|
|
35965
35442
|
elementsMap,
|
|
35966
35443
|
this.state,
|
|
35967
|
-
|
|
35444
|
+
pointFrom29(lastPointerDownCoords.x, lastPointerDownCoords.y),
|
|
35968
35445
|
this.editorInterface.formFactor === "phone"
|
|
35969
35446
|
);
|
|
35970
35447
|
const lastPointerUpCoords = viewportCoordsToSceneCoords3(
|
|
@@ -35975,7 +35452,7 @@ var App = class _App extends React45.Component {
|
|
|
35975
35452
|
this.hitLinkElement,
|
|
35976
35453
|
elementsMap,
|
|
35977
35454
|
this.state,
|
|
35978
|
-
|
|
35455
|
+
pointFrom29(lastPointerUpCoords.x, lastPointerUpCoords.y),
|
|
35979
35456
|
this.editorInterface.formFactor === "phone"
|
|
35980
35457
|
);
|
|
35981
35458
|
if (lastPointerDownHittingLinkIcon && lastPointerUpHittingLinkIcon) {
|
|
@@ -36109,7 +35586,7 @@ var App = class _App extends React45.Component {
|
|
|
36109
35586
|
});
|
|
36110
35587
|
}
|
|
36111
35588
|
if (this.state.selectedLinearElement?.isEditing && !this.state.selectedLinearElement.isDragging) {
|
|
36112
|
-
const editingLinearElement = this.state.newElement ? null :
|
|
35589
|
+
const editingLinearElement = this.state.newElement ? null : LinearElementEditor11.handlePointerMoveInEditMode(
|
|
36113
35590
|
event,
|
|
36114
35591
|
scenePointerX,
|
|
36115
35592
|
scenePointerY,
|
|
@@ -36124,10 +35601,10 @@ var App = class _App extends React45.Component {
|
|
|
36124
35601
|
}
|
|
36125
35602
|
}
|
|
36126
35603
|
if (isBindingElementType(this.state.activeTool.type)) {
|
|
36127
|
-
const { newElement:
|
|
36128
|
-
if (!
|
|
36129
|
-
const hoveredElement =
|
|
36130
|
-
|
|
35604
|
+
const { newElement: newElement5 } = this.state;
|
|
35605
|
+
if (!newElement5 && isBindingEnabled2(this.state)) {
|
|
35606
|
+
const hoveredElement = getHoveredElementForBinding2(
|
|
35607
|
+
pointFrom29(scenePointerX, scenePointerY),
|
|
36131
35608
|
this.scene.getNonDeletedElements(),
|
|
36132
35609
|
this.scene.getNonDeletedElementsMap(),
|
|
36133
35610
|
(el) => maxBindingDistance_simple2(this.state.zoom)
|
|
@@ -36150,8 +35627,8 @@ var App = class _App extends React45.Component {
|
|
|
36150
35627
|
const { lastCommittedPoint } = selectedLinearElement;
|
|
36151
35628
|
setCursorForShape(this.interactiveCanvas, this.state);
|
|
36152
35629
|
if (lastPoint === lastCommittedPoint) {
|
|
36153
|
-
const hoveredElement =
|
|
36154
|
-
|
|
35630
|
+
const hoveredElement = isArrowElement13(this.state.newElement) && isBindingEnabled2(this.state) && getHoveredElementForBinding2(
|
|
35631
|
+
pointFrom29(scenePointerX, scenePointerY),
|
|
36155
35632
|
this.scene.getNonDeletedElements(),
|
|
36156
35633
|
this.scene.getNonDeletedElementsMap(),
|
|
36157
35634
|
(el) => maxBindingDistance_simple2(this.state.zoom)
|
|
@@ -36179,7 +35656,7 @@ var App = class _App extends React45.Component {
|
|
|
36179
35656
|
},
|
|
36180
35657
|
prevState
|
|
36181
35658
|
),
|
|
36182
|
-
selectedLinearElement: new
|
|
35659
|
+
selectedLinearElement: new LinearElementEditor11(
|
|
36183
35660
|
multiElement,
|
|
36184
35661
|
this.scene.getNonDeletedElementsMap()
|
|
36185
35662
|
)
|
|
@@ -36189,7 +35666,7 @@ var App = class _App extends React45.Component {
|
|
|
36189
35666
|
// if we haven't yet created a temp point and we're beyond commit-zone
|
|
36190
35667
|
// threshold, add a point
|
|
36191
35668
|
pointDistance8(
|
|
36192
|
-
|
|
35669
|
+
pointFrom29(scenePointerX - rx, scenePointerY - ry),
|
|
36193
35670
|
lastPoint
|
|
36194
35671
|
) >= LINE_CONFIRM_THRESHOLD2
|
|
36195
35672
|
) {
|
|
@@ -36198,7 +35675,7 @@ var App = class _App extends React45.Component {
|
|
|
36198
35675
|
{
|
|
36199
35676
|
points: [
|
|
36200
35677
|
...points,
|
|
36201
|
-
|
|
35678
|
+
pointFrom29(scenePointerX - rx, scenePointerY - ry)
|
|
36202
35679
|
]
|
|
36203
35680
|
},
|
|
36204
35681
|
{ informMutation: false, isDragging: false }
|
|
@@ -36222,7 +35699,7 @@ var App = class _App extends React45.Component {
|
|
|
36222
35699
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.POINTER);
|
|
36223
35700
|
}
|
|
36224
35701
|
} else if (points.length > 2 && lastCommittedPoint && pointDistance8(
|
|
36225
|
-
|
|
35702
|
+
pointFrom29(scenePointerX - rx, scenePointerY - ry),
|
|
36226
35703
|
lastCommittedPoint
|
|
36227
35704
|
) < LINE_CONFIRM_THRESHOLD2) {
|
|
36228
35705
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.POINTER);
|
|
@@ -36257,8 +35734,8 @@ var App = class _App extends React45.Component {
|
|
|
36257
35734
|
}
|
|
36258
35735
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
36259
35736
|
if (isSimpleArrow(multiElement)) {
|
|
36260
|
-
const hoveredElement =
|
|
36261
|
-
|
|
35737
|
+
const hoveredElement = getHoveredElementForBinding2(
|
|
35738
|
+
pointFrom29(scenePointerX, scenePointerY),
|
|
36262
35739
|
this.scene.getNonDeletedElements(),
|
|
36263
35740
|
elementsMap
|
|
36264
35741
|
);
|
|
@@ -36270,7 +35747,7 @@ var App = class _App extends React45.Component {
|
|
|
36270
35747
|
this.state.selectedLinearElement,
|
|
36271
35748
|
"Expected selectedLinearElement to be set to operate on a linear element"
|
|
36272
35749
|
);
|
|
36273
|
-
const newState =
|
|
35750
|
+
const newState = LinearElementEditor11.handlePointerMove(
|
|
36274
35751
|
event.nativeEvent,
|
|
36275
35752
|
this,
|
|
36276
35753
|
scenePointerX,
|
|
@@ -36284,14 +35761,14 @@ var App = class _App extends React45.Component {
|
|
|
36284
35761
|
return;
|
|
36285
35762
|
}
|
|
36286
35763
|
if (this.state.activeTool.type === "arrow") {
|
|
36287
|
-
const hit =
|
|
36288
|
-
|
|
35764
|
+
const hit = getHoveredElementForBinding2(
|
|
35765
|
+
pointFrom29(scenePointerX, scenePointerY),
|
|
36289
35766
|
this.scene.getNonDeletedElements(),
|
|
36290
35767
|
this.scene.getNonDeletedElementsMap(),
|
|
36291
35768
|
(el) => maxBindingDistance_simple2(this.state.zoom)
|
|
36292
35769
|
);
|
|
36293
35770
|
if (hit && !isPointInElement3(
|
|
36294
|
-
|
|
35771
|
+
pointFrom29(scenePointerX, scenePointerY),
|
|
36295
35772
|
hit,
|
|
36296
35773
|
this.scene.getNonDeletedElementsMap()
|
|
36297
35774
|
)) {
|
|
@@ -36337,7 +35814,7 @@ var App = class _App extends React45.Component {
|
|
|
36337
35814
|
}
|
|
36338
35815
|
} else if (selectedElements.length > 1 && !isOverScrollBar && this.state.openDialog?.name !== "elementLinkSelector") {
|
|
36339
35816
|
const transformHandleType = getTransformHandleTypeFromCoords(
|
|
36340
|
-
|
|
35817
|
+
getCommonBounds11(selectedElements),
|
|
36341
35818
|
scenePointerX,
|
|
36342
35819
|
scenePointerY,
|
|
36343
35820
|
this.state.zoom,
|
|
@@ -36808,7 +36285,7 @@ var App = class _App extends React45.Component {
|
|
|
36808
36285
|
this.hitLinkElement,
|
|
36809
36286
|
this.scene.getNonDeletedElementsMap(),
|
|
36810
36287
|
this.state,
|
|
36811
|
-
|
|
36288
|
+
pointFrom29(scenePointer.x, scenePointer.y)
|
|
36812
36289
|
)) {
|
|
36813
36290
|
this.handleEmbeddableCenterClick(this.hitLinkElement);
|
|
36814
36291
|
} else {
|
|
@@ -36963,7 +36440,7 @@ var App = class _App extends React45.Component {
|
|
|
36963
36440
|
}
|
|
36964
36441
|
} else if (selectedElements.length > 1) {
|
|
36965
36442
|
pointerDownState.resize.handleType = getTransformHandleTypeFromCoords(
|
|
36966
|
-
|
|
36443
|
+
getCommonBounds11(selectedElements),
|
|
36967
36444
|
pointerDownState.origin.x,
|
|
36968
36445
|
pointerDownState.origin.y,
|
|
36969
36446
|
this.state.zoom,
|
|
@@ -36991,7 +36468,7 @@ var App = class _App extends React45.Component {
|
|
|
36991
36468
|
} else {
|
|
36992
36469
|
if (this.state.selectedLinearElement) {
|
|
36993
36470
|
const linearElementEditor = this.state.selectedLinearElement;
|
|
36994
|
-
const ret =
|
|
36471
|
+
const ret = LinearElementEditor11.handlePointerDown(
|
|
36995
36472
|
event,
|
|
36996
36473
|
this,
|
|
36997
36474
|
this.store,
|
|
@@ -37252,7 +36729,7 @@ var App = class _App extends React45.Component {
|
|
|
37252
36729
|
simulatePressure,
|
|
37253
36730
|
locked: false,
|
|
37254
36731
|
frameId: topLayerFrame ? topLayerFrame.id : null,
|
|
37255
|
-
points: [
|
|
36732
|
+
points: [pointFrom29(0, 0)],
|
|
37256
36733
|
pressures: simulatePressure ? [] : [event.pressure]
|
|
37257
36734
|
});
|
|
37258
36735
|
this.scene.insertElement(element);
|
|
@@ -37268,8 +36745,8 @@ var App = class _App extends React45.Component {
|
|
|
37268
36745
|
)
|
|
37269
36746
|
};
|
|
37270
36747
|
});
|
|
37271
|
-
const boundElement =
|
|
37272
|
-
|
|
36748
|
+
const boundElement = getHoveredElementForBinding2(
|
|
36749
|
+
pointFrom29(
|
|
37273
36750
|
pointerDownState.origin.x,
|
|
37274
36751
|
pointerDownState.origin.y
|
|
37275
36752
|
),
|
|
@@ -37368,7 +36845,7 @@ var App = class _App extends React45.Component {
|
|
|
37368
36845
|
y: gridY
|
|
37369
36846
|
}) : null;
|
|
37370
36847
|
const placeholderSize = 100 / this.state.zoom.value;
|
|
37371
|
-
return
|
|
36848
|
+
return newImageElement({
|
|
37372
36849
|
type: "image",
|
|
37373
36850
|
strokeColor: this.state.currentItemStrokeColor,
|
|
37374
36851
|
backgroundColor: this.state.currentItemBackgroundColor,
|
|
@@ -37427,8 +36904,8 @@ var App = class _App extends React45.Component {
|
|
|
37427
36904
|
}
|
|
37428
36905
|
const { x: rx, y: ry } = multiElement;
|
|
37429
36906
|
const { lastCommittedPoint } = selectedLinearElement;
|
|
37430
|
-
const hoveredElementForBinding =
|
|
37431
|
-
|
|
36907
|
+
const hoveredElementForBinding = isBindingEnabled2(this.state) && getHoveredElementForBinding2(
|
|
36908
|
+
pointFrom29(
|
|
37432
36909
|
this.lastPointerMoveCoords?.x ?? rx + multiElement.points[multiElement.points.length - 1][0],
|
|
37433
36910
|
this.lastPointerMoveCoords?.y ?? ry + multiElement.points[multiElement.points.length - 1][1]
|
|
37434
36911
|
),
|
|
@@ -37436,7 +36913,7 @@ var App = class _App extends React45.Component {
|
|
|
37436
36913
|
this.scene.getNonDeletedElementsMap()
|
|
37437
36914
|
);
|
|
37438
36915
|
if (isBindingElement4(multiElement) && hoveredElementForBinding || multiElement.points.length > 1 && lastCommittedPoint && pointDistance8(
|
|
37439
|
-
|
|
36916
|
+
pointFrom29(
|
|
37440
36917
|
pointerDownState.origin.x - rx,
|
|
37441
36918
|
pointerDownState.origin.y - ry
|
|
37442
36919
|
),
|
|
@@ -37473,7 +36950,7 @@ var App = class _App extends React45.Component {
|
|
|
37473
36950
|
});
|
|
37474
36951
|
const { currentItemStartArrowhead, currentItemEndArrowhead } = this.state;
|
|
37475
36952
|
const [startArrowhead, endArrowhead] = elementType === "arrow" ? [currentItemStartArrowhead, currentItemEndArrowhead] : [null, null];
|
|
37476
|
-
const element = elementType === "arrow" ?
|
|
36953
|
+
const element = elementType === "arrow" ? newArrowElement2({
|
|
37477
36954
|
type: elementType,
|
|
37478
36955
|
x: gridX,
|
|
37479
36956
|
y: gridY,
|
|
@@ -37495,7 +36972,7 @@ var App = class _App extends React45.Component {
|
|
|
37495
36972
|
frameId: topLayerFrame ? topLayerFrame.id : null,
|
|
37496
36973
|
elbowed: this.state.currentItemArrowType === ARROW_TYPE2.elbow,
|
|
37497
36974
|
fixedSegments: this.state.currentItemArrowType === ARROW_TYPE2.elbow ? [] : null
|
|
37498
|
-
}) :
|
|
36975
|
+
}) : newLinearElement3({
|
|
37499
36976
|
type: elementType,
|
|
37500
36977
|
x: gridX,
|
|
37501
36978
|
y: gridY,
|
|
@@ -37510,18 +36987,18 @@ var App = class _App extends React45.Component {
|
|
|
37510
36987
|
locked: false,
|
|
37511
36988
|
frameId: topLayerFrame ? topLayerFrame.id : null
|
|
37512
36989
|
});
|
|
37513
|
-
const point =
|
|
36990
|
+
const point = pointFrom29(
|
|
37514
36991
|
pointerDownState.origin.x,
|
|
37515
36992
|
pointerDownState.origin.y
|
|
37516
36993
|
);
|
|
37517
36994
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
37518
|
-
const boundElement = isBindingEnabled2(this.state) ?
|
|
36995
|
+
const boundElement = isBindingEnabled2(this.state) ? getHoveredElementForBinding2(
|
|
37519
36996
|
point,
|
|
37520
36997
|
this.scene.getNonDeletedElements(),
|
|
37521
36998
|
elementsMap
|
|
37522
36999
|
) : null;
|
|
37523
37000
|
this.scene.mutateElement(element, {
|
|
37524
|
-
points: [
|
|
37001
|
+
points: [pointFrom29(0, 0), pointFrom29(0, 0)]
|
|
37525
37002
|
});
|
|
37526
37003
|
this.scene.insertElement(element);
|
|
37527
37004
|
if (isBindingElement4(element)) {
|
|
@@ -37531,14 +37008,21 @@ var App = class _App extends React45.Component {
|
|
|
37531
37008
|
[
|
|
37532
37009
|
0,
|
|
37533
37010
|
{
|
|
37534
|
-
point:
|
|
37011
|
+
point: pointFrom29(0, 0),
|
|
37535
37012
|
isDragging: false
|
|
37536
37013
|
}
|
|
37537
37014
|
]
|
|
37538
37015
|
]),
|
|
37016
|
+
point[0],
|
|
37017
|
+
point[1],
|
|
37539
37018
|
this.scene,
|
|
37540
37019
|
this.state,
|
|
37541
|
-
{
|
|
37020
|
+
{
|
|
37021
|
+
newArrow: true,
|
|
37022
|
+
altKey: event.altKey,
|
|
37023
|
+
initialBinding: true,
|
|
37024
|
+
angleLocked: shouldRotateWithDiscreteAngle3(event.nativeEvent)
|
|
37025
|
+
}
|
|
37542
37026
|
);
|
|
37543
37027
|
}
|
|
37544
37028
|
flushSync3(() => {
|
|
@@ -37546,7 +37030,7 @@ var App = class _App extends React45.Component {
|
|
|
37546
37030
|
let linearElementEditor = null;
|
|
37547
37031
|
let nextSelectedElementIds = prevState.selectedElementIds;
|
|
37548
37032
|
if (isLinearElement12(element)) {
|
|
37549
|
-
linearElementEditor = new
|
|
37033
|
+
linearElementEditor = new LinearElementEditor11(
|
|
37550
37034
|
element,
|
|
37551
37035
|
this.scene.getNonDeletedElementsMap()
|
|
37552
37036
|
);
|
|
@@ -37557,7 +37041,7 @@ var App = class _App extends React45.Component {
|
|
|
37557
37041
|
initialState: {
|
|
37558
37042
|
...linearElementEditor.initialState,
|
|
37559
37043
|
lastClickedPoint: endIdx,
|
|
37560
|
-
origin:
|
|
37044
|
+
origin: pointFrom29(
|
|
37561
37045
|
pointerDownState.origin.x,
|
|
37562
37046
|
pointerDownState.origin.y
|
|
37563
37047
|
)
|
|
@@ -37612,7 +37096,7 @@ var App = class _App extends React45.Component {
|
|
|
37612
37096
|
...baseElementAttributes
|
|
37613
37097
|
});
|
|
37614
37098
|
} else {
|
|
37615
|
-
element =
|
|
37099
|
+
element = newElement4({
|
|
37616
37100
|
type: elementType,
|
|
37617
37101
|
...baseElementAttributes
|
|
37618
37102
|
});
|
|
@@ -37642,7 +37126,7 @@ var App = class _App extends React45.Component {
|
|
|
37642
37126
|
locked: false,
|
|
37643
37127
|
...FRAME_STYLE4
|
|
37644
37128
|
};
|
|
37645
|
-
const frame = type === TOOL_TYPE3.magicframe ?
|
|
37129
|
+
const frame = type === TOOL_TYPE3.magicframe ? newMagicFrameElement(constructorOpts) : newFrameElement2(constructorOpts);
|
|
37646
37130
|
this.scene.insertElement(frame);
|
|
37647
37131
|
this.setState({
|
|
37648
37132
|
multiElement: null,
|
|
@@ -37978,14 +37462,14 @@ var App = class _App extends React45.Component {
|
|
|
37978
37462
|
}
|
|
37979
37463
|
})
|
|
37980
37464
|
);
|
|
37981
|
-
const initializedMap =
|
|
37465
|
+
const initializedMap = arrayToMap26(initialized);
|
|
37982
37466
|
const positioned = positionElementsOnGrid(
|
|
37983
37467
|
initialized.filter((el) => !el.isDeleted),
|
|
37984
37468
|
sceneX,
|
|
37985
37469
|
sceneY,
|
|
37986
37470
|
gridPadding
|
|
37987
37471
|
);
|
|
37988
|
-
const positionedMap =
|
|
37472
|
+
const positionedMap = arrayToMap26(positioned);
|
|
37989
37473
|
const nextElements = this.scene.getElementsIncludingDeleted().map((el) => positionedMap.get(el.id) ?? initializedMap.get(el.id) ?? el);
|
|
37990
37474
|
this.updateScene({
|
|
37991
37475
|
appState: {
|
|
@@ -38133,7 +37617,7 @@ var App = class _App extends React45.Component {
|
|
|
38133
37617
|
return;
|
|
38134
37618
|
}
|
|
38135
37619
|
if (ret.type === MIME_TYPES9.excalidraw) {
|
|
38136
|
-
|
|
37620
|
+
syncInvalidIndices(elements.concat(ret.data.elements));
|
|
38137
37621
|
this.store.scheduleMicroAction({
|
|
38138
37622
|
action: CaptureUpdateAction37.NEVER,
|
|
38139
37623
|
elements,
|
|
@@ -38198,7 +37682,7 @@ var App = class _App extends React45.Component {
|
|
|
38198
37682
|
this.state,
|
|
38199
37683
|
this
|
|
38200
37684
|
),
|
|
38201
|
-
selectedLinearElement: isLinearElement12(element) ? new
|
|
37685
|
+
selectedLinearElement: isLinearElement12(element) ? new LinearElementEditor11(
|
|
38202
37686
|
element,
|
|
38203
37687
|
this.scene.getNonDeletedElementsMap()
|
|
38204
37688
|
) : null
|
|
@@ -38215,7 +37699,7 @@ var App = class _App extends React45.Component {
|
|
|
38215
37699
|
__publicField(this, "maybeDragNewGenericElement", (pointerDownState, event, informMutation = true) => {
|
|
38216
37700
|
const selectionElement = this.state.selectionElement;
|
|
38217
37701
|
const pointerCoords = pointerDownState.lastCoords;
|
|
38218
|
-
if (selectionElement && this.state.activeTool.type !== "eraser") {
|
|
37702
|
+
if (selectionElement && pointerDownState.boxSelection.hasOccurred && this.state.activeTool.type !== "eraser") {
|
|
38219
37703
|
dragNewElement({
|
|
38220
37704
|
newElement: selectionElement,
|
|
38221
37705
|
elementType: this.state.activeTool.type,
|
|
@@ -38233,8 +37717,8 @@ var App = class _App extends React45.Component {
|
|
|
38233
37717
|
});
|
|
38234
37718
|
return;
|
|
38235
37719
|
}
|
|
38236
|
-
const
|
|
38237
|
-
if (!
|
|
37720
|
+
const newElement5 = this.state.newElement;
|
|
37721
|
+
if (!newElement5) {
|
|
38238
37722
|
return;
|
|
38239
37723
|
}
|
|
38240
37724
|
let [gridX, gridY] = getGridPoint2(
|
|
@@ -38242,11 +37726,11 @@ var App = class _App extends React45.Component {
|
|
|
38242
37726
|
pointerCoords.y,
|
|
38243
37727
|
event[KEYS54.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()
|
|
38244
37728
|
);
|
|
38245
|
-
const image = isInitializedImageElement3(
|
|
37729
|
+
const image = isInitializedImageElement3(newElement5) && this.imageCache.get(newElement5.fileId)?.image;
|
|
38246
37730
|
const aspectRatio = image && !(image instanceof Promise) ? image.width / image.height : null;
|
|
38247
|
-
this.maybeCacheReferenceSnapPoints(event, [
|
|
37731
|
+
this.maybeCacheReferenceSnapPoints(event, [newElement5]);
|
|
38248
37732
|
const { snapOffset, snapLines } = snapNewElement(
|
|
38249
|
-
|
|
37733
|
+
newElement5,
|
|
38250
37734
|
this,
|
|
38251
37735
|
event,
|
|
38252
37736
|
{
|
|
@@ -38264,31 +37748,33 @@ var App = class _App extends React45.Component {
|
|
|
38264
37748
|
this.setState({
|
|
38265
37749
|
snapLines
|
|
38266
37750
|
});
|
|
38267
|
-
|
|
38268
|
-
|
|
38269
|
-
|
|
38270
|
-
|
|
38271
|
-
|
|
38272
|
-
|
|
38273
|
-
|
|
38274
|
-
|
|
38275
|
-
|
|
38276
|
-
|
|
38277
|
-
|
|
38278
|
-
|
|
38279
|
-
|
|
38280
|
-
|
|
38281
|
-
|
|
38282
|
-
|
|
38283
|
-
|
|
37751
|
+
if (!isBindingElement4(newElement5)) {
|
|
37752
|
+
dragNewElement({
|
|
37753
|
+
newElement: newElement5,
|
|
37754
|
+
elementType: this.state.activeTool.type,
|
|
37755
|
+
originX: pointerDownState.originInGrid.x,
|
|
37756
|
+
originY: pointerDownState.originInGrid.y,
|
|
37757
|
+
x: gridX,
|
|
37758
|
+
y: gridY,
|
|
37759
|
+
width: distance2(pointerDownState.originInGrid.x, gridX),
|
|
37760
|
+
height: distance2(pointerDownState.originInGrid.y, gridY),
|
|
37761
|
+
shouldMaintainAspectRatio: isImageElement9(newElement5) ? !shouldMaintainAspectRatio(event) : shouldMaintainAspectRatio(event),
|
|
37762
|
+
shouldResizeFromCenter: shouldResizeFromCenter(event),
|
|
37763
|
+
zoom: this.state.zoom.value,
|
|
37764
|
+
scene: this.scene,
|
|
37765
|
+
widthAspectRatio: aspectRatio,
|
|
37766
|
+
originOffset: this.state.originSnapOffset,
|
|
37767
|
+
informMutation
|
|
37768
|
+
});
|
|
37769
|
+
}
|
|
38284
37770
|
this.setState({
|
|
38285
|
-
newElement:
|
|
37771
|
+
newElement: newElement5
|
|
38286
37772
|
});
|
|
38287
37773
|
if (this.state.activeTool.type === TOOL_TYPE3.frame || this.state.activeTool.type === TOOL_TYPE3.magicframe) {
|
|
38288
37774
|
this.setState({
|
|
38289
37775
|
elementsToHighlight: getElementsInResizingFrame4(
|
|
38290
37776
|
this.scene.getNonDeletedElements(),
|
|
38291
|
-
|
|
37777
|
+
newElement5,
|
|
38292
37778
|
this.state,
|
|
38293
37779
|
this.scene.getNonDeletedElementsMap()
|
|
38294
37780
|
)
|
|
@@ -38426,7 +37912,7 @@ var App = class _App extends React45.Component {
|
|
|
38426
37912
|
transformHandleType,
|
|
38427
37913
|
selectedElements,
|
|
38428
37914
|
this.scene,
|
|
38429
|
-
|
|
37915
|
+
shouldRotateWithDiscreteAngle3(event),
|
|
38430
37916
|
shouldResizeFromCenter(event),
|
|
38431
37917
|
selectedElements.some((element) => isImageElement9(element)) ? !shouldMaintainAspectRatio(event) : shouldMaintainAspectRatio(event),
|
|
38432
37918
|
resizeX,
|
|
@@ -38681,7 +38167,7 @@ var App = class _App extends React45.Component {
|
|
|
38681
38167
|
() => this.scene.getElementsIncludingDeleted(),
|
|
38682
38168
|
this
|
|
38683
38169
|
);
|
|
38684
|
-
this.scene = new
|
|
38170
|
+
this.scene = new Scene();
|
|
38685
38171
|
this.canvas = document.createElement("canvas");
|
|
38686
38172
|
this.rc = rough3.canvas(this.canvas);
|
|
38687
38173
|
this.renderer = new Renderer(this.scene);
|
|
@@ -38798,15 +38284,15 @@ var App = class _App extends React45.Component {
|
|
|
38798
38284
|
"Missing last pointer move coords when changing bind skip mode for arrow start"
|
|
38799
38285
|
);
|
|
38800
38286
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
38801
|
-
const hoveredElement =
|
|
38802
|
-
|
|
38287
|
+
const hoveredElement = getHoveredElementForBinding2(
|
|
38288
|
+
pointFrom29(
|
|
38803
38289
|
this.lastPointerMoveCoords.x,
|
|
38804
38290
|
this.lastPointerMoveCoords.y
|
|
38805
38291
|
),
|
|
38806
38292
|
this.scene.getNonDeletedElements(),
|
|
38807
38293
|
elementsMap
|
|
38808
38294
|
);
|
|
38809
|
-
const element =
|
|
38295
|
+
const element = LinearElementEditor11.getElement(
|
|
38810
38296
|
this.state.selectedLinearElement.elementId,
|
|
38811
38297
|
elementsMap
|
|
38812
38298
|
);
|
|
@@ -38838,13 +38324,13 @@ var App = class _App extends React45.Component {
|
|
|
38838
38324
|
invariant16(event, "Last event must exist");
|
|
38839
38325
|
const deltaX = x - this.state.selectedLinearElement.pointerOffset.x;
|
|
38840
38326
|
const deltaY = y - this.state.selectedLinearElement.pointerOffset.y;
|
|
38841
|
-
const newState = this.state.multiElement ?
|
|
38327
|
+
const newState = this.state.multiElement ? LinearElementEditor11.handlePointerMove(
|
|
38842
38328
|
event,
|
|
38843
38329
|
this,
|
|
38844
38330
|
deltaX,
|
|
38845
38331
|
deltaY,
|
|
38846
38332
|
this.state.selectedLinearElement
|
|
38847
|
-
) :
|
|
38333
|
+
) : LinearElementEditor11.handlePointDragging(
|
|
38848
38334
|
event,
|
|
38849
38335
|
this,
|
|
38850
38336
|
deltaX,
|
|
@@ -38893,8 +38379,8 @@ var App = class _App extends React45.Component {
|
|
|
38893
38379
|
}
|
|
38894
38380
|
}
|
|
38895
38381
|
const { x, y } = this.lastPointerMoveCoords;
|
|
38896
|
-
const hoveredElement2 =
|
|
38897
|
-
|
|
38382
|
+
const hoveredElement2 = getHoveredElementForBinding2(
|
|
38383
|
+
pointFrom29(x, y),
|
|
38898
38384
|
this.scene.getNonDeletedElements(),
|
|
38899
38385
|
this.scene.getNonDeletedElementsMap()
|
|
38900
38386
|
);
|
|
@@ -38924,13 +38410,13 @@ var App = class _App extends React45.Component {
|
|
|
38924
38410
|
invariant16(event, "Last event must exist");
|
|
38925
38411
|
const deltaX = x - this.state.selectedLinearElement.pointerOffset.x;
|
|
38926
38412
|
const deltaY = y - this.state.selectedLinearElement.pointerOffset.y;
|
|
38927
|
-
const newState = this.state.multiElement ?
|
|
38413
|
+
const newState = this.state.multiElement ? LinearElementEditor11.handlePointerMove(
|
|
38928
38414
|
event,
|
|
38929
38415
|
this,
|
|
38930
38416
|
deltaX,
|
|
38931
38417
|
deltaY,
|
|
38932
38418
|
this.state.selectedLinearElement
|
|
38933
|
-
) :
|
|
38419
|
+
) : LinearElementEditor11.handlePointDragging(
|
|
38934
38420
|
event,
|
|
38935
38421
|
this,
|
|
38936
38422
|
deltaX,
|
|
@@ -39124,7 +38610,7 @@ var App = class _App extends React45.Component {
|
|
|
39124
38610
|
html, body {
|
|
39125
38611
|
width: 100%;
|
|
39126
38612
|
height: 100%;
|
|
39127
|
-
color: ${this.state.theme ===
|
|
38613
|
+
color: ${this.state.theme === THEME17.DARK ? "white" : "black"};
|
|
39128
38614
|
}
|
|
39129
38615
|
body {
|
|
39130
38616
|
display: flex;
|
|
@@ -39524,7 +39010,8 @@ var App = class _App extends React45.Component {
|
|
|
39524
39010
|
canvasBackgroundColor: this.state.viewBackgroundColor,
|
|
39525
39011
|
embedsValidationStatus: this.embedsValidationStatus,
|
|
39526
39012
|
elementsPendingErasure: this.elementsPendingErasure,
|
|
39527
|
-
pendingFlowchartNodes: this.flowChartCreator.pendingNodes
|
|
39013
|
+
pendingFlowchartNodes: this.flowChartCreator.pendingNodes,
|
|
39014
|
+
theme: this.state.theme
|
|
39528
39015
|
}
|
|
39529
39016
|
}
|
|
39530
39017
|
),
|
|
@@ -39543,7 +39030,8 @@ var App = class _App extends React45.Component {
|
|
|
39543
39030
|
canvasBackgroundColor: this.state.viewBackgroundColor,
|
|
39544
39031
|
embedsValidationStatus: this.embedsValidationStatus,
|
|
39545
39032
|
elementsPendingErasure: this.elementsPendingErasure,
|
|
39546
|
-
pendingFlowchartNodes: null
|
|
39033
|
+
pendingFlowchartNodes: null,
|
|
39034
|
+
theme: this.state.theme
|
|
39547
39035
|
}
|
|
39548
39036
|
}
|
|
39549
39037
|
),
|
|
@@ -39704,7 +39192,7 @@ var App = class _App extends React45.Component {
|
|
|
39704
39192
|
async componentDidMount() {
|
|
39705
39193
|
this.unmounted = false;
|
|
39706
39194
|
this.excalidrawContainerValue.container = this.excalidrawContainerRef.current;
|
|
39707
|
-
if (isTestEnv5() ||
|
|
39195
|
+
if (isTestEnv5() || isDevEnv9()) {
|
|
39708
39196
|
const setState = this.setState.bind(this);
|
|
39709
39197
|
Object.defineProperties(window.h, {
|
|
39710
39198
|
state: {
|
|
@@ -39775,7 +39263,7 @@ var App = class _App extends React45.Component {
|
|
|
39775
39263
|
});
|
|
39776
39264
|
this.renderer.destroy();
|
|
39777
39265
|
this.scene.destroy();
|
|
39778
|
-
this.scene = new
|
|
39266
|
+
this.scene = new Scene();
|
|
39779
39267
|
this.fonts = new Fonts(this.scene);
|
|
39780
39268
|
this.renderer = new Renderer(this.scene);
|
|
39781
39269
|
this.files = {};
|
|
@@ -39988,7 +39476,7 @@ var App = class _App extends React45.Component {
|
|
|
39988
39476
|
}
|
|
39989
39477
|
this.excalidrawContainerRef.current?.classList.toggle(
|
|
39990
39478
|
"theme--dark",
|
|
39991
|
-
this.state.theme ===
|
|
39479
|
+
this.state.theme === THEME17.DARK
|
|
39992
39480
|
);
|
|
39993
39481
|
if (this.state.selectedLinearElement?.isEditing && !this.state.selectedElementIds[this.state.selectedLinearElement.elementId]) {
|
|
39994
39482
|
setTimeout(() => {
|
|
@@ -40054,7 +39542,7 @@ var App = class _App extends React45.Component {
|
|
|
40054
39542
|
return;
|
|
40055
39543
|
}
|
|
40056
39544
|
if (data.elements) {
|
|
40057
|
-
const elements = data.programmaticAPI ?
|
|
39545
|
+
const elements = data.programmaticAPI ? convertToExcalidrawElements2(
|
|
40058
39546
|
data.elements
|
|
40059
39547
|
) : data.elements;
|
|
40060
39548
|
this.addElementsFromPasteOrLibrary({
|
|
@@ -40072,7 +39560,7 @@ var App = class _App extends React45.Component {
|
|
|
40072
39560
|
const api = await import("@excalidraw/mermaid-to-excalidraw");
|
|
40073
39561
|
try {
|
|
40074
39562
|
const { elements: skeletonElements, files } = await api.parseMermaidToExcalidraw(data.text);
|
|
40075
|
-
const elements =
|
|
39563
|
+
const elements = convertToExcalidrawElements2(skeletonElements, {
|
|
40076
39564
|
regenerateIds: true
|
|
40077
39565
|
});
|
|
40078
39566
|
this.addElementsFromPasteOrLibrary({
|
|
@@ -40182,11 +39670,11 @@ var App = class _App extends React45.Component {
|
|
|
40182
39670
|
verticalAlign: DEFAULT_VERTICAL_ALIGN,
|
|
40183
39671
|
locked: false
|
|
40184
39672
|
};
|
|
40185
|
-
const fontString =
|
|
39673
|
+
const fontString = getFontString9({
|
|
40186
39674
|
fontSize: textElementProps.fontSize,
|
|
40187
39675
|
fontFamily: textElementProps.fontFamily
|
|
40188
39676
|
});
|
|
40189
|
-
const lineHeight =
|
|
39677
|
+
const lineHeight = getLineHeight4(textElementProps.fontFamily);
|
|
40190
39678
|
const [x1, , x2] = getVisibleSceneBounds(this.state);
|
|
40191
39679
|
const maxTextWidth = Math.max(Math.min((x2 - x1) * 0.5, 800), 200);
|
|
40192
39680
|
const LINE_GAP = 10;
|
|
@@ -40194,19 +39682,19 @@ var App = class _App extends React45.Component {
|
|
|
40194
39682
|
const lines = isPlainPaste ? [text] : text.split("\n");
|
|
40195
39683
|
const textElements = lines.reduce(
|
|
40196
39684
|
(acc, line, idx) => {
|
|
40197
|
-
const originalText =
|
|
39685
|
+
const originalText = normalizeText2(line).trim();
|
|
40198
39686
|
if (originalText.length) {
|
|
40199
39687
|
const topLayerFrame = this.getTopLayerFrameAtSceneCoords({
|
|
40200
39688
|
x,
|
|
40201
39689
|
y: currentY
|
|
40202
39690
|
});
|
|
40203
|
-
let metrics =
|
|
39691
|
+
let metrics = measureText6(originalText, fontString, lineHeight);
|
|
40204
39692
|
const isTextUnwrapped = metrics.width > maxTextWidth;
|
|
40205
39693
|
const text2 = isTextUnwrapped ? wrapText4(originalText, fontString, maxTextWidth) : originalText;
|
|
40206
|
-
metrics = isTextUnwrapped ?
|
|
39694
|
+
metrics = isTextUnwrapped ? measureText6(text2, fontString, lineHeight) : metrics;
|
|
40207
39695
|
const startX = x - metrics.width / 2;
|
|
40208
39696
|
const startY = currentY - metrics.height / 2;
|
|
40209
|
-
const element =
|
|
39697
|
+
const element = newTextElement3({
|
|
40210
39698
|
...textElementProps,
|
|
40211
39699
|
x: startX,
|
|
40212
39700
|
y: startY,
|
|
@@ -40382,7 +39870,7 @@ var App = class _App extends React45.Component {
|
|
|
40382
39870
|
}
|
|
40383
39871
|
const elementWithHighestZIndex = allHitElements[allHitElements.length - 1];
|
|
40384
39872
|
return hitElementItself({
|
|
40385
|
-
point:
|
|
39873
|
+
point: pointFrom29(x, y),
|
|
40386
39874
|
element: elementWithHighestZIndex,
|
|
40387
39875
|
// when overlapping, we would like to be more precise
|
|
40388
39876
|
// this also avoids the need to update past tests
|
|
@@ -40426,7 +39914,7 @@ var App = class _App extends React45.Component {
|
|
|
40426
39914
|
hitElement(x, y, element, considerBoundingBox = true) {
|
|
40427
39915
|
if (considerBoundingBox && this.state.selectedElementIds[element.id] && hasBoundingBox2([element], this.state, this.editorInterface)) {
|
|
40428
39916
|
if (hitElementBoundingBox2(
|
|
40429
|
-
|
|
39917
|
+
pointFrom29(x, y),
|
|
40430
39918
|
element,
|
|
40431
39919
|
this.scene.getNonDeletedElementsMap(),
|
|
40432
39920
|
this.getElementHitThreshold(element)
|
|
@@ -40435,7 +39923,7 @@ var App = class _App extends React45.Component {
|
|
|
40435
39923
|
}
|
|
40436
39924
|
}
|
|
40437
39925
|
const hitBoundTextOfElement = hitElementBoundText(
|
|
40438
|
-
|
|
39926
|
+
pointFrom29(x, y),
|
|
40439
39927
|
element,
|
|
40440
39928
|
this.scene.getNonDeletedElementsMap()
|
|
40441
39929
|
);
|
|
@@ -40443,7 +39931,7 @@ var App = class _App extends React45.Component {
|
|
|
40443
39931
|
return true;
|
|
40444
39932
|
}
|
|
40445
39933
|
return hitElementItself({
|
|
40446
|
-
point:
|
|
39934
|
+
point: pointFrom29(x, y),
|
|
40447
39935
|
element,
|
|
40448
39936
|
threshold: this.getElementHitThreshold(element),
|
|
40449
39937
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
@@ -40465,8 +39953,8 @@ var App = class _App extends React45.Component {
|
|
|
40465
39953
|
elements[index],
|
|
40466
39954
|
this.scene.getNonDeletedElementsMap()
|
|
40467
39955
|
);
|
|
40468
|
-
if (
|
|
40469
|
-
point:
|
|
39956
|
+
if (isArrowElement13(elements[index]) && hitElementItself({
|
|
39957
|
+
point: pointFrom29(x, y),
|
|
40470
39958
|
element: elements[index],
|
|
40471
39959
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
40472
39960
|
threshold: this.getElementHitThreshold(elements[index])
|
|
@@ -40482,7 +39970,7 @@ var App = class _App extends React45.Component {
|
|
|
40482
39970
|
}
|
|
40483
39971
|
handleHoverSelectedLinearElement(linearElementEditor, scenePointerX, scenePointerY) {
|
|
40484
39972
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
40485
|
-
const element =
|
|
39973
|
+
const element = LinearElementEditor11.getElement(
|
|
40486
39974
|
linearElementEditor.elementId,
|
|
40487
39975
|
elementsMap
|
|
40488
39976
|
);
|
|
@@ -40493,19 +39981,19 @@ var App = class _App extends React45.Component {
|
|
|
40493
39981
|
let hoverPointIndex = -1;
|
|
40494
39982
|
let segmentMidPointHoveredCoords = null;
|
|
40495
39983
|
if (hitElementItself({
|
|
40496
|
-
point:
|
|
39984
|
+
point: pointFrom29(scenePointerX, scenePointerY),
|
|
40497
39985
|
element,
|
|
40498
39986
|
elementsMap,
|
|
40499
39987
|
threshold: this.getElementHitThreshold(element)
|
|
40500
39988
|
})) {
|
|
40501
|
-
hoverPointIndex =
|
|
39989
|
+
hoverPointIndex = LinearElementEditor11.getPointIndexUnderCursor(
|
|
40502
39990
|
element,
|
|
40503
39991
|
elementsMap,
|
|
40504
39992
|
this.state.zoom,
|
|
40505
39993
|
scenePointerX,
|
|
40506
39994
|
scenePointerY
|
|
40507
39995
|
);
|
|
40508
|
-
segmentMidPointHoveredCoords =
|
|
39996
|
+
segmentMidPointHoveredCoords = LinearElementEditor11.getSegmentMidpointHitCoords(
|
|
40509
39997
|
linearElementEditor,
|
|
40510
39998
|
{ x: scenePointerX, y: scenePointerY },
|
|
40511
39999
|
this.state,
|
|
@@ -40542,7 +40030,7 @@ var App = class _App extends React45.Component {
|
|
|
40542
40030
|
}
|
|
40543
40031
|
});
|
|
40544
40032
|
}
|
|
40545
|
-
if (!
|
|
40033
|
+
if (!LinearElementEditor11.arePointsEqual(
|
|
40546
40034
|
this.state.selectedLinearElement.segmentMidPointHoveredCoords,
|
|
40547
40035
|
segmentMidPointHoveredCoords
|
|
40548
40036
|
)) {
|
|
@@ -40573,7 +40061,7 @@ var App = class _App extends React45.Component {
|
|
|
40573
40061
|
initialPointerDownState(event) {
|
|
40574
40062
|
const origin = viewportCoordsToSceneCoords3(event, this.state);
|
|
40575
40063
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
40576
|
-
const [minX, minY, maxX, maxY] =
|
|
40064
|
+
const [minX, minY, maxX, maxY] = getCommonBounds11(selectedElements);
|
|
40577
40065
|
const isElbowArrowOnly = selectedElements.findIndex(isElbowArrow10) === 0;
|
|
40578
40066
|
return {
|
|
40579
40067
|
origin,
|
|
@@ -40673,7 +40161,7 @@ var App = class _App extends React45.Component {
|
|
|
40673
40161
|
DEFAULT_COLLISION_THRESHOLD / this.state.zoom.value,
|
|
40674
40162
|
1
|
|
40675
40163
|
);
|
|
40676
|
-
const [x1, y1, x2, y2] =
|
|
40164
|
+
const [x1, y1, x2, y2] = getCommonBounds11(selectedElements);
|
|
40677
40165
|
return point.x > x1 - threshold && point.x < x2 + threshold && point.y > y1 - threshold && point.y < y2 + threshold;
|
|
40678
40166
|
}
|
|
40679
40167
|
getCurrentItemRoundness(elementType) {
|
|
@@ -40749,7 +40237,7 @@ var App = class _App extends React45.Component {
|
|
|
40749
40237
|
);
|
|
40750
40238
|
let index = this.state.selectedLinearElement.initialState.segmentMidpoint.index;
|
|
40751
40239
|
if (index < 0) {
|
|
40752
|
-
const nextCoords =
|
|
40240
|
+
const nextCoords = LinearElementEditor11.getSegmentMidpointHitCoords(
|
|
40753
40241
|
{
|
|
40754
40242
|
...this.state.selectedLinearElement,
|
|
40755
40243
|
segmentMidPointHoveredCoords: null
|
|
@@ -40758,14 +40246,14 @@ var App = class _App extends React45.Component {
|
|
|
40758
40246
|
this.state,
|
|
40759
40247
|
this.scene.getNonDeletedElementsMap()
|
|
40760
40248
|
);
|
|
40761
|
-
index = nextCoords ?
|
|
40249
|
+
index = nextCoords ? LinearElementEditor11.getSegmentMidPointIndex(
|
|
40762
40250
|
this.state.selectedLinearElement,
|
|
40763
40251
|
this.state,
|
|
40764
40252
|
nextCoords,
|
|
40765
40253
|
this.scene.getNonDeletedElementsMap()
|
|
40766
40254
|
) : -1;
|
|
40767
40255
|
}
|
|
40768
|
-
const ret =
|
|
40256
|
+
const ret = LinearElementEditor11.moveFixedSegment(
|
|
40769
40257
|
this.state.selectedLinearElement,
|
|
40770
40258
|
index,
|
|
40771
40259
|
gridX2,
|
|
@@ -40825,13 +40313,13 @@ var App = class _App extends React45.Component {
|
|
|
40825
40313
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
40826
40314
|
if (this.state.selectedLinearElement) {
|
|
40827
40315
|
const linearElementEditor = this.state.selectedLinearElement;
|
|
40828
|
-
if (
|
|
40316
|
+
if (LinearElementEditor11.shouldAddMidpoint(
|
|
40829
40317
|
this.state.selectedLinearElement,
|
|
40830
40318
|
pointerCoords,
|
|
40831
40319
|
this.state,
|
|
40832
40320
|
elementsMap
|
|
40833
40321
|
)) {
|
|
40834
|
-
const ret =
|
|
40322
|
+
const ret = LinearElementEditor11.addMidpoint(
|
|
40835
40323
|
this.state.selectedLinearElement,
|
|
40836
40324
|
pointerCoords,
|
|
40837
40325
|
this,
|
|
@@ -40857,7 +40345,7 @@ var App = class _App extends React45.Component {
|
|
|
40857
40345
|
} else if (linearElementEditor.initialState.segmentMidpoint.value !== null && !linearElementEditor.initialState.segmentMidpoint.added) {
|
|
40858
40346
|
return;
|
|
40859
40347
|
} else if (linearElementEditor.initialState.lastClickedPoint > -1) {
|
|
40860
|
-
const element =
|
|
40348
|
+
const element = LinearElementEditor11.getElement(
|
|
40861
40349
|
linearElementEditor.elementId,
|
|
40862
40350
|
elementsMap
|
|
40863
40351
|
);
|
|
@@ -40865,8 +40353,8 @@ var App = class _App extends React45.Component {
|
|
|
40865
40353
|
return;
|
|
40866
40354
|
}
|
|
40867
40355
|
if (isBindingElement4(element)) {
|
|
40868
|
-
const hoveredElement =
|
|
40869
|
-
|
|
40356
|
+
const hoveredElement = getHoveredElementForBinding2(
|
|
40357
|
+
pointFrom29(pointerCoords.x, pointerCoords.y),
|
|
40870
40358
|
this.scene.getNonDeletedElements(),
|
|
40871
40359
|
elementsMap
|
|
40872
40360
|
);
|
|
@@ -40880,7 +40368,7 @@ var App = class _App extends React45.Component {
|
|
|
40880
40368
|
if (linearElementEditor.initialState.lastClickedPoint === -1) {
|
|
40881
40369
|
return;
|
|
40882
40370
|
}
|
|
40883
|
-
const newState =
|
|
40371
|
+
const newState = LinearElementEditor11.handlePointDragging(
|
|
40884
40372
|
event,
|
|
40885
40373
|
this,
|
|
40886
40374
|
pointerCoords.x,
|
|
@@ -40967,22 +40455,22 @@ var App = class _App extends React45.Component {
|
|
|
40967
40455
|
);
|
|
40968
40456
|
const topLeft = vectorFromPoint10(
|
|
40969
40457
|
pointRotateRads19(
|
|
40970
|
-
|
|
40971
|
-
|
|
40458
|
+
pointFrom29(x1, y1),
|
|
40459
|
+
pointFrom29(cx, cy),
|
|
40972
40460
|
croppingElement.angle
|
|
40973
40461
|
)
|
|
40974
40462
|
);
|
|
40975
40463
|
const topRight = vectorFromPoint10(
|
|
40976
40464
|
pointRotateRads19(
|
|
40977
|
-
|
|
40978
|
-
|
|
40465
|
+
pointFrom29(x2, y1),
|
|
40466
|
+
pointFrom29(cx, cy),
|
|
40979
40467
|
croppingElement.angle
|
|
40980
40468
|
)
|
|
40981
40469
|
);
|
|
40982
40470
|
const bottomLeft = vectorFromPoint10(
|
|
40983
40471
|
pointRotateRads19(
|
|
40984
|
-
|
|
40985
|
-
|
|
40472
|
+
pointFrom29(x1, y2),
|
|
40473
|
+
pointFrom29(cx, cy),
|
|
40986
40474
|
croppingElement.angle
|
|
40987
40475
|
)
|
|
40988
40476
|
);
|
|
@@ -41108,7 +40596,7 @@ var App = class _App extends React45.Component {
|
|
|
41108
40596
|
);
|
|
41109
40597
|
const elementsWithIndices = syncMovedIndices4(
|
|
41110
40598
|
mappedNewSceneElements || mappedClonedElements,
|
|
41111
|
-
|
|
40599
|
+
arrayToMap26(duplicatedElements)
|
|
41112
40600
|
);
|
|
41113
40601
|
flushSync3(() => {
|
|
41114
40602
|
if (pointerDownState.hit.element) {
|
|
@@ -41188,22 +40676,22 @@ var App = class _App extends React45.Component {
|
|
|
41188
40676
|
);
|
|
41189
40677
|
}
|
|
41190
40678
|
} else {
|
|
41191
|
-
const
|
|
41192
|
-
if (!
|
|
40679
|
+
const newElement5 = this.state.newElement;
|
|
40680
|
+
if (!newElement5) {
|
|
41193
40681
|
return;
|
|
41194
40682
|
}
|
|
41195
|
-
if (
|
|
41196
|
-
const points =
|
|
41197
|
-
const dx = pointerCoords.x -
|
|
41198
|
-
const dy = pointerCoords.y -
|
|
40683
|
+
if (newElement5.type === "freedraw") {
|
|
40684
|
+
const points = newElement5.points;
|
|
40685
|
+
const dx = pointerCoords.x - newElement5.x;
|
|
40686
|
+
const dy = pointerCoords.y - newElement5.y;
|
|
41199
40687
|
const lastPoint = points.length > 0 && points[points.length - 1];
|
|
41200
40688
|
const discardPoint = lastPoint && lastPoint[0] === dx && lastPoint[1] === dy;
|
|
41201
40689
|
if (!discardPoint) {
|
|
41202
|
-
const pressures =
|
|
40690
|
+
const pressures = newElement5.simulatePressure ? newElement5.pressures : [...newElement5.pressures, event.pressure];
|
|
41203
40691
|
this.scene.mutateElement(
|
|
41204
|
-
|
|
40692
|
+
newElement5,
|
|
41205
40693
|
{
|
|
41206
|
-
points: [...points,
|
|
40694
|
+
points: [...points, pointFrom29(dx, dy)],
|
|
41207
40695
|
pressures
|
|
41208
40696
|
},
|
|
41209
40697
|
{
|
|
@@ -41212,20 +40700,20 @@ var App = class _App extends React45.Component {
|
|
|
41212
40700
|
}
|
|
41213
40701
|
);
|
|
41214
40702
|
this.setState({
|
|
41215
|
-
newElement:
|
|
40703
|
+
newElement: newElement5
|
|
41216
40704
|
});
|
|
41217
40705
|
}
|
|
41218
|
-
} else if (isLinearElement12(
|
|
40706
|
+
} else if (isLinearElement12(newElement5) && !newElement5.isDeleted) {
|
|
41219
40707
|
pointerDownState.drag.hasOccurred = true;
|
|
41220
|
-
const points =
|
|
40708
|
+
const points = newElement5.points;
|
|
41221
40709
|
invariant16(
|
|
41222
40710
|
points.length > 1,
|
|
41223
40711
|
"Do not create linear elements with less than 2 points"
|
|
41224
40712
|
);
|
|
41225
40713
|
let linearElementEditor = this.state.selectedLinearElement;
|
|
41226
40714
|
if (!linearElementEditor) {
|
|
41227
|
-
linearElementEditor = new
|
|
41228
|
-
|
|
40715
|
+
linearElementEditor = new LinearElementEditor11(
|
|
40716
|
+
newElement5,
|
|
41229
40717
|
this.scene.getNonDeletedElementsMap()
|
|
41230
40718
|
);
|
|
41231
40719
|
linearElementEditor = {
|
|
@@ -41238,8 +40726,8 @@ var App = class _App extends React45.Component {
|
|
|
41238
40726
|
};
|
|
41239
40727
|
}
|
|
41240
40728
|
this.setState({
|
|
41241
|
-
newElement:
|
|
41242
|
-
...
|
|
40729
|
+
newElement: newElement5,
|
|
40730
|
+
...LinearElementEditor11.handlePointDragging(
|
|
41243
40731
|
event,
|
|
41244
40732
|
this,
|
|
41245
40733
|
gridX,
|
|
@@ -41257,7 +40745,7 @@ var App = class _App extends React45.Component {
|
|
|
41257
40745
|
pointerDownState.boxSelection.hasOccurred = true;
|
|
41258
40746
|
const elements = this.scene.getNonDeletedElements();
|
|
41259
40747
|
if (this.state.selectedLinearElement?.isEditing) {
|
|
41260
|
-
|
|
40748
|
+
LinearElementEditor11.handleBoxSelection(
|
|
41261
40749
|
event,
|
|
41262
40750
|
this.state,
|
|
41263
40751
|
this.setState.bind(this),
|
|
@@ -41320,7 +40808,7 @@ var App = class _App extends React45.Component {
|
|
|
41320
40808
|
this
|
|
41321
40809
|
),
|
|
41322
40810
|
// select linear element only when we haven't box-selected anything else
|
|
41323
|
-
selectedLinearElement: elementsWithinSelection.length === 1 && isLinearElement12(elementsWithinSelection[0]) ? new
|
|
40811
|
+
selectedLinearElement: elementsWithinSelection.length === 1 && isLinearElement12(elementsWithinSelection[0]) ? new LinearElementEditor11(
|
|
41324
40812
|
elementsWithinSelection[0],
|
|
41325
40813
|
this.scene.getNonDeletedElementsMap()
|
|
41326
40814
|
) : null,
|
|
@@ -41362,7 +40850,7 @@ var App = class _App extends React45.Component {
|
|
|
41362
40850
|
pointerDownState.eventListeners.onMove.flush();
|
|
41363
40851
|
}
|
|
41364
40852
|
const {
|
|
41365
|
-
newElement:
|
|
40853
|
+
newElement: newElement5,
|
|
41366
40854
|
resizingElement,
|
|
41367
40855
|
croppingElementId,
|
|
41368
40856
|
multiElement,
|
|
@@ -41434,7 +40922,7 @@ var App = class _App extends React45.Component {
|
|
|
41434
40922
|
if (!pointerDownState.boxSelection.hasOccurred && pointerDownState.hit?.element?.id !== this.state.selectedLinearElement.elementId) {
|
|
41435
40923
|
this.actionManager.executeAction(actionFinalize);
|
|
41436
40924
|
} else {
|
|
41437
|
-
const editingLinearElement =
|
|
40925
|
+
const editingLinearElement = LinearElementEditor11.handlePointerUp(
|
|
41438
40926
|
childEvent,
|
|
41439
40927
|
this.state.selectedLinearElement,
|
|
41440
40928
|
this.state,
|
|
@@ -41453,7 +40941,7 @@ var App = class _App extends React45.Component {
|
|
|
41453
40941
|
}
|
|
41454
40942
|
} else if (this.state.selectedLinearElement) {
|
|
41455
40943
|
if (this.state.selectedLinearElement.elbowed) {
|
|
41456
|
-
const element =
|
|
40944
|
+
const element = LinearElementEditor11.getElement(
|
|
41457
40945
|
this.state.selectedLinearElement.elementId,
|
|
41458
40946
|
this.scene.getNonDeletedElementsMap()
|
|
41459
40947
|
);
|
|
@@ -41508,28 +40996,28 @@ var App = class _App extends React45.Component {
|
|
|
41508
40996
|
pointerDownState,
|
|
41509
40997
|
childEvent
|
|
41510
40998
|
);
|
|
41511
|
-
if (
|
|
40999
|
+
if (newElement5?.type === "freedraw") {
|
|
41512
41000
|
const pointerCoords = viewportCoordsToSceneCoords3(
|
|
41513
41001
|
childEvent,
|
|
41514
41002
|
this.state
|
|
41515
41003
|
);
|
|
41516
|
-
const points =
|
|
41517
|
-
let dx = pointerCoords.x -
|
|
41518
|
-
let dy = pointerCoords.y -
|
|
41004
|
+
const points = newElement5.points;
|
|
41005
|
+
let dx = pointerCoords.x - newElement5.x;
|
|
41006
|
+
let dy = pointerCoords.y - newElement5.y;
|
|
41519
41007
|
if (dx === points[0][0] && dy === points[0][1]) {
|
|
41520
41008
|
dy += 1e-4;
|
|
41521
41009
|
dx += 1e-4;
|
|
41522
41010
|
}
|
|
41523
|
-
const pressures =
|
|
41524
|
-
this.scene.mutateElement(
|
|
41525
|
-
points: [...points,
|
|
41011
|
+
const pressures = newElement5.simulatePressure ? [] : [...newElement5.pressures, childEvent.pressure];
|
|
41012
|
+
this.scene.mutateElement(newElement5, {
|
|
41013
|
+
points: [...points, pointFrom29(dx, dy)],
|
|
41526
41014
|
pressures
|
|
41527
41015
|
});
|
|
41528
41016
|
this.actionManager.executeAction(actionFinalize);
|
|
41529
41017
|
return;
|
|
41530
41018
|
}
|
|
41531
|
-
if (isLinearElement12(
|
|
41532
|
-
if (
|
|
41019
|
+
if (isLinearElement12(newElement5)) {
|
|
41020
|
+
if (newElement5.points.length > 1 && newElement5.points[1][0] !== 0 && newElement5.points[1][1] !== 0) {
|
|
41533
41021
|
this.store.scheduleCapture();
|
|
41534
41022
|
}
|
|
41535
41023
|
const pointerCoords = viewportCoordsToSceneCoords3(
|
|
@@ -41537,44 +41025,44 @@ var App = class _App extends React45.Component {
|
|
|
41537
41025
|
this.state
|
|
41538
41026
|
);
|
|
41539
41027
|
const dragDistance = pointDistance8(
|
|
41540
|
-
|
|
41541
|
-
|
|
41028
|
+
pointFrom29(pointerCoords.x, pointerCoords.y),
|
|
41029
|
+
pointFrom29(pointerDownState.origin.x, pointerDownState.origin.y)
|
|
41542
41030
|
) * this.state.zoom.value;
|
|
41543
|
-
if ((!pointerDownState.drag.hasOccurred || dragDistance < MINIMUM_ARROW_SIZE) &&
|
|
41031
|
+
if ((!pointerDownState.drag.hasOccurred || dragDistance < MINIMUM_ARROW_SIZE) && newElement5 && !multiElement) {
|
|
41544
41032
|
if (this.editorInterface.isTouchScreen) {
|
|
41545
41033
|
const FIXED_DELTA_X = Math.min(
|
|
41546
41034
|
this.state.width * 0.7 / this.state.zoom.value,
|
|
41547
41035
|
100
|
|
41548
41036
|
);
|
|
41549
41037
|
this.scene.mutateElement(
|
|
41550
|
-
|
|
41038
|
+
newElement5,
|
|
41551
41039
|
{
|
|
41552
|
-
x:
|
|
41040
|
+
x: newElement5.x - FIXED_DELTA_X / 2,
|
|
41553
41041
|
points: [
|
|
41554
|
-
|
|
41555
|
-
|
|
41042
|
+
pointFrom29(0, 0),
|
|
41043
|
+
pointFrom29(FIXED_DELTA_X, 0)
|
|
41556
41044
|
]
|
|
41557
41045
|
},
|
|
41558
41046
|
{ informMutation: false, isDragging: false }
|
|
41559
41047
|
);
|
|
41560
41048
|
this.actionManager.executeAction(actionFinalize);
|
|
41561
41049
|
} else {
|
|
41562
|
-
const dx = pointerCoords.x -
|
|
41563
|
-
const dy = pointerCoords.y -
|
|
41050
|
+
const dx = pointerCoords.x - newElement5.x;
|
|
41051
|
+
const dy = pointerCoords.y - newElement5.y;
|
|
41564
41052
|
this.scene.mutateElement(
|
|
41565
|
-
|
|
41053
|
+
newElement5,
|
|
41566
41054
|
{
|
|
41567
|
-
points: [
|
|
41055
|
+
points: [newElement5.points[0], pointFrom29(dx, dy)]
|
|
41568
41056
|
},
|
|
41569
41057
|
{ informMutation: false, isDragging: false }
|
|
41570
41058
|
);
|
|
41571
41059
|
this.setState({
|
|
41572
|
-
multiElement:
|
|
41573
|
-
newElement:
|
|
41060
|
+
multiElement: newElement5,
|
|
41061
|
+
newElement: newElement5
|
|
41574
41062
|
});
|
|
41575
41063
|
}
|
|
41576
41064
|
} else if (pointerDownState.drag.hasOccurred && !multiElement) {
|
|
41577
|
-
if (isBindingElement4(
|
|
41065
|
+
if (isBindingElement4(newElement5, false)) {
|
|
41578
41066
|
this.actionManager.executeAction(actionFinalize, "ui", {
|
|
41579
41067
|
event: childEvent,
|
|
41580
41068
|
sceneCoords
|
|
@@ -41591,12 +41079,12 @@ var App = class _App extends React45.Component {
|
|
|
41591
41079
|
selectedElementIds: makeNextSelectedElementIds2(
|
|
41592
41080
|
{
|
|
41593
41081
|
...prevState.selectedElementIds,
|
|
41594
|
-
[
|
|
41082
|
+
[newElement5.id]: true
|
|
41595
41083
|
},
|
|
41596
41084
|
prevState
|
|
41597
41085
|
),
|
|
41598
|
-
selectedLinearElement: new
|
|
41599
|
-
|
|
41086
|
+
selectedLinearElement: new LinearElementEditor11(
|
|
41087
|
+
newElement5,
|
|
41600
41088
|
this.scene.getNonDeletedElementsMap()
|
|
41601
41089
|
)
|
|
41602
41090
|
}));
|
|
@@ -41609,27 +41097,27 @@ var App = class _App extends React45.Component {
|
|
|
41609
41097
|
}
|
|
41610
41098
|
return;
|
|
41611
41099
|
}
|
|
41612
|
-
if (isTextElement19(
|
|
41100
|
+
if (isTextElement19(newElement5)) {
|
|
41613
41101
|
const minWidth = getMinTextElementWidth(
|
|
41614
|
-
|
|
41615
|
-
fontSize:
|
|
41616
|
-
fontFamily:
|
|
41102
|
+
getFontString9({
|
|
41103
|
+
fontSize: newElement5.fontSize,
|
|
41104
|
+
fontFamily: newElement5.fontFamily
|
|
41617
41105
|
}),
|
|
41618
|
-
|
|
41106
|
+
newElement5.lineHeight
|
|
41619
41107
|
);
|
|
41620
|
-
if (
|
|
41621
|
-
this.scene.mutateElement(
|
|
41108
|
+
if (newElement5.width < minWidth) {
|
|
41109
|
+
this.scene.mutateElement(newElement5, {
|
|
41622
41110
|
autoResize: true
|
|
41623
41111
|
});
|
|
41624
41112
|
}
|
|
41625
41113
|
this.resetCursor();
|
|
41626
|
-
this.handleTextWysiwyg(
|
|
41114
|
+
this.handleTextWysiwyg(newElement5, {
|
|
41627
41115
|
isExistingElement: true
|
|
41628
41116
|
});
|
|
41629
41117
|
}
|
|
41630
|
-
if (activeTool.type !== "selection" &&
|
|
41118
|
+
if (activeTool.type !== "selection" && newElement5 && isInvisiblySmallElement3(newElement5)) {
|
|
41631
41119
|
this.updateScene({
|
|
41632
|
-
elements: this.scene.getElementsIncludingDeleted().filter((el) => el.id !==
|
|
41120
|
+
elements: this.scene.getElementsIncludingDeleted().filter((el) => el.id !== newElement5.id),
|
|
41633
41121
|
appState: {
|
|
41634
41122
|
newElement: null
|
|
41635
41123
|
},
|
|
@@ -41637,25 +41125,25 @@ var App = class _App extends React45.Component {
|
|
|
41637
41125
|
});
|
|
41638
41126
|
return;
|
|
41639
41127
|
}
|
|
41640
|
-
if (isFrameLikeElement15(
|
|
41128
|
+
if (isFrameLikeElement15(newElement5)) {
|
|
41641
41129
|
const elementsInsideFrame = getElementsInNewFrame(
|
|
41642
41130
|
this.scene.getElementsIncludingDeleted(),
|
|
41643
|
-
|
|
41131
|
+
newElement5,
|
|
41644
41132
|
this.scene.getNonDeletedElementsMap()
|
|
41645
41133
|
);
|
|
41646
41134
|
this.scene.replaceAllElements(
|
|
41647
41135
|
addElementsToFrame2(
|
|
41648
41136
|
this.scene.getElementsMapIncludingDeleted(),
|
|
41649
41137
|
elementsInsideFrame,
|
|
41650
|
-
|
|
41138
|
+
newElement5,
|
|
41651
41139
|
this.state
|
|
41652
41140
|
)
|
|
41653
41141
|
);
|
|
41654
41142
|
}
|
|
41655
|
-
if (
|
|
41143
|
+
if (newElement5) {
|
|
41656
41144
|
this.scene.mutateElement(
|
|
41657
|
-
|
|
41658
|
-
getNormalizedDimensions(
|
|
41145
|
+
newElement5,
|
|
41146
|
+
getNormalizedDimensions(newElement5),
|
|
41659
41147
|
{
|
|
41660
41148
|
informMutation: false,
|
|
41661
41149
|
isDragging: false
|
|
@@ -41792,7 +41280,7 @@ var App = class _App extends React45.Component {
|
|
|
41792
41280
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
41793
41281
|
if (selectedElements.length === 1) {
|
|
41794
41282
|
this.setState({
|
|
41795
|
-
selectedLinearElement: new
|
|
41283
|
+
selectedLinearElement: new LinearElementEditor11(
|
|
41796
41284
|
hitElement,
|
|
41797
41285
|
this.scene.getNonDeletedElementsMap()
|
|
41798
41286
|
)
|
|
@@ -41813,8 +41301,8 @@ var App = class _App extends React45.Component {
|
|
|
41813
41301
|
if (isEraserActive(this.state) && pointerStart && pointerEnd) {
|
|
41814
41302
|
this.eraserTrail.endPath();
|
|
41815
41303
|
const draggedDistance = pointDistance8(
|
|
41816
|
-
|
|
41817
|
-
|
|
41304
|
+
pointFrom29(pointerStart.clientX, pointerStart.clientY),
|
|
41305
|
+
pointFrom29(pointerEnd.clientX, pointerEnd.clientY)
|
|
41818
41306
|
);
|
|
41819
41307
|
if (draggedDistance === 0) {
|
|
41820
41308
|
const scenePointer = viewportCoordsToSceneCoords3(
|
|
@@ -41889,7 +41377,7 @@ var App = class _App extends React45.Component {
|
|
|
41889
41377
|
this
|
|
41890
41378
|
),
|
|
41891
41379
|
// set selectedLinearElement only if thats the only element selected
|
|
41892
|
-
selectedLinearElement: newSelectedElements.length === 1 && isLinearElement12(newSelectedElements[0]) ? new
|
|
41380
|
+
selectedLinearElement: newSelectedElements.length === 1 && isLinearElement12(newSelectedElements[0]) ? new LinearElementEditor11(
|
|
41893
41381
|
newSelectedElements[0],
|
|
41894
41382
|
this.scene.getNonDeletedElementsMap()
|
|
41895
41383
|
) : prevState.selectedLinearElement
|
|
@@ -41945,7 +41433,7 @@ var App = class _App extends React45.Component {
|
|
|
41945
41433
|
),
|
|
41946
41434
|
selectedLinearElement: isLinearElement12(hitElement) && // Don't set `selectedLinearElement` if its same as the hitElement, this is mainly to prevent resetting the `hoverPointIndex` to -1.
|
|
41947
41435
|
// Future we should update the API to take care of setting the correct `hoverPointIndex` when initialized
|
|
41948
|
-
prevState.selectedLinearElement?.elementId !== hitElement.id ? new
|
|
41436
|
+
prevState.selectedLinearElement?.elementId !== hitElement.id ? new LinearElementEditor11(
|
|
41949
41437
|
hitElement,
|
|
41950
41438
|
this.scene.getNonDeletedElementsMap()
|
|
41951
41439
|
) : prevState.selectedLinearElement
|
|
@@ -41960,7 +41448,7 @@ var App = class _App extends React45.Component {
|
|
|
41960
41448
|
!this.state.isResizing && // only hitting the bounding box of the previous hit element
|
|
41961
41449
|
(hitElement && hitElementBoundingBoxOnly(
|
|
41962
41450
|
{
|
|
41963
|
-
point:
|
|
41451
|
+
point: pointFrom29(
|
|
41964
41452
|
pointerDownState.origin.x,
|
|
41965
41453
|
pointerDownState.origin.y
|
|
41966
41454
|
),
|
|
@@ -41985,16 +41473,16 @@ var App = class _App extends React45.Component {
|
|
|
41985
41473
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.AUTO);
|
|
41986
41474
|
return;
|
|
41987
41475
|
}
|
|
41988
|
-
if (!activeTool.locked && activeTool.type !== "freedraw" &&
|
|
41476
|
+
if (!activeTool.locked && activeTool.type !== "freedraw" && newElement5) {
|
|
41989
41477
|
this.setState((prevState) => ({
|
|
41990
41478
|
selectedElementIds: makeNextSelectedElementIds2(
|
|
41991
41479
|
{
|
|
41992
41480
|
...prevState.selectedElementIds,
|
|
41993
|
-
[
|
|
41481
|
+
[newElement5.id]: true
|
|
41994
41482
|
},
|
|
41995
41483
|
prevState
|
|
41996
41484
|
),
|
|
41997
|
-
showHyperlinkPopup: isEmbeddableElement4(
|
|
41485
|
+
showHyperlinkPopup: isEmbeddableElement4(newElement5) && !newElement5.link ? "editor" : prevState.showHyperlinkPopup
|
|
41998
41486
|
}));
|
|
41999
41487
|
}
|
|
42000
41488
|
if (activeTool.type !== "selection" || isSomeElementSelected(this.scene.getNonDeletedElements(), this.state) || !isShallowEqual9(
|
|
@@ -42004,7 +41492,7 @@ var App = class _App extends React45.Component {
|
|
|
42004
41492
|
this.store.scheduleCapture();
|
|
42005
41493
|
}
|
|
42006
41494
|
if (pointerDownState.drag.hasOccurred && !this.state.selectedLinearElement || isResizing || isRotating || isCropping) {
|
|
42007
|
-
const linearElements = this.scene.getSelectedElements(this.state).filter(
|
|
41495
|
+
const linearElements = this.scene.getSelectedElements(this.state).filter(isArrowElement13);
|
|
42008
41496
|
bindOrUnbindBindingElements2(linearElements, this.scene, this.state);
|
|
42009
41497
|
}
|
|
42010
41498
|
if (activeTool.type === "laser") {
|
|
@@ -42101,7 +41589,7 @@ var App = class _App extends React45.Component {
|
|
|
42101
41589
|
}
|
|
42102
41590
|
};
|
|
42103
41591
|
var createTestHook = () => {
|
|
42104
|
-
if (isTestEnv5() ||
|
|
41592
|
+
if (isTestEnv5() || isDevEnv9()) {
|
|
42105
41593
|
window.h = window.h || {};
|
|
42106
41594
|
Object.defineProperties(window.h, {
|
|
42107
41595
|
elements: {
|
|
@@ -42111,7 +41599,7 @@ var createTestHook = () => {
|
|
|
42111
41599
|
},
|
|
42112
41600
|
set(elements) {
|
|
42113
41601
|
return this.app?.scene.replaceAllElements(
|
|
42114
|
-
|
|
41602
|
+
syncInvalidIndices(elements)
|
|
42115
41603
|
);
|
|
42116
41604
|
}
|
|
42117
41605
|
},
|
|
@@ -42470,10 +41958,10 @@ import { isInvisiblySmallElement as isInvisiblySmallElement4 } from "@excalidraw
|
|
|
42470
41958
|
|
|
42471
41959
|
// data/reconcile.ts
|
|
42472
41960
|
import throttle4 from "lodash.throttle";
|
|
42473
|
-
import { arrayToMap as
|
|
41961
|
+
import { arrayToMap as arrayToMap27, isDevEnv as isDevEnv10, isTestEnv as isTestEnv6 } from "@excalidraw/common";
|
|
42474
41962
|
import {
|
|
42475
41963
|
orderByFractionalIndex as orderByFractionalIndex2,
|
|
42476
|
-
syncInvalidIndices as
|
|
41964
|
+
syncInvalidIndices as syncInvalidIndices2,
|
|
42477
41965
|
validateFractionalIndices
|
|
42478
41966
|
} from "@excalidraw/element";
|
|
42479
41967
|
var shouldDiscardRemoteElement = (localAppState, local, remote) => {
|
|
@@ -42481,20 +41969,20 @@ var shouldDiscardRemoteElement = (localAppState, local, remote) => {
|
|
|
42481
41969
|
(local.id === localAppState.editingTextElement?.id || local.id === localAppState.resizingElement?.id || local.id === localAppState.newElement?.id || // local element is newer
|
|
42482
41970
|
local.version > remote.version || // resolve conflicting edits deterministically by taking the one with
|
|
42483
41971
|
// the lowest versionNonce
|
|
42484
|
-
local.version === remote.version && local.versionNonce
|
|
41972
|
+
local.version === remote.version && local.versionNonce <= remote.versionNonce)) {
|
|
42485
41973
|
return true;
|
|
42486
41974
|
}
|
|
42487
41975
|
return false;
|
|
42488
41976
|
};
|
|
42489
41977
|
var validateIndicesThrottled = throttle4(
|
|
42490
41978
|
(orderedElements, localElements, remoteElements) => {
|
|
42491
|
-
if (
|
|
42492
|
-
const elements =
|
|
41979
|
+
if (isDevEnv10() || isTestEnv6() || window?.DEBUG_FRACTIONAL_INDICES) {
|
|
41980
|
+
const elements = syncInvalidIndices2(
|
|
42493
41981
|
orderedElements.map((x) => ({ ...x }))
|
|
42494
41982
|
);
|
|
42495
41983
|
validateFractionalIndices(elements, {
|
|
42496
41984
|
// throw in dev & test only, to remain functional on `DEBUG_FRACTIONAL_INDICES`
|
|
42497
|
-
shouldThrow: isTestEnv6() ||
|
|
41985
|
+
shouldThrow: isTestEnv6() || isDevEnv10(),
|
|
42498
41986
|
includeBoundTextValidation: true,
|
|
42499
41987
|
reconciliationContext: {
|
|
42500
41988
|
localElements,
|
|
@@ -42507,7 +41995,7 @@ var validateIndicesThrottled = throttle4(
|
|
|
42507
41995
|
{ leading: true, trailing: false }
|
|
42508
41996
|
);
|
|
42509
41997
|
var reconcileElements = (localElements, remoteElements, localAppState) => {
|
|
42510
|
-
const localElementsMap =
|
|
41998
|
+
const localElementsMap = arrayToMap27(localElements);
|
|
42511
41999
|
const reconciledElements = [];
|
|
42512
42000
|
const added = /* @__PURE__ */ new Set();
|
|
42513
42001
|
for (const remoteElement of remoteElements) {
|
|
@@ -42535,16 +42023,15 @@ var reconcileElements = (localElements, remoteElements, localAppState) => {
|
|
|
42535
42023
|
}
|
|
42536
42024
|
const orderedElements = orderByFractionalIndex2(reconciledElements);
|
|
42537
42025
|
validateIndicesThrottled(orderedElements, localElements, remoteElements);
|
|
42538
|
-
|
|
42026
|
+
syncInvalidIndices2(orderedElements);
|
|
42539
42027
|
return orderedElements;
|
|
42540
42028
|
};
|
|
42541
42029
|
|
|
42542
42030
|
// index.tsx
|
|
42543
|
-
import { getFreeDrawSvgPath as getFreeDrawSvgPath2 } from "@excalidraw/element";
|
|
42544
42031
|
import { isLinearElement as isLinearElement13 } from "@excalidraw/element";
|
|
42545
42032
|
import {
|
|
42546
42033
|
FONT_FAMILY as FONT_FAMILY5,
|
|
42547
|
-
THEME as
|
|
42034
|
+
THEME as THEME18,
|
|
42548
42035
|
MIME_TYPES as MIME_TYPES10,
|
|
42549
42036
|
ROUNDNESS as ROUNDNESS3,
|
|
42550
42037
|
DEFAULT_LASER_COLOR as DEFAULT_LASER_COLOR2,
|
|
@@ -42588,7 +42075,11 @@ var TTDDialogTrigger = ({
|
|
|
42588
42075
|
TTDDialogTrigger.displayName = "TTDDialogTrigger";
|
|
42589
42076
|
|
|
42590
42077
|
// index.tsx
|
|
42591
|
-
import {
|
|
42078
|
+
import {
|
|
42079
|
+
getCommonBounds as getCommonBounds12,
|
|
42080
|
+
getVisibleSceneBounds as getVisibleSceneBounds2,
|
|
42081
|
+
convertToExcalidrawElements
|
|
42082
|
+
} from "@excalidraw/element";
|
|
42592
42083
|
|
|
42593
42084
|
// components/DiagramToCodePlugin/DiagramToCodePlugin.tsx
|
|
42594
42085
|
import { useLayoutEffect as useLayoutEffect9 } from "react";
|
|
@@ -42772,7 +42263,7 @@ export {
|
|
|
42772
42263
|
ROUNDNESS3 as ROUNDNESS,
|
|
42773
42264
|
Sidebar,
|
|
42774
42265
|
Stats,
|
|
42775
|
-
|
|
42266
|
+
THEME18 as THEME,
|
|
42776
42267
|
TTDDialog,
|
|
42777
42268
|
TTDDialogTrigger,
|
|
42778
42269
|
UserIdleState2 as UserIdleState,
|
|
@@ -42786,10 +42277,9 @@ export {
|
|
|
42786
42277
|
exportToCanvas2 as exportToCanvas,
|
|
42787
42278
|
exportToClipboard,
|
|
42788
42279
|
exportToSvg2 as exportToSvg,
|
|
42789
|
-
|
|
42280
|
+
getCommonBounds12 as getCommonBounds,
|
|
42790
42281
|
getDataURL,
|
|
42791
42282
|
getFormFactor2 as getFormFactor,
|
|
42792
|
-
getFreeDrawSvgPath2 as getFreeDrawSvgPath,
|
|
42793
42283
|
getLibraryItemsHash,
|
|
42794
42284
|
getNonDeletedElements13 as getNonDeletedElements,
|
|
42795
42285
|
getSceneVersion,
|
|
@@ -42811,7 +42301,6 @@ export {
|
|
|
42811
42301
|
normalizeLink4 as normalizeLink,
|
|
42812
42302
|
parseLibraryTokensFromUrl,
|
|
42813
42303
|
reconcileElements,
|
|
42814
|
-
restore,
|
|
42815
42304
|
restoreAppState,
|
|
42816
42305
|
restoreElement,
|
|
42817
42306
|
restoreElements,
|