fl-web-component 2.0.9 → 2.0.10
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/README.md +2 -0
- package/dist/fl-web-component.common.2.js +126 -48
- package/dist/fl-web-component.common.2.js.map +1 -1
- package/dist/fl-web-component.common.js +329 -188
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-graphics/index.vue +95 -16
- package/src/utils/threejs/measure-angle.js +22 -2
- package/src/utils/threejs/measure-area.js +23 -3
- package/src/utils/threejs/measure-distance.js +20 -1
- package/src/utils/threejs/measure-height.js +17 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.fl-model-containor[data-v-a7768a4e]{width:100%;height:100%;position:relative;cursor:pointer}[data-v-a7768a4e] .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-a7768a4e] .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-a7768a4e] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-a7768a4e] .measure-label-font{word-break:break-all}[data-v-a7768a4e] .mark-label-img{padding-top:5px;width:20px;height:20px}.loading-overlay[data-v-a7768a4e]{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-a7768a4e]{opacity:1;visibility:visible}.loading-content[data-v-a7768a4e]{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-a7768a4e]{width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #409eff;border-radius:50%;-webkit-animation:spin-a7768a4e 1s linear infinite;animation:spin-a7768a4e 1s linear infinite;margin:0 auto 20px}@-webkit-keyframes spin-a7768a4e{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin-a7768a4e{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.loading-text[data-v-a7768a4e]{font-size:16px;font-weight:500;color:#333;margin-bottom:20px}.loading-this.progress-bar[data-v-a7768a4e]{width:100%;height:8px;background-color:#f0f0f0;border-radius:4px;overflow:hidden;margin-bottom:15px}.loading-this.progress-fill[data-v-a7768a4e]{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-a7768a4e]{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-21bcf2d9]{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-482a990d]{width:100%;height:100%;position:relative;cursor:pointer}[data-v-482a990d] .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-482a990d] .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-482a990d] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-482a990d] .measure-label-font{word-break:break-all}[data-v-482a990d] .mark-label-img{padding-top:5px;width:20px;height:20px}.loading-overlay[data-v-482a990d]{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-482a990d]{opacity:1;visibility:visible}.loading-content[data-v-482a990d]{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-482a990d]{width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #409eff;border-radius:50%;-webkit-animation:spin-482a990d 1s linear infinite;animation:spin-482a990d 1s linear infinite;margin:0 auto 20px}@-webkit-keyframes spin-482a990d{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin-482a990d{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.loading-text[data-v-482a990d]{font-size:16px;font-weight:500;color:#333;margin-bottom:20px}.loading-this.progress-bar[data-v-482a990d]{width:100%;height:8px;background-color:#f0f0f0;border-radius:4px;overflow:hidden;margin-bottom:15px}.loading-this.progress-fill[data-v-482a990d]{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-482a990d]{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-21bcf2d9]{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
|
@@ -4126,7 +4126,9 @@ export default {
|
|
|
4126
4126
|
case 'color':
|
|
4127
4127
|
targetObj.forEach(children => {
|
|
4128
4128
|
if (children.isMesh) {
|
|
4129
|
-
const
|
|
4129
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4130
|
+
if (!instanceInfo) return;
|
|
4131
|
+
const { instanceIndex } = instanceInfo;
|
|
4130
4132
|
children.setColorAt(instanceIndex, new this.THREE.Color(ele.attr[key]));
|
|
4131
4133
|
children.instanceColor.needsUpdate = true;
|
|
4132
4134
|
if (!this.isCurrentVisible(instanceId, children)) {
|
|
@@ -4164,6 +4166,7 @@ export default {
|
|
|
4164
4166
|
}
|
|
4165
4167
|
targetObj.forEach(children => {
|
|
4166
4168
|
const instanceInfo = children.userData.instancesMap.get(instanceId);
|
|
4169
|
+
if (!instanceInfo) return;
|
|
4167
4170
|
const { instanceIndex, copyMatrix } = instanceInfo;
|
|
4168
4171
|
const nextVisible = requestedVisible && this.isSourceVisible(instanceId, children);
|
|
4169
4172
|
instanceInfo.visible = nextVisible;
|
|
@@ -4190,7 +4193,9 @@ export default {
|
|
|
4190
4193
|
targetObj.forEach(children => {
|
|
4191
4194
|
if (children.isMesh) {
|
|
4192
4195
|
const opacity = children.geometry.attributes.opacity.array;
|
|
4193
|
-
const
|
|
4196
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4197
|
+
if (!instanceInfo) return;
|
|
4198
|
+
const { instanceIndex } = instanceInfo;
|
|
4194
4199
|
opacity[instanceIndex] = ele.attr[key];
|
|
4195
4200
|
children.geometry.attributes.opacity.needsUpdate = true;
|
|
4196
4201
|
}
|
|
@@ -4260,7 +4265,9 @@ export default {
|
|
|
4260
4265
|
let targetObj = this.getObjectByName(instanceId);
|
|
4261
4266
|
targetObj.forEach(children => {
|
|
4262
4267
|
if (children.isMesh) {
|
|
4263
|
-
const
|
|
4268
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4269
|
+
if (!instanceInfo) return;
|
|
4270
|
+
const { instanceIndex } = instanceInfo;
|
|
4264
4271
|
if (!this.isSourceVisible(instanceId, children)) {
|
|
4265
4272
|
this.removeOutlineObject(children, instanceIndex);
|
|
4266
4273
|
return;
|
|
@@ -4284,7 +4291,9 @@ export default {
|
|
|
4284
4291
|
let targetObj = this.getObjectByName(instanceId);
|
|
4285
4292
|
targetObj.forEach(children => {
|
|
4286
4293
|
if (children.isMesh) {
|
|
4287
|
-
const
|
|
4294
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4295
|
+
if (!instanceInfo) return;
|
|
4296
|
+
const { instanceIndex } = instanceInfo;
|
|
4288
4297
|
this.removeOutlineObject(children, instanceIndex);
|
|
4289
4298
|
}
|
|
4290
4299
|
});
|
|
@@ -4337,7 +4346,9 @@ export default {
|
|
|
4337
4346
|
case 'nColor':
|
|
4338
4347
|
targetObj.forEach(children => {
|
|
4339
4348
|
if (children.isMesh) {
|
|
4340
|
-
const
|
|
4349
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4350
|
+
if (!instanceInfo) return;
|
|
4351
|
+
const { instanceIndex } = instanceInfo;
|
|
4341
4352
|
children.setColorAt(instanceIndex, children.material.userData['oColor']);
|
|
4342
4353
|
children.instanceColor.needsUpdate = true;
|
|
4343
4354
|
children.material.userData[key] = children.material.userData['oColor'];
|
|
@@ -4360,7 +4371,9 @@ export default {
|
|
|
4360
4371
|
case 'color':
|
|
4361
4372
|
obj.forEach(children => {
|
|
4362
4373
|
if (children.isMesh) {
|
|
4363
|
-
const
|
|
4374
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4375
|
+
if (!instanceInfo) return;
|
|
4376
|
+
const { instanceIndex } = instanceInfo;
|
|
4364
4377
|
children.setColorAt(instanceIndex, children.material.userData.nColor);
|
|
4365
4378
|
children.instanceColor.needsUpdate = true;
|
|
4366
4379
|
if (this.outlinePass) {
|
|
@@ -4377,6 +4390,7 @@ export default {
|
|
|
4377
4390
|
case 'visible': {
|
|
4378
4391
|
obj.forEach(children => {
|
|
4379
4392
|
const instanceInfo = children.userData.instancesMap.get(instanceId);
|
|
4393
|
+
if (!instanceInfo) return;
|
|
4380
4394
|
const { instanceIndex, copyMatrix } = instanceInfo;
|
|
4381
4395
|
if (this.isSourceVisible(instanceId, children)) {
|
|
4382
4396
|
instanceInfo.visible = true;
|
|
@@ -4397,7 +4411,9 @@ export default {
|
|
|
4397
4411
|
case 'opacity':
|
|
4398
4412
|
obj.forEach(children => {
|
|
4399
4413
|
if (children.isMesh) {
|
|
4400
|
-
const
|
|
4414
|
+
const instanceInfo = children.userData?.instancesMap?.get(instanceId);
|
|
4415
|
+
if (!instanceInfo) return;
|
|
4416
|
+
const { instanceIndex } = instanceInfo;
|
|
4401
4417
|
const opacity = children.geometry.attributes.opacity.array;
|
|
4402
4418
|
opacity[instanceIndex] = children.material.userData.nOpacity;
|
|
4403
4419
|
children.geometry.attributes.opacity.needsUpdate = true;
|
|
@@ -4590,11 +4606,31 @@ export default {
|
|
|
4590
4606
|
*/
|
|
4591
4607
|
getObjectByName(name, passType = 'group') {
|
|
4592
4608
|
if (!this.scene) return [];
|
|
4609
|
+
if (Array.isArray(name)) {
|
|
4610
|
+
const result = [];
|
|
4611
|
+
const exist = new Set();
|
|
4612
|
+
name.forEach(item => {
|
|
4613
|
+
this.getObjectByName(item, passType).forEach(obj => {
|
|
4614
|
+
if (!obj || exist.has(obj.uuid)) return;
|
|
4615
|
+
exist.add(obj.uuid);
|
|
4616
|
+
result.push(obj);
|
|
4617
|
+
});
|
|
4618
|
+
});
|
|
4619
|
+
return result;
|
|
4620
|
+
}
|
|
4593
4621
|
let object = [];
|
|
4622
|
+
const added = new Set();
|
|
4594
4623
|
const instancedMeshProps = instanceToInstancedMeshMap.get(name);
|
|
4595
4624
|
this.scene.traverse(item => {
|
|
4596
4625
|
const tempName = instancedMeshProps ? instancedMeshProps.drawObjectId : name;
|
|
4597
|
-
|
|
4626
|
+
const itemType = item.type ? item.type.toLowerCase() : '';
|
|
4627
|
+
const isPassType = itemType == passType.toLowerCase();
|
|
4628
|
+
const hasTargetInstance =
|
|
4629
|
+
item.userData &&
|
|
4630
|
+
item.userData.instancesMap instanceof Map &&
|
|
4631
|
+
item.userData.instancesMap.has(name);
|
|
4632
|
+
if (!isPassType && (item.name == tempName || hasTargetInstance) && !added.has(item.uuid)) {
|
|
4633
|
+
added.add(item.uuid);
|
|
4598
4634
|
object.push(item);
|
|
4599
4635
|
}
|
|
4600
4636
|
});
|
|
@@ -5315,10 +5351,38 @@ export default {
|
|
|
5315
5351
|
objClipp2 && (objClipp2[4].constant = -d);
|
|
5316
5352
|
});
|
|
5317
5353
|
},
|
|
5354
|
+
getFirstPersonMoveSpeed(customMoveSpeed) {
|
|
5355
|
+
const defaultMoveSpeed = 800;
|
|
5356
|
+
const minMoveSpeed = 300;
|
|
5357
|
+
const maxMoveSpeed = 2500;
|
|
5358
|
+
const optionMoveSpeed =
|
|
5359
|
+
Number.isFinite(customMoveSpeed) && customMoveSpeed > 0
|
|
5360
|
+
? customMoveSpeed
|
|
5361
|
+
: defaultMoveSpeed;
|
|
5362
|
+
let nextMoveSpeed = defaultMoveSpeed;
|
|
5363
|
+
|
|
5364
|
+
if (
|
|
5365
|
+
this.sceneBoundingBox &&
|
|
5366
|
+
this.sceneBoundingBox.isBox3 &&
|
|
5367
|
+
!this.sceneBoundingBox.isEmpty()
|
|
5368
|
+
) {
|
|
5369
|
+
const size = this.sceneBoundingBox.getSize(new this.THREE.Vector3());
|
|
5370
|
+
const horizontalSpan = Math.max(size.x, size.z);
|
|
5371
|
+
if (Number.isFinite(horizontalSpan) && horizontalSpan > 0) {
|
|
5372
|
+
// 第一视角主要在水平面移动,优先使用场景水平范围估算移动速度
|
|
5373
|
+
nextMoveSpeed = horizontalSpan * 0.8;
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
|
|
5377
|
+
return Math.min(
|
|
5378
|
+
Math.max(nextMoveSpeed, minMoveSpeed),
|
|
5379
|
+
Math.min(maxMoveSpeed, optionMoveSpeed)
|
|
5380
|
+
);
|
|
5381
|
+
},
|
|
5318
5382
|
// 开启第一视角
|
|
5319
5383
|
startFirstPer(options) {
|
|
5320
5384
|
let { moveSpeed = 200, jumpSpeed = 200 } = options || {};
|
|
5321
|
-
this.removeSpeed = moveSpeed;
|
|
5385
|
+
this.removeSpeed = this.getFirstPersonMoveSpeed(moveSpeed);
|
|
5322
5386
|
this.upSpeed = jumpSpeed;
|
|
5323
5387
|
|
|
5324
5388
|
this.clock = new this.THREE.Clock();
|
|
@@ -5368,6 +5432,7 @@ export default {
|
|
|
5368
5432
|
this.pointControls.addEventListener('unlock', () => {
|
|
5369
5433
|
this.firstPerSign = false;
|
|
5370
5434
|
this.cameraControls.enabled = true;
|
|
5435
|
+
console.log(this.cameraControls);
|
|
5371
5436
|
// 返回初始视角
|
|
5372
5437
|
this.home();
|
|
5373
5438
|
try {
|
|
@@ -5428,8 +5493,8 @@ export default {
|
|
|
5428
5493
|
this.canJump = true;
|
|
5429
5494
|
}
|
|
5430
5495
|
// 根据速度值移动控制器
|
|
5431
|
-
this.pointControls.
|
|
5432
|
-
this.pointControls.
|
|
5496
|
+
this.pointControls.moveRight(-this.velocity.x * delta);
|
|
5497
|
+
this.pointControls.moveForward(-this.velocity.z * delta);
|
|
5433
5498
|
control.position.y += this.velocity.y * delta;
|
|
5434
5499
|
// 保证控制器的y轴在平面上
|
|
5435
5500
|
if (control.position.y < 3 - 0 / 10) {
|
|
@@ -5480,9 +5545,9 @@ export default {
|
|
|
5480
5545
|
break;
|
|
5481
5546
|
// 跳跃
|
|
5482
5547
|
case 32:
|
|
5483
|
-
if (this.canJump && spaceUp) this.velocity.y += this.upSpeed;
|
|
5548
|
+
if (this.canJump && this.spaceUp) this.velocity.y += this.upSpeed;
|
|
5484
5549
|
this.canJump = false;
|
|
5485
|
-
spaceUp = false;
|
|
5550
|
+
this.spaceUp = false;
|
|
5486
5551
|
break;
|
|
5487
5552
|
}
|
|
5488
5553
|
},
|
|
@@ -5512,7 +5577,7 @@ export default {
|
|
|
5512
5577
|
break;
|
|
5513
5578
|
// 跳跃
|
|
5514
5579
|
case 32:
|
|
5515
|
-
spaceUp = true;
|
|
5580
|
+
this.spaceUp = true;
|
|
5516
5581
|
break;
|
|
5517
5582
|
}
|
|
5518
5583
|
},
|
|
@@ -5545,9 +5610,9 @@ export default {
|
|
|
5545
5610
|
/*
|
|
5546
5611
|
参数: type: '', distance、area、angle、height, 暂时只提供距离、面积、角度、高度这四种方式
|
|
5547
5612
|
*/
|
|
5548
|
-
openMeasure(type) {
|
|
5613
|
+
openMeasure(type, isClear = false) {
|
|
5549
5614
|
if (this.threeMeasure) {
|
|
5550
|
-
this.threeMeasure.close(
|
|
5615
|
+
this.threeMeasure.close(isClear);
|
|
5551
5616
|
this.threeMeasure = null;
|
|
5552
5617
|
}
|
|
5553
5618
|
this.measureFlag = true;
|
|
@@ -5608,6 +5673,20 @@ export default {
|
|
|
5608
5673
|
// 移除键盘事件监听器
|
|
5609
5674
|
document.removeEventListener('keydown', this.handleMeasureKeyDown, false);
|
|
5610
5675
|
},
|
|
5676
|
+
// 增加一个清除所有测量结果的方法 使用统一名字的
|
|
5677
|
+
clearMeasureByName() {
|
|
5678
|
+
let list = this.getObjectByName('measureObj')
|
|
5679
|
+
list.forEach(item => {
|
|
5680
|
+
if (item.geometry) {
|
|
5681
|
+
item.geometry.dispose();
|
|
5682
|
+
item.material.dispose();
|
|
5683
|
+
}
|
|
5684
|
+
if (this.scene) this.scene.remove(item);
|
|
5685
|
+
})
|
|
5686
|
+
if (this.threeMeasure) {
|
|
5687
|
+
this.threeMeasure.clear();
|
|
5688
|
+
}
|
|
5689
|
+
},
|
|
5611
5690
|
handleMeasureKeyDown(event) {
|
|
5612
5691
|
// 检查是否按下了ESC键
|
|
5613
5692
|
const keyParam = {
|
|
@@ -24,7 +24,7 @@ var MeasureAngle = function (renderer, scene, camera, width, height) {
|
|
|
24
24
|
this.firstTime = 0;
|
|
25
25
|
// 创建一个辅助平面来捕获鼠标事件
|
|
26
26
|
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
27
|
-
|
|
27
|
+
this.measureName = 'measureObj'
|
|
28
28
|
// this.POINT_MATERIAL = new THREE.PointsMaterial({ color: 0xff5000, size: 1, opacity: 0.6, transparent: true, depthWrite: false, depthTest: false })
|
|
29
29
|
// this.LINE_MATERIAL = new THREE.LineBasicMaterial({ color: 0xff0000, linewidth: 3, opacity: 0.8, transparent: true, side: THREE.DoubleSide, depthWrite: false, depthTest: false })
|
|
30
30
|
};
|
|
@@ -89,6 +89,7 @@ MeasureAngle.prototype = {
|
|
|
89
89
|
const geom = new THREE.SphereGeometry(config.size || 0.3, 28, 28);
|
|
90
90
|
const sphere = new THREE.Mesh(geom, mesh);
|
|
91
91
|
sphere.frustumCulled = false;
|
|
92
|
+
sphere.name = this.measureName
|
|
92
93
|
sphere.position.set(pos.x, pos.y, pos.z);
|
|
93
94
|
return sphere;
|
|
94
95
|
},
|
|
@@ -98,10 +99,11 @@ MeasureAngle.prototype = {
|
|
|
98
99
|
linewidth: 10,
|
|
99
100
|
depthTest: false,
|
|
100
101
|
depthWrite: false,
|
|
101
|
-
transparent: true
|
|
102
|
+
transparent: true
|
|
102
103
|
});
|
|
103
104
|
const lineGeometry = new THREE.BufferGeometry().setFromPoints([p1, p2]);
|
|
104
105
|
const line = new THREE.Line(lineGeometry, lineMaterial);
|
|
106
|
+
line.name = this.measureName;
|
|
105
107
|
line.renderOrder = 999;
|
|
106
108
|
line.frustumCulled = false;
|
|
107
109
|
return line;
|
|
@@ -111,6 +113,7 @@ MeasureAngle.prototype = {
|
|
|
111
113
|
div.className = name;
|
|
112
114
|
div.textContent = text;
|
|
113
115
|
const divLabel = new CSS2DObject(div);
|
|
116
|
+
divLabel.name = this.measureName
|
|
114
117
|
divLabel.position.set(position.x, position.y, position.z);
|
|
115
118
|
return divLabel;
|
|
116
119
|
},
|
|
@@ -171,6 +174,7 @@ MeasureAngle.prototype = {
|
|
|
171
174
|
div.className = 'tips-label';
|
|
172
175
|
div.textContent = label;
|
|
173
176
|
const tipsLabel = new CSS2DObject(div);
|
|
177
|
+
tipsLabel.name = this.measureName
|
|
174
178
|
tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
|
|
175
179
|
return tipsLabel;
|
|
176
180
|
},
|
|
@@ -254,6 +258,22 @@ MeasureAngle.prototype = {
|
|
|
254
258
|
}
|
|
255
259
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
256
260
|
},
|
|
261
|
+
clear() {
|
|
262
|
+
this.remove(this.points);
|
|
263
|
+
this.remove(this.polyline);
|
|
264
|
+
this.remove(this.labels);
|
|
265
|
+
this.remove(this.curves);
|
|
266
|
+
this.pointArray.splice(0);
|
|
267
|
+
this.points.splice(0);
|
|
268
|
+
this.polyline.splice(0);
|
|
269
|
+
this.labels.splice(0);
|
|
270
|
+
this.curves.splice(0);
|
|
271
|
+
this.tempPoints = undefined;
|
|
272
|
+
this.tempLabel = undefined;
|
|
273
|
+
this.tempLine = undefined;
|
|
274
|
+
this.scene.remove(this.tipsLabel);
|
|
275
|
+
this.tipsLabel = undefined;
|
|
276
|
+
},
|
|
257
277
|
remove(array) {
|
|
258
278
|
for (let index = 0; index < array.length; index++) {
|
|
259
279
|
const element = array[index];
|
|
@@ -22,7 +22,7 @@ var MeasureArea = function (renderer, scene, camera, width, height) {
|
|
|
22
22
|
this.width = width;
|
|
23
23
|
this.height = height;
|
|
24
24
|
this.firstTime = 0;
|
|
25
|
-
|
|
25
|
+
this.measureName = 'measureObj'
|
|
26
26
|
// 创建一个辅助平面来捕获鼠标事件
|
|
27
27
|
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
28
28
|
};
|
|
@@ -88,10 +88,11 @@ MeasureArea.prototype = {
|
|
|
88
88
|
linewidth: 20,
|
|
89
89
|
depthTest: false,
|
|
90
90
|
depthWrite: false,
|
|
91
|
-
transparent: true
|
|
91
|
+
transparent: true
|
|
92
92
|
});
|
|
93
93
|
const lineGeometry = new THREE.BufferGeometry().setFromPoints([p1, p2]);
|
|
94
94
|
const line = new THREE.Line(lineGeometry, lineMaterial);
|
|
95
|
+
line.name = this.measureName;
|
|
95
96
|
line.renderOrder = 999;
|
|
96
97
|
line.frustumCulled = false;
|
|
97
98
|
return line;
|
|
@@ -101,6 +102,7 @@ MeasureArea.prototype = {
|
|
|
101
102
|
div.className = name;
|
|
102
103
|
div.textContent = text;
|
|
103
104
|
const divLabel = new CSS2DObject(div);
|
|
105
|
+
divLabel.name = this.measureName
|
|
104
106
|
divLabel.position.set(position.x, position.y, position.z);
|
|
105
107
|
return divLabel;
|
|
106
108
|
},
|
|
@@ -163,6 +165,7 @@ MeasureArea.prototype = {
|
|
|
163
165
|
div.className = 'tips-label';
|
|
164
166
|
div.textContent = label;
|
|
165
167
|
const tipsLabel = new CSS2DObject(div);
|
|
168
|
+
tipsLabel.name = this.measureName
|
|
166
169
|
tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
|
|
167
170
|
return tipsLabel;
|
|
168
171
|
},
|
|
@@ -250,6 +253,21 @@ MeasureArea.prototype = {
|
|
|
250
253
|
|
|
251
254
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
252
255
|
},
|
|
256
|
+
clear() {
|
|
257
|
+
this.remove(this.points);
|
|
258
|
+
this.remove(this.polyline);
|
|
259
|
+
this.remove(this.labels);
|
|
260
|
+
this.remove(this.polygons);
|
|
261
|
+
this.pointArray.splice(0);
|
|
262
|
+
this.points.splice(0);
|
|
263
|
+
this.polyline.splice(0);
|
|
264
|
+
this.labels.splice(0);
|
|
265
|
+
this.tempPoints = undefined;
|
|
266
|
+
this.tempLabel = undefined;
|
|
267
|
+
this.tempLine = undefined;
|
|
268
|
+
this.scene.remove(this.tipsLabel);
|
|
269
|
+
this.tipsLabel = undefined;
|
|
270
|
+
},
|
|
253
271
|
remove(array) {
|
|
254
272
|
for (let index = 0; index < array.length; index++) {
|
|
255
273
|
const element = array[index];
|
|
@@ -304,10 +322,12 @@ MeasureArea.prototype = {
|
|
|
304
322
|
transparent: true,
|
|
305
323
|
opacity: 0.5,
|
|
306
324
|
side: THREE.DoubleSide,
|
|
325
|
+
name: this.measureName
|
|
307
326
|
});
|
|
308
327
|
const mesh = new THREE.Mesh(geom, material);
|
|
309
328
|
mesh.frustumCulled = false;
|
|
310
|
-
mesh.name = 'polygonMesh';
|
|
329
|
+
// mesh.name = 'polygonMesh';
|
|
330
|
+
mesh.name = _this.measureName;
|
|
311
331
|
_this.polygonMesh = mesh;
|
|
312
332
|
_this.scene.add(mesh);
|
|
313
333
|
_this.polygons.push(mesh);
|
|
@@ -20,7 +20,7 @@ var MeasureDistance = function (renderer, scene, camera, width, height) {
|
|
|
20
20
|
this.width = width;
|
|
21
21
|
this.height = height;
|
|
22
22
|
this.firstTime = 0;
|
|
23
|
-
|
|
23
|
+
this.measureName = 'measureObj'
|
|
24
24
|
// 创建一个辅助平面来捕获鼠标事件
|
|
25
25
|
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
26
26
|
};
|
|
@@ -91,6 +91,7 @@ MeasureDistance.prototype = {
|
|
|
91
91
|
});
|
|
92
92
|
const lineGeometry = new THREE.BufferGeometry().setFromPoints([p1, p2]);
|
|
93
93
|
const line = new THREE.Line(lineGeometry, lineMaterial);
|
|
94
|
+
line.name = this.measureName;
|
|
94
95
|
line.renderOrder = 999;
|
|
95
96
|
line.frustumCulled = false;
|
|
96
97
|
return line;
|
|
@@ -100,6 +101,7 @@ MeasureDistance.prototype = {
|
|
|
100
101
|
div.className = name;
|
|
101
102
|
div.textContent = text;
|
|
102
103
|
const divLabel = new CSS2DObject(div);
|
|
104
|
+
divLabel.name = this.measureName
|
|
103
105
|
divLabel.position.set(position.x, position.y, position.z);
|
|
104
106
|
return divLabel;
|
|
105
107
|
},
|
|
@@ -147,6 +149,7 @@ MeasureDistance.prototype = {
|
|
|
147
149
|
div.className = 'tips-label';
|
|
148
150
|
div.textContent = label;
|
|
149
151
|
const tipsLabel = new CSS2DObject(div);
|
|
152
|
+
tipsLabel.name = this.measureName
|
|
150
153
|
tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
|
|
151
154
|
return tipsLabel;
|
|
152
155
|
},
|
|
@@ -154,6 +157,7 @@ MeasureDistance.prototype = {
|
|
|
154
157
|
this.firstTime = new Date().getTime();
|
|
155
158
|
},
|
|
156
159
|
click(e) {
|
|
160
|
+
console.log(_this.points)
|
|
157
161
|
let lastTime = new Date().getTime();
|
|
158
162
|
if (lastTime - this.firstTime < 300) {
|
|
159
163
|
if (_this.isCompleted) {
|
|
@@ -230,6 +234,21 @@ MeasureDistance.prototype = {
|
|
|
230
234
|
}
|
|
231
235
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
232
236
|
},
|
|
237
|
+
clear() {
|
|
238
|
+
this.remove(this.points);
|
|
239
|
+
this.remove(this.polyline);
|
|
240
|
+
this.remove(this.labels);
|
|
241
|
+
this.pointArray.splice(0);
|
|
242
|
+
this.points.splice(0);
|
|
243
|
+
this.polyline.splice(0);
|
|
244
|
+
this.labels.splice(0);
|
|
245
|
+
this.tempPoints = undefined;
|
|
246
|
+
this.tempLabel = undefined;
|
|
247
|
+
this.tempLine = undefined;
|
|
248
|
+
this.scene.remove(this.tipsLabel);
|
|
249
|
+
this.tipsLabel = undefined;
|
|
250
|
+
this.firstTime = 0;
|
|
251
|
+
},
|
|
233
252
|
remove(array) {
|
|
234
253
|
for (let index = 0; index < array.length; index++) {
|
|
235
254
|
const element = array[index];
|
|
@@ -22,6 +22,7 @@ var MeasureHeight = function (renderer, scene, camera, width, height) {
|
|
|
22
22
|
this.height = height;
|
|
23
23
|
this.firstTime = 0;
|
|
24
24
|
this.plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
|
|
25
|
+
this.measureName = 'measureObj'
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
MeasureHeight.prototype = {
|
|
@@ -82,10 +83,11 @@ MeasureHeight.prototype = {
|
|
|
82
83
|
linewidth: 15,
|
|
83
84
|
depthTest: false,
|
|
84
85
|
depthWrite: false,
|
|
85
|
-
transparent: true
|
|
86
|
+
transparent: true
|
|
86
87
|
});
|
|
87
88
|
const lineGeometry = new THREE.BufferGeometry().setFromPoints([p1, p2]);
|
|
88
89
|
const line = new THREE.Line(lineGeometry, lineMaterial);
|
|
90
|
+
line.name = this.measureName;
|
|
89
91
|
line.renderOrder = 999;
|
|
90
92
|
line.frustumCulled = false;
|
|
91
93
|
return line;
|
|
@@ -95,6 +97,7 @@ MeasureHeight.prototype = {
|
|
|
95
97
|
div.className = name;
|
|
96
98
|
div.textContent = text;
|
|
97
99
|
const divLabel = new CSS2DObject(div);
|
|
100
|
+
divLabel.name = this.measureName
|
|
98
101
|
divLabel.position.set(position.x, position.y, position.z);
|
|
99
102
|
return divLabel;
|
|
100
103
|
},
|
|
@@ -125,6 +128,7 @@ MeasureHeight.prototype = {
|
|
|
125
128
|
div.className = 'tips-label';
|
|
126
129
|
div.textContent = label;
|
|
127
130
|
const tipsLabel = new CSS2DObject(div);
|
|
131
|
+
tipsLabel.name = this.measureName
|
|
128
132
|
tipsLabel.position.set(position.x + 0.1, position.y, position.z + 0.05);
|
|
129
133
|
return tipsLabel;
|
|
130
134
|
},
|
|
@@ -184,6 +188,18 @@ MeasureHeight.prototype = {
|
|
|
184
188
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
185
189
|
this.firstTime = 0;
|
|
186
190
|
}
|
|
191
|
+
|
|
192
|
+
},
|
|
193
|
+
clear() {
|
|
194
|
+
this.remove(this.points);
|
|
195
|
+
this.remove(this.polyline);
|
|
196
|
+
this.remove(this.labels);
|
|
197
|
+
this.pointArray.splice(0);
|
|
198
|
+
this.points.splice(0);
|
|
199
|
+
this.polyline.splice(0);
|
|
200
|
+
this.labels.splice(0);
|
|
201
|
+
this.scene.remove(this.tipsLabel);
|
|
202
|
+
this.tipsLabel = undefined;
|
|
187
203
|
},
|
|
188
204
|
remove(array) {
|
|
189
205
|
for (let index = 0; index < array.length; index++) {
|