fl-web-component 2.0.16 → 2.0.17

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.
@@ -1 +1 @@
1
- @charset "UTF-8";.fl-model-containor[data-v-3e15de76]{width:100%;height:100%;position:relative;cursor:pointer}[data-v-3e15de76] .tips-label{width:60px;color:#000;font:12px Helvetica;margin-top:-3em;padding:5px;text-align:center;vertical-align:middle;background-color:khaki}[data-v-3e15de76] .measure-label{max-width:100px;margin-top:-1em;border:10px;border-radius:5px;padding:3px 10px;cursor:pointer;color:#009bea;background-color:#f4f4f4;-webkit-box-shadow:0 1px 3px 1px rgba(0,0,0,.25);box-shadow:0 1px 3px 1px rgba(0,0,0,.25)}[data-v-3e15de76] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-3e15de76] .measure-label-font{word-break:break-all}[data-v-3e15de76] .mark-label-img{padding-top:5px;width:20px;height:20px}.loading-overlay[data-v-3e15de76]{position:absolute;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.7);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:1000;opacity:0;visibility:hidden;-webkit-transition:opacity .3s ease,visibility .3s ease;transition:opacity .3s ease,visibility .3s ease}.loading-overlay--visible[data-v-3e15de76]{opacity:1;visibility:visible}.loading-content[data-v-3e15de76]{background:#fff;border-radius:12px;padding:30px;text-align:center;-webkit-box-shadow:0 8px 32px rgba(0,0,0,.3);box-shadow:0 8px 32px rgba(0,0,0,.3);min-width:300px;max-width:400px}.loading-spinner[data-v-3e15de76]{width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #409eff;border-radius:50%;-webkit-animation:spin-3e15de76 1s linear infinite;animation:spin-3e15de76 1s linear infinite;margin:0 auto 20px}@-webkit-keyframes spin-3e15de76{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin-3e15de76{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.loading-text[data-v-3e15de76]{font-size:16px;font-weight:500;color:#333;margin-bottom:20px}.loading-this.progress-bar[data-v-3e15de76]{width:100%;height:8px;background-color:#f0f0f0;border-radius:4px;overflow:hidden;margin-bottom:15px}.loading-this.progress-fill[data-v-3e15de76]{height:100%;background:-webkit-gradient(linear,left top,right top,from(#409eff),to(#67c23a));background:linear-gradient(90deg,#409eff,#67c23a);border-radius:4px;-webkit-transition:width .3s ease;transition:width .3s ease}.loading-details[data-v-3e15de76]{font-size:12px;color:#666;line-height:1.5}.lil-this.gui{background:hsla(0,0%,100%,.95)!important;border:1px solid #e0e0e0!important;border-radius:8px!important;-webkit-box-shadow:0 4px 12px rgba(0,0,0,.15)!important;box-shadow:0 4px 12px rgba(0,0,0,.15)!important;backdrop-filter:blur(10px)!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important}.lil-this.gui .title{background:linear-gradient(135deg,#f8f9fa,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important;font-weight:600!important;padding:0 12px!important;border-radius:8px 8px 0 0!important}.lil-this.gui .controller{border-bottom:1px solid #f1f3f4!important;background:transparent!important}.lil-this.gui .controller:last-child{border-bottom:none!important}.lil-this.gui .controller .name{color:#495057!important;font-weight:500!important;font-size:12px!important}.lil-this.gui .controller .widget{background:#f8f9fa!important;border:1px solid #ced4da!important;border-radius:4px!important;color:#495057!important}.lil-this.gui .controller .widget:focus,.lil-this.gui .controller .widget:hover{border-color:#80bdff!important;-webkit-box-shadow:0 0 0 2px rgba(0,123,255,.25)!important;box-shadow:0 0 0 2px rgba(0,123,255,.25)!important}.lil-this.gui .controller .widget:focus{outline:none!important}.lil-this.gui .controller input[type=range]{background:#e9ecef!important;height:4px!important;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border-radius:2px!important}.lil-this.gui .controller.number .fill{border-right:solid #008de9}.lil-this.gui .controller input[type=range]::-webkit-slider-thumb{background:#007bff!important;border:2px solid #fff!important;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.2)!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;-webkit-appearance:none!important;appearance:none!important;cursor:pointer!important}.lil-this.gui .controller input[type=range]::-moz-range-thumb{background:#007bff!important;border:2px solid #fff!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;cursor:pointer!important}.lil-this.gui .controller .option{background:#fff!important;color:#495057!important;border-bottom:1px solid #f1f3f4!important}.lil-this.gui .controller .option:hover{background:#f8f9fa!important}.lil-this.gui .controller .option:last-child{border-bottom:none!important}.lil-this.gui input:active{background:#e6eff4}.lil-this.gui .controller button{background:linear-gradient(135deg,#007bff,#0056b3)!important;color:#fff!important;border:none!important;border-radius:4px!important;font-weight:500!important;-webkit-transition:all .2s ease!important;transition:all .2s ease!important}.lil-this.gui .controller button:hover{background:linear-gradient(135deg,#0056b3,#004085)!important;-webkit-transform:translateY(-1px)!important;transform:translateY(-1px)!important;-webkit-box-shadow:0 4px 8px rgba(0,123,255,.3)!important;box-shadow:0 4px 8px rgba(0,123,255,.3)!important}.lil-this.gui .controller .color{border:2px solid #fff!important;border-radius:4px!important;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.1)!important;box-shadow:0 2px 4px rgba(0,0,0,.1)!important}.lil-this.gui .controller.number .slider,.lil-this.gui .controller.number .slider:hover{background-color:#e6eff4}.lil-this.gui input,.lil-this.gui input:hover,.lil-this.gui input[type=number]:focus,.lil-this.gui input[type=text]:focus{background:#e6eff4}.lil-this.gui .controller>.name{min-width:25px}.lil-this.gui .controller.number input{color:#2e3136}.lil-this.gui .controller.number .slider:active{background-color:#e6eff4}.lil-this.gui .folder>.title{background:linear-gradient(135deg,#f1f3f4,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important}.lil-this.gui .folder>.title:before{color:#6c757d!important}.lil-this.gui .folder.closed>.children{display:none!important}#konva-container[data-v-b313ab6c]{z-index:3;width:100%;height:100%;cursor:pointer;overflow:hidden}span[data-v-f547d5c6]{font-weight:bolder}.text[data-v-f547d5c6]{margin-top:20px}.line[data-v-f547d5c6]{border-bottom:1px solid #dcdfe6;margin:20px 0}.center[data-v-f547d5c6]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.center .cen span[data-v-f547d5c6],.center .top span[data-v-f547d5c6]{color:"#53a8ff";display:inline-block;width:30px;height:30px;text-align:center;line-height:30px;border:1px solid;padding:5px;margin-bottom:10px;background-color:#e9f3ff}.center .cen span[data-v-f547d5c6]{margin:10px}.button[data-v-f547d5c6]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:end;margin-top:20px}@font-face{font-family:iconfont;src:url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff2?t=1646635700216) format("woff2"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff?t=1646635700216) format("woff"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.ttf?t=1646635700216) format("truetype")}.iconfont[data-v-f547d5c6]{font-family:iconfont!important;font-size:50px;font-style:normal;color:"#53a8ff";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-shubiao[data-v-f547d5c6]:before{content:""}.main_body[data-v-4b17bce0]{position:relative;width:100%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.classification_title[data-v-4b17bce0]{margin:0 0 10px 0;color:#fff;font-size:14px;cursor:default}.toolbar[data-v-4b17bce0]{z-index:10;position:absolute;width:520px;padding:8px 16px;border-radius:6px;-webkit-box-shadow:0 2px 10px 0 rgba(6,29,44,.25);box-shadow:0 2px 10px 0 rgba(6,29,44,.25);background-color:#fff;top:10px;left:50%;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transform:translateX(-50%);transform:translateX(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around}.icon_toolbar[data-v-4b17bce0],.text_toolbar[data-v-4b17bce0]{float:left;width:32px;height:32px;padding:0!important;background-repeat:no-repeat;background-size:24px;background-position:50%}.icon_active[data-v-4b17bce0],.icon_toolbar[data-v-4b17bce0]:hover,.text_toolbar[data-v-4b17bce0]:hover{background-color:#eee}[data-v-4b17bce0].icon_color .el-color-picker__trigger{height:24px;margin-top:4px;width:24px!important}[data-v-4b17bce0].el-color-picker--medium,[data-v-4b17bce0].el-color-picker--medium .el-color-picker__trigger{width:24px!important;height:24px!important}.canvas_container[data-v-4b17bce0]{position:relative;width:100%;height:100%;overflow:auto;-webkit-box-sizing:border-box;box-sizing:border-box}.canvas_container canvas[data-v-4b17bce0]{position:absolute;left:0}.canvas_container #ctx_front[data-v-4b17bce0]{z-index:5;background-color:transparent}.canvas_container #ctx_back[data-v-4b17bce0]{z-index:3}.canvas_container #ctx_base[data-v-4b17bce0]{z-index:1}#text[data-v-4b17bce0]{position:absolute;z-index:-1;resize:none;outline:none;border:1px dashed #9c9c9c;overflow:hidden;background:transparent;line-height:30px;display:none}#text[data-v-4b17bce0]:hover{border:1px dashed #53a8ff}#svg-component[data-v-2572c0e2],#svg-tigger[data-v-2572c0e2]{cursor:pointer;height:100%;width:100%;position:relative}#toolbar-show[data-v-2572c0e2]{z-index:20;position:absolute;width:100%;height:100%;top:0;left:0;overflow:hidden;background:#fff}
1
+ @charset "UTF-8";.fl-model-containor[data-v-48280acc]{width:100%;height:100%;position:relative;cursor:pointer}[data-v-48280acc] .tips-label{width:60px;color:#000;font:12px Helvetica;margin-top:-3em;padding:5px;text-align:center;vertical-align:middle;background-color:khaki}[data-v-48280acc] .measure-label{max-width:100px;margin-top:-1em;border:10px;border-radius:5px;padding:3px 10px;cursor:pointer;color:#009bea;background-color:#f4f4f4;-webkit-box-shadow:0 1px 3px 1px rgba(0,0,0,.25);box-shadow:0 1px 3px 1px rgba(0,0,0,.25)}[data-v-48280acc] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-48280acc] .measure-label-font{word-break:break-all}[data-v-48280acc] .mark-label-img{padding-top:5px;width:20px;height:20px}.loading-overlay[data-v-48280acc]{position:absolute;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.7);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:1000;opacity:0;visibility:hidden;-webkit-transition:opacity .3s ease,visibility .3s ease;transition:opacity .3s ease,visibility .3s ease}.loading-overlay--visible[data-v-48280acc]{opacity:1;visibility:visible}.loading-content[data-v-48280acc]{background:#fff;border-radius:12px;padding:30px;text-align:center;-webkit-box-shadow:0 8px 32px rgba(0,0,0,.3);box-shadow:0 8px 32px rgba(0,0,0,.3);min-width:300px;max-width:400px}.loading-spinner[data-v-48280acc]{width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #409eff;border-radius:50%;-webkit-animation:spin-48280acc 1s linear infinite;animation:spin-48280acc 1s linear infinite;margin:0 auto 20px}@-webkit-keyframes spin-48280acc{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin-48280acc{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.loading-text[data-v-48280acc]{font-size:16px;font-weight:500;color:#333;margin-bottom:20px}.loading-this.progress-bar[data-v-48280acc]{width:100%;height:8px;background-color:#f0f0f0;border-radius:4px;overflow:hidden;margin-bottom:15px}.loading-this.progress-fill[data-v-48280acc]{height:100%;background:-webkit-gradient(linear,left top,right top,from(#409eff),to(#67c23a));background:linear-gradient(90deg,#409eff,#67c23a);border-radius:4px;-webkit-transition:width .3s ease;transition:width .3s ease}.loading-details[data-v-48280acc]{font-size:12px;color:#666;line-height:1.5}.lil-this.gui{background:hsla(0,0%,100%,.95)!important;border:1px solid #e0e0e0!important;border-radius:8px!important;-webkit-box-shadow:0 4px 12px rgba(0,0,0,.15)!important;box-shadow:0 4px 12px rgba(0,0,0,.15)!important;backdrop-filter:blur(10px)!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important}.lil-this.gui .title{background:linear-gradient(135deg,#f8f9fa,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important;font-weight:600!important;padding:0 12px!important;border-radius:8px 8px 0 0!important}.lil-this.gui .controller{border-bottom:1px solid #f1f3f4!important;background:transparent!important}.lil-this.gui .controller:last-child{border-bottom:none!important}.lil-this.gui .controller .name{color:#495057!important;font-weight:500!important;font-size:12px!important}.lil-this.gui .controller .widget{background:#f8f9fa!important;border:1px solid #ced4da!important;border-radius:4px!important;color:#495057!important}.lil-this.gui .controller .widget:focus,.lil-this.gui .controller .widget:hover{border-color:#80bdff!important;-webkit-box-shadow:0 0 0 2px rgba(0,123,255,.25)!important;box-shadow:0 0 0 2px rgba(0,123,255,.25)!important}.lil-this.gui .controller .widget:focus{outline:none!important}.lil-this.gui .controller input[type=range]{background:#e9ecef!important;height:4px!important;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border-radius:2px!important}.lil-this.gui .controller.number .fill{border-right:solid #008de9}.lil-this.gui .controller input[type=range]::-webkit-slider-thumb{background:#007bff!important;border:2px solid #fff!important;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.2)!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;-webkit-appearance:none!important;appearance:none!important;cursor:pointer!important}.lil-this.gui .controller input[type=range]::-moz-range-thumb{background:#007bff!important;border:2px solid #fff!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;cursor:pointer!important}.lil-this.gui .controller .option{background:#fff!important;color:#495057!important;border-bottom:1px solid #f1f3f4!important}.lil-this.gui .controller .option:hover{background:#f8f9fa!important}.lil-this.gui .controller .option:last-child{border-bottom:none!important}.lil-this.gui input:active{background:#e6eff4}.lil-this.gui .controller button{background:linear-gradient(135deg,#007bff,#0056b3)!important;color:#fff!important;border:none!important;border-radius:4px!important;font-weight:500!important;-webkit-transition:all .2s ease!important;transition:all .2s ease!important}.lil-this.gui .controller button:hover{background:linear-gradient(135deg,#0056b3,#004085)!important;-webkit-transform:translateY(-1px)!important;transform:translateY(-1px)!important;-webkit-box-shadow:0 4px 8px rgba(0,123,255,.3)!important;box-shadow:0 4px 8px rgba(0,123,255,.3)!important}.lil-this.gui .controller .color{border:2px solid #fff!important;border-radius:4px!important;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.1)!important;box-shadow:0 2px 4px rgba(0,0,0,.1)!important}.lil-this.gui .controller.number .slider,.lil-this.gui .controller.number .slider:hover{background-color:#e6eff4}.lil-this.gui input,.lil-this.gui input:hover,.lil-this.gui input[type=number]:focus,.lil-this.gui input[type=text]:focus{background:#e6eff4}.lil-this.gui .controller>.name{min-width:25px}.lil-this.gui .controller.number input{color:#2e3136}.lil-this.gui .controller.number .slider:active{background-color:#e6eff4}.lil-this.gui .folder>.title{background:linear-gradient(135deg,#f1f3f4,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important}.lil-this.gui .folder>.title:before{color:#6c757d!important}.lil-this.gui .folder.closed>.children{display:none!important}#konva-container[data-v-b313ab6c]{z-index:3;width:100%;height:100%;cursor:pointer;overflow:hidden}span[data-v-f547d5c6]{font-weight:bolder}.text[data-v-f547d5c6]{margin-top:20px}.line[data-v-f547d5c6]{border-bottom:1px solid #dcdfe6;margin:20px 0}.center[data-v-f547d5c6]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.center .cen span[data-v-f547d5c6],.center .top span[data-v-f547d5c6]{color:"#53a8ff";display:inline-block;width:30px;height:30px;text-align:center;line-height:30px;border:1px solid;padding:5px;margin-bottom:10px;background-color:#e9f3ff}.center .cen span[data-v-f547d5c6]{margin:10px}.button[data-v-f547d5c6]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:end;margin-top:20px}@font-face{font-family:iconfont;src:url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff2?t=1646635700216) format("woff2"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff?t=1646635700216) format("woff"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.ttf?t=1646635700216) format("truetype")}.iconfont[data-v-f547d5c6]{font-family:iconfont!important;font-size:50px;font-style:normal;color:"#53a8ff";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-shubiao[data-v-f547d5c6]:before{content:""}.main_body[data-v-4b17bce0]{position:relative;width:100%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.classification_title[data-v-4b17bce0]{margin:0 0 10px 0;color:#fff;font-size:14px;cursor:default}.toolbar[data-v-4b17bce0]{z-index:10;position:absolute;width:520px;padding:8px 16px;border-radius:6px;-webkit-box-shadow:0 2px 10px 0 rgba(6,29,44,.25);box-shadow:0 2px 10px 0 rgba(6,29,44,.25);background-color:#fff;top:10px;left:50%;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transform:translateX(-50%);transform:translateX(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around}.icon_toolbar[data-v-4b17bce0],.text_toolbar[data-v-4b17bce0]{float:left;width:32px;height:32px;padding:0!important;background-repeat:no-repeat;background-size:24px;background-position:50%}.icon_active[data-v-4b17bce0],.icon_toolbar[data-v-4b17bce0]:hover,.text_toolbar[data-v-4b17bce0]:hover{background-color:#eee}[data-v-4b17bce0].icon_color .el-color-picker__trigger{height:24px;margin-top:4px;width:24px!important}[data-v-4b17bce0].el-color-picker--medium,[data-v-4b17bce0].el-color-picker--medium .el-color-picker__trigger{width:24px!important;height:24px!important}.canvas_container[data-v-4b17bce0]{position:relative;width:100%;height:100%;overflow:auto;-webkit-box-sizing:border-box;box-sizing:border-box}.canvas_container canvas[data-v-4b17bce0]{position:absolute;left:0}.canvas_container #ctx_front[data-v-4b17bce0]{z-index:5;background-color:transparent}.canvas_container #ctx_back[data-v-4b17bce0]{z-index:3}.canvas_container #ctx_base[data-v-4b17bce0]{z-index:1}#text[data-v-4b17bce0]{position:absolute;z-index:-1;resize:none;outline:none;border:1px dashed #9c9c9c;overflow:hidden;background:transparent;line-height:30px;display:none}#text[data-v-4b17bce0]:hover{border:1px dashed #53a8ff}#svg-component[data-v-2572c0e2],#svg-tigger[data-v-2572c0e2]{cursor:pointer;height:100%;width:100%;position:relative}#toolbar-show[data-v-2572c0e2]{z-index:20;position:absolute;width:100%;height:100%;top:0;left:0;overflow:hidden;background:#fff}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fl-web-component",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "scripts": {
5
5
  "postinstall": "patch-package",
6
6
  "tip1": "仅调试本组件不涉及业务组件,请执行dev",
@@ -5672,6 +5672,12 @@ export default {
5672
5672
  /*
5673
5673
  参数: type: '', distance、area、angle、height, 暂时只提供距离、面积、角度、高度这四种方式
5674
5674
  */
5675
+ getMeasurePickRoots() {
5676
+ if (this.modelGroup && this.modelGroup.children && this.modelGroup.children.length > 0) {
5677
+ return [this.modelGroup];
5678
+ }
5679
+ return this.scene && this.scene.children ? this.scene.children : [];
5680
+ },
5675
5681
  openMeasure(type, isClear = false) {
5676
5682
  if (this.threeMeasure) {
5677
5683
  this.threeMeasure.close(isClear);
@@ -5686,7 +5692,10 @@ export default {
5686
5692
  this.scene,
5687
5693
  this.camera,
5688
5694
  this.instructions.offsetWidth,
5689
- this.instructions.offsetHeight
5695
+ this.instructions.offsetHeight,
5696
+ {
5697
+ pickRoots: () => this.getMeasurePickRoots(),
5698
+ }
5690
5699
  );
5691
5700
  this.threeMeasure.start();
5692
5701
  break;
@@ -5696,7 +5705,10 @@ export default {
5696
5705
  this.scene,
5697
5706
  this.camera,
5698
5707
  this.instructions.offsetWidth,
5699
- this.instructions.offsetHeight
5708
+ this.instructions.offsetHeight,
5709
+ {
5710
+ pickRoots: () => this.getMeasurePickRoots(),
5711
+ }
5700
5712
  );
5701
5713
  this.threeMeasure.start();
5702
5714
  break;
@@ -5706,7 +5718,10 @@ export default {
5706
5718
  this.scene,
5707
5719
  this.camera,
5708
5720
  this.instructions.offsetWidth,
5709
- this.instructions.offsetHeight
5721
+ this.instructions.offsetHeight,
5722
+ {
5723
+ pickRoots: () => this.getMeasurePickRoots(),
5724
+ }
5710
5725
  );
5711
5726
  this.threeMeasure.start();
5712
5727
  break;
@@ -5716,7 +5731,10 @@ export default {
5716
5731
  this.scene,
5717
5732
  this.camera,
5718
5733
  this.instructions.offsetWidth,
5719
- this.instructions.offsetHeight
5734
+ this.instructions.offsetHeight,
5735
+ {
5736
+ pickRoots: () => this.getMeasurePickRoots(),
5737
+ }
5720
5738
  );
5721
5739
  this.threeMeasure.start();
5722
5740
  break;
@@ -5735,19 +5753,52 @@ export default {
5735
5753
  // 移除键盘事件监听器
5736
5754
  document.removeEventListener('keydown', this.handleMeasureKeyDown, false);
5737
5755
  },
5738
- // 增加一个清除所有测量结果的方法 使用统一名字的
5739
- clearMeasureByName() {
5740
- let list = this.getObjectByName('measureObj');
5741
- list.forEach(item => {
5742
- if (item.geometry) {
5743
- item.geometry.dispose();
5744
- item.material.dispose();
5756
+ disposeMeasureObject(object) {
5757
+ if (!object) return;
5758
+ if (object.geometry) {
5759
+ object.geometry.dispose();
5760
+ }
5761
+ if (Array.isArray(object.material)) {
5762
+ object.material.forEach(material => {
5763
+ material && material.dispose && material.dispose();
5764
+ });
5765
+ } else if (object.material && object.material.dispose) {
5766
+ object.material.dispose();
5767
+ }
5768
+ if (object.element && object.element.parentNode) {
5769
+ object.element.parentNode.removeChild(object.element);
5770
+ }
5771
+ },
5772
+ isMeasureObject(object) {
5773
+ if (!object) return false;
5774
+ const userData = object.userData || {};
5775
+ return object.name === 'measureObj' || userData.isMeasureObject === true;
5776
+ },
5777
+ removeMeasureObjectsFromScene() {
5778
+ if (!this.scene) return;
5779
+ const measureObjects = [];
5780
+ this.scene.traverse(object => {
5781
+ if (this.isMeasureObject(object)) {
5782
+ measureObjects.push(object);
5745
5783
  }
5746
- if (this.scene) this.scene.remove(item);
5747
5784
  });
5785
+ measureObjects.forEach(object => {
5786
+ if (object.parent) {
5787
+ object.parent.remove(object);
5788
+ } else {
5789
+ this.scene.remove(object);
5790
+ }
5791
+ this.disposeMeasureObject(object);
5792
+ });
5793
+ },
5794
+ // 增加一个清除所有测量结果的方法,清理历史测量实例遗留的对象
5795
+ clearMeasureByName() {
5748
5796
  if (this.threeMeasure) {
5749
5797
  this.threeMeasure.clear();
5750
5798
  }
5799
+ this.removeMeasureObjectsFromScene();
5800
+ this.measureFlag = false;
5801
+ document.removeEventListener('keydown', this.handleMeasureKeyDown, false);
5751
5802
  },
5752
5803
  handleMeasureKeyDown(event) {
5753
5804
  // 检查是否按下了ESC键
@@ -2,10 +2,11 @@ import * as THREE from 'three';
2
2
  import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer';
3
3
  import { Message } from 'element-ui';
4
4
  var _this = null;
5
- var MeasureAngle = function (renderer, scene, camera, width, height) {
5
+ var MeasureAngle = function (renderer, scene, camera, width, height, options = {}) {
6
6
  this.renderer = renderer;
7
7
  this.scene = scene;
8
8
  this.camera = camera;
9
+ this.pickRoots = options.pickRoots || null;
9
10
  this.pointArray = []; // 保存当前操作所添加的点
10
11
  this.raycaster = new THREE.Raycaster();
11
12
  this.points = []; // 保存页面中所添加的点
@@ -17,6 +18,7 @@ var MeasureAngle = function (renderer, scene, camera, width, height) {
17
18
  this.tempLabel = undefined;
18
19
  this.tipsLabel = undefined;
19
20
  this.isCompleted = false;
21
+ this.hasTempPoint = false;
20
22
  this.curveLine = undefined;
21
23
  this.timer = null;
22
24
  this.width = width;
@@ -24,7 +26,7 @@ var MeasureAngle = function (renderer, scene, camera, width, height) {
24
26
  this.firstTime = 0;
25
27
  // 创建一个辅助平面来捕获鼠标事件
26
28
  this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
27
- this.measureName = 'measureObj'
29
+ this.measureName = 'measureObj';
28
30
  // this.POINT_MATERIAL = new THREE.PointsMaterial({ color: 0xff5000, size: 1, opacity: 0.6, transparent: true, depthWrite: false, depthTest: false })
29
31
  // this.LINE_MATERIAL = new THREE.LineBasicMaterial({ color: 0xff0000, linewidth: 3, opacity: 0.8, transparent: true, side: THREE.DoubleSide, depthWrite: false, depthTest: false })
30
32
  };
@@ -45,7 +47,107 @@ MeasureAngle.prototype = {
45
47
  this.width = width;
46
48
  this.height = height;
47
49
  },
48
- getPosition(e) {
50
+ getPickRoots() {
51
+ const roots = typeof _this.pickRoots === 'function' ? _this.pickRoots() : _this.pickRoots;
52
+ if (Array.isArray(roots) && roots.length > 0) {
53
+ return roots.filter(Boolean);
54
+ }
55
+ if (roots) {
56
+ return [roots];
57
+ }
58
+ return _this.scene && _this.scene.children ? _this.scene.children : [];
59
+ },
60
+ isExcludedIntersection(object) {
61
+ let current = object;
62
+ while (current) {
63
+ const userData = current.userData || {};
64
+ if (current.visible === false) return true;
65
+ if (current.name === _this.measureName || userData.isMeasureObject === true) return true;
66
+ if (userData.transformControlHelper === true || userData.outlineProxy === true) return true;
67
+ if (current.isCamera || current.isLight) return true;
68
+ if (
69
+ typeof current.type === 'string' &&
70
+ (/Helper$/i.test(current.type) ||
71
+ current.type === 'CSS2DObject' ||
72
+ current.type === 'TransformControlsRoot')
73
+ ) {
74
+ return true;
75
+ }
76
+ current = current.parent;
77
+ }
78
+ return false;
79
+ },
80
+ markMeasureObject(object) {
81
+ object.name = this.measureName;
82
+ if (!object.userData) {
83
+ object.userData = {};
84
+ }
85
+ object.userData.isMeasureObject = true;
86
+ return object;
87
+ },
88
+ disposeObject(object) {
89
+ if (!object) return;
90
+ if (object.geometry) {
91
+ object.geometry.dispose();
92
+ }
93
+ if (object.material) {
94
+ object.material.dispose();
95
+ }
96
+ this.scene.remove(object);
97
+ },
98
+ removeArrayItem(array, item) {
99
+ if (!item) return;
100
+ const index = array.indexOf(item);
101
+ if (index !== -1) {
102
+ array.splice(index, 1);
103
+ }
104
+ },
105
+ clearTempMeasure() {
106
+ if (this.hasTempPoint && this.pointArray.length > 0) {
107
+ this.pointArray.pop();
108
+ }
109
+ this.removeArrayItem(this.points, this.tempPoints);
110
+ this.removeArrayItem(this.polyline, this.tempLine);
111
+ this.disposeObject(this.tempPoints);
112
+ this.disposeObject(this.tempLine);
113
+ this.tempPoints = undefined;
114
+ this.tempLine = undefined;
115
+ this.hasTempPoint = false;
116
+ this.updateAngleMeasure();
117
+ },
118
+ updateAngleMeasure() {
119
+ if (this.pointArray.length !== 3) {
120
+ this.removeArrayItem(this.labels, this.tempLabel);
121
+ this.removeArrayItem(this.curves, this.curveLine);
122
+ this.disposeObject(this.tempLabel);
123
+ this.disposeObject(this.curveLine);
124
+ this.tempLabel = undefined;
125
+ this.curveLine = undefined;
126
+ return;
127
+ }
128
+ const angle = this.calculateAngle().toFixed(2) + '°';
129
+ const p0 = this.pointArray[0];
130
+ const p1 = this.pointArray[1];
131
+ const p2 = this.pointArray[2];
132
+ const v1 = new THREE.Vector3((p0.x + p1.x) / 2, (p0.y + p1.y) / 2, (p0.z + p1.z) / 2);
133
+ const v2 = new THREE.Vector3((p1.x + p2.x) / 2, (p1.y + p2.y) / 2, (p1.z + p2.z) / 2);
134
+ const curve = new THREE.CatmullRomCurve3([v1, v2]);
135
+ const points = curve.getPoints(50);
136
+ if (this.tempLabel) {
137
+ this.tempLabel.element.textContent = angle;
138
+ this.tempLabel.position.set(p1.x, p1.y, p1.z);
139
+ } else {
140
+ this.tempLabel = this.createLabel('measure-label', angle, p1);
141
+ this.labels.push(this.tempLabel);
142
+ this.scene.add(this.tempLabel);
143
+ }
144
+ if (this.curveLine) {
145
+ this.curveLine.geometry.setFromPoints(points);
146
+ } else {
147
+ this.createCurve(points);
148
+ }
149
+ },
150
+ getPosition(e, options = {}) {
49
151
  const mouse = new THREE.Vector2();
50
152
  const elRect = this.renderer.domElement.getBoundingClientRect();
51
153
  const canvasX = e.clientX - elRect.left;
@@ -55,11 +157,17 @@ MeasureAngle.prototype = {
55
157
  mouse.y = -(canvasY / elRect.height) * 2.0 + 1.0;
56
158
 
57
159
  _this.raycaster.setFromCamera(mouse, this.camera);
58
- let intersects = _this.raycaster.intersectObjects(_this.scene.children, true);
160
+ let intersects = _this.raycaster
161
+ .intersectObjects(_this.getPickRoots(), true)
162
+ .filter(item => item && item.object && !_this.isExcludedIntersection(item.object));
59
163
  if (intersects.length > 0) {
60
164
  return { point: intersects[0].point, isModel: true };
61
165
  }
62
166
 
167
+ if (options.allowPlaneFallback === false) {
168
+ return null;
169
+ }
170
+
63
171
  // 如果没有交点,构建一个基于最后一个确认点且面向相机的平面
64
172
  if (_this.pointArray && _this.pointArray.length > 0) {
65
173
  const lastPoint =
@@ -89,7 +197,7 @@ MeasureAngle.prototype = {
89
197
  const geom = new THREE.SphereGeometry(config.size || 0.3, 28, 28);
90
198
  const sphere = new THREE.Mesh(geom, mesh);
91
199
  sphere.frustumCulled = false;
92
- sphere.name = this.measureName
200
+ this.markMeasureObject(sphere);
93
201
  sphere.position.set(pos.x, pos.y, pos.z);
94
202
  return sphere;
95
203
  },
@@ -103,7 +211,7 @@ MeasureAngle.prototype = {
103
211
  });
104
212
  const lineGeometry = new THREE.BufferGeometry().setFromPoints([p1, p2]);
105
213
  const line = new THREE.Line(lineGeometry, lineMaterial);
106
- line.name = this.measureName;
214
+ this.markMeasureObject(line);
107
215
  line.renderOrder = 999;
108
216
  line.frustumCulled = false;
109
217
  return line;
@@ -113,18 +221,28 @@ MeasureAngle.prototype = {
113
221
  div.className = name;
114
222
  div.textContent = text;
115
223
  const divLabel = new CSS2DObject(div);
116
- divLabel.name = this.measureName
224
+ this.markMeasureObject(divLabel);
117
225
  divLabel.position.set(position.x, position.y, position.z);
118
226
  return divLabel;
119
227
  },
120
228
  mousemove(e) {
121
- if (_this.isCompleted || _this.pointArray.length === 0) return;
229
+ if (_this.isCompleted || _this.pointArray.length === 0) {
230
+ const positionResult = _this.getPosition(e);
231
+ if (positionResult && _this.tipsLabel) {
232
+ _this.updateTipsLabelPosition(positionResult.point);
233
+ }
234
+ return;
235
+ }
236
+ if (_this.pointArray.length >= 3 && !_this.hasTempPoint) return;
122
237
  const positionResult = _this.getPosition(e);
123
238
  if (positionResult) {
124
239
  const point = positionResult.point;
125
- _this.pointArray.length === 1
126
- ? _this.pointArray.push(point)
127
- : _this.pointArray.splice(_this.pointArray.length - 1, 1, point);
240
+ if (_this.hasTempPoint) {
241
+ _this.pointArray.splice(_this.pointArray.length - 1, 1, point);
242
+ } else {
243
+ _this.pointArray.push(point);
244
+ _this.hasTempPoint = true;
245
+ }
128
246
  const length = _this.pointArray.length;
129
247
  const p1 = _this.pointArray[length - 2];
130
248
  const p2 = _this.pointArray[length - 1];
@@ -143,38 +261,21 @@ MeasureAngle.prototype = {
143
261
  _this.polyline.push(_this.tempLine);
144
262
  _this.scene.add(_this.tempLine);
145
263
  }
146
- // 三点构成一个角
147
- if (_this.pointArray.length === 3) {
148
- const angle = _this.calculateAngle().toFixed(2) + '°';
149
- const p0 = _this.pointArray[0];
150
- const p1 = _this.pointArray[1];
151
- const p2 = _this.pointArray[2];
152
- const v1 = new THREE.Vector3((p0.x + p1.x) / 2, (p0.y + p1.y) / 2, (p0.z + p1.z) / 2);
153
- const v2 = new THREE.Vector3((p1.x + p2.x) / 2, (p1.y + p2.y) / 2, (p1.z + p2.z) / 2);
154
- const curve = new THREE.CatmullRomCurve3([v1, v2]);
155
- const points = curve.getPoints(50);
156
- if (_this.tempLabel) {
157
- _this.tempLabel.element.textContent = angle;
158
- _this.tempLabel.position.set(p1.x, p1.y, p1.z);
159
- _this.curveLine.geometry.setFromPoints(points);
160
- } else {
161
- _this.tempLabel = _this.createLabel('measure-label', angle, p1);
162
- _this.labels.push(_this.tempLabel);
163
- _this.scene.add(_this.tempLabel);
164
- _this.createCurve(points);
165
- }
166
- }
264
+ _this.updateAngleMeasure();
167
265
  if (_this.tipsLabel) {
168
- _this.tipsLabel.position.set(point.x + 0.1, point.y, point.z + 0.05);
266
+ _this.updateTipsLabelPosition(point);
169
267
  }
170
268
  }
171
269
  },
270
+ updateTipsLabelPosition(position) {
271
+ this.tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
272
+ },
172
273
  createTipsLabel(label, position) {
173
274
  const div = document.createElement('div');
174
275
  div.className = 'tips-label';
175
276
  div.textContent = label;
176
277
  const tipsLabel = new CSS2DObject(div);
177
- tipsLabel.name = this.measureName
278
+ this.markMeasureObject(tipsLabel);
178
279
  tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
179
280
  return tipsLabel;
180
281
  },
@@ -190,15 +291,22 @@ MeasureAngle.prototype = {
190
291
  clearTimeout(_this.timer);
191
292
  _this.timer = setTimeout(() => {
192
293
  _this.isCompleted = false;
193
- const positionResult = _this.getPosition(e);
294
+ const positionResult = _this.getPosition(e, { allowPlaneFallback: false });
295
+ if (!positionResult || !positionResult.isModel) {
296
+ _this.clearTempMeasure();
297
+ Message.warning('请点击模型进行测量');
298
+ return;
299
+ }
194
300
  if (positionResult) {
195
- const { point, isModel } = positionResult;
196
- if (!isModel) {
197
- Message.warning('请点击模型进行测量');
198
- return;
301
+ const { point } = positionResult;
302
+ if (_this.hasTempPoint && _this.pointArray.length > 0) {
303
+ _this.pointArray.splice(_this.pointArray.length - 1, 1, point);
304
+ } else {
305
+ _this.pointArray.push(point);
199
306
  }
307
+ _this.hasTempPoint = false;
200
308
  if (_this.tipsLabel) {
201
- _this.tipsLabel.position.set(point.x + 0.1, point.y, point.z + 0.05);
309
+ _this.updateTipsLabelPosition(point);
202
310
  } else {
203
311
  _this.tipsLabel = _this.createTipsLabel('左击绘制右击结束', point);
204
312
  _this.scene.add(_this.tipsLabel);
@@ -211,9 +319,27 @@ MeasureAngle.prototype = {
211
319
  _this.points.push(geom);
212
320
  _this.scene.add(geom);
213
321
  }
322
+ const length = _this.pointArray.length;
323
+ if (length > 1) {
324
+ const p1 = _this.pointArray[length - 2];
325
+ const p2 = _this.pointArray[length - 1];
326
+ if (_this.tempLine) {
327
+ _this.tempLine.geometry.setFromPoints([p1, p2]);
328
+ } else {
329
+ _this.tempLine = _this.createLine(p1, p2);
330
+ _this.polyline.push(_this.tempLine);
331
+ _this.scene.add(_this.tempLine);
332
+ }
333
+ }
334
+ _this.updateAngleMeasure();
335
+ if (_this.pointArray.length >= 3) {
336
+ _this.isCompleted = true;
337
+ _this.pointArray.splice(0);
338
+ _this.hasTempPoint = false;
339
+ _this.curveLine = undefined;
340
+ }
214
341
  _this.tempLine = undefined;
215
342
  _this.tempLabel = undefined;
216
- _this.pointArray.push(point);
217
343
  }
218
344
  });
219
345
  }
@@ -227,11 +353,13 @@ MeasureAngle.prototype = {
227
353
  clearTimeout(_this.timer);
228
354
  const positionResult = _this.getPosition(e);
229
355
  if (positionResult) {
356
+ _this.clearTempMeasure();
230
357
  _this.isCompleted = true;
231
358
  _this.tempPoints = undefined;
232
359
  _this.tempLine = undefined;
233
360
  _this.tempLabel = undefined;
234
361
  _this.pointArray.splice(0);
362
+ _this.hasTempPoint = false;
235
363
  _this.renderer.domElement.removeEventListener('mousemove', _this.mousemove);
236
364
  }
237
365
  },
@@ -253,6 +381,7 @@ MeasureAngle.prototype = {
253
381
  this.tempPoints = undefined;
254
382
  this.tempLabel = undefined;
255
383
  this.tempLine = undefined;
384
+ this.hasTempPoint = false;
256
385
  this.scene.remove(this.tipsLabel);
257
386
  this.tipsLabel = undefined;
258
387
  }
@@ -271,6 +400,7 @@ MeasureAngle.prototype = {
271
400
  this.tempPoints = undefined;
272
401
  this.tempLabel = undefined;
273
402
  this.tempLine = undefined;
403
+ this.hasTempPoint = false;
274
404
  this.scene.remove(this.tipsLabel);
275
405
  this.tipsLabel = undefined;
276
406
  },
@@ -301,6 +431,7 @@ MeasureAngle.prototype = {
301
431
  transparent: true,
302
432
  });
303
433
  _this.curveLine = new THREE.Line(geom, material);
434
+ _this.markMeasureObject(_this.curveLine);
304
435
  _this.curveLine.renderOrder = 999;
305
436
  _this.curveLine.frustumCulled = false;
306
437
  _this.curves.push(_this.curveLine);