fl-web-component 1.2.13 → 1.2.18
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[data-v-
|
|
1
|
+
@charset "UTF-8";#fl-model[data-v-afb88654],#konva-container[data-v-4458f11e]{width:100%;height:100%;cursor:pointer}#konva-container[data-v-4458f11e]{z-index:3;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:flex;flex-direction:column;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:flex;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:""}#svg-tigger[data-v-0ec35ee4]{cursor:pointer;height:100%;width:100%}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fl-web-component",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"tip1": "仅调试本组件不涉及业务组件,请执行dev",
|
|
6
6
|
"dev": "vue-cli-service serve",
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
"watch": "vue-cli-service build --watch --mode production --target lib --name fl-web-component --formats commonjs ./src/main.js",
|
|
11
11
|
"build": "npm run lint && vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js",
|
|
12
12
|
"build:test": "vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js",
|
|
13
|
+
"registry:npm": "npm config set registry https://registry.npmjs.org/",
|
|
13
14
|
"publish:base": "npm run build && npm publish",
|
|
14
15
|
"tip3": "发版注意: 【修改bug执行publish:fix】【新增功能执行publish:feat】【新特性执行publish:perf】",
|
|
15
|
-
"publish:fix": "npm version patch && npm run publish:base",
|
|
16
|
-
"publish:feat": "npm version minor && npm run publish:base",
|
|
17
|
-
"publish:perf": "npm version major && npm run publish:base"
|
|
16
|
+
"publish:fix": "npm run registry:npm && npm version patch && npm run publish:base",
|
|
17
|
+
"publish:feat": "npm run registry:npm && npm version minor && npm run publish:base",
|
|
18
|
+
"publish:perf": "npm run registry:npm && npm version major && npm run publish:base"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"dist",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
],
|
|
25
26
|
"main": "dist/fl-web-component.common.js",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"camera-controls": "
|
|
28
|
+
"camera-controls": "2.9.0",
|
|
28
29
|
"core-js": "^3.42.0",
|
|
29
30
|
"dxf-parser": "^1.1.2",
|
|
30
31
|
"element-ui": "2.15.14",
|
|
@@ -293,29 +293,38 @@
|
|
|
293
293
|
};
|
|
294
294
|
},
|
|
295
295
|
mouseDown(event) {
|
|
296
|
+
const intersects = this.getRaycasterObjects(event);
|
|
296
297
|
firstTime = new Date().getTime();
|
|
297
298
|
let params = {
|
|
298
299
|
event,
|
|
299
300
|
firstTime,
|
|
300
301
|
};
|
|
302
|
+
intersects.length && (params.v3Position = {
|
|
303
|
+
x: intersects[0].point.x,
|
|
304
|
+
y: intersects[0].point.y,
|
|
305
|
+
z: intersects[0].point.z,
|
|
306
|
+
});
|
|
301
307
|
this.$emit('leftMouseDown', params);
|
|
302
308
|
},
|
|
309
|
+
getRaycasterObjects(event){
|
|
310
|
+
// 获取元素在页面中的偏移位置
|
|
311
|
+
const rect = renderer.domElement.getBoundingClientRect();
|
|
312
|
+
const x = event.clientX - rect.left;
|
|
313
|
+
const y = event.clientY - rect.top;
|
|
314
|
+
|
|
315
|
+
// mouse.x = (event.clientX / instructions.offsetWidth) * 2 - 1;
|
|
316
|
+
// mouse.y = -(event.clientY / instructions.offsetHeight) * 2 + 1;
|
|
317
|
+
mouse.x = (x / rect.width) * 2 - 1;
|
|
318
|
+
mouse.y = -(y / rect.height) * 2 + 1;
|
|
319
|
+
raycaster.setFromCamera(mouse, camera);
|
|
320
|
+
return raycaster.intersectObjects(scene.children, true);
|
|
321
|
+
},
|
|
303
322
|
mouseClick(event) {
|
|
304
323
|
// 在测量模式下,不进行事件暴露
|
|
305
324
|
if (!measureFlag) {
|
|
306
325
|
lastTime = new Date().getTime();
|
|
307
326
|
if (lastTime - firstTime < 300) {
|
|
308
|
-
|
|
309
|
-
const rect = renderer.domElement.getBoundingClientRect();
|
|
310
|
-
const x = event.clientX - rect.left;
|
|
311
|
-
const y = event.clientY - rect.top;
|
|
312
|
-
|
|
313
|
-
// mouse.x = (event.clientX / instructions.offsetWidth) * 2 - 1;
|
|
314
|
-
// mouse.y = -(event.clientY / instructions.offsetHeight) * 2 + 1;
|
|
315
|
-
mouse.x = (x / rect.width) * 2 - 1;
|
|
316
|
-
mouse.y = -(y / rect.height) * 2 + 1;
|
|
317
|
-
raycaster.setFromCamera(mouse, camera);
|
|
318
|
-
const intersects = raycaster.intersectObjects(scene.children, true);
|
|
327
|
+
const intersects = this.getRaycasterObjects(event);
|
|
319
328
|
let params = {};
|
|
320
329
|
let cameraData = {
|
|
321
330
|
position: {
|
|
@@ -1510,7 +1519,18 @@
|
|
|
1510
1519
|
cameraControls,
|
|
1511
1520
|
scene,
|
|
1512
1521
|
}
|
|
1513
|
-
}
|
|
1522
|
+
},
|
|
1523
|
+
setMouseAction(btn) {
|
|
1524
|
+
const ACTION_ENUM = {
|
|
1525
|
+
'none': 0,
|
|
1526
|
+
'rotate': 1,
|
|
1527
|
+
'drag': 2,
|
|
1528
|
+
}
|
|
1529
|
+
const {left, right} = btn;
|
|
1530
|
+
|
|
1531
|
+
left && (cameraControls.mouseButtons.left = ACTION_ENUM[left]);
|
|
1532
|
+
right && (cameraControls.mouseButtons.right = ACTION_ENUM[right]);
|
|
1533
|
+
},
|
|
1514
1534
|
},
|
|
1515
1535
|
};
|
|
1516
1536
|
</script>
|