bc-model-viewer 1.6.74 → 1.6.76
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/bc-model-viewer.min.js +1 -1
- package/examples/{measure.html → DistanceMeasureTool.html} +6 -4
- package/examples/{hud.html → HUDLabelTool.html} +18 -18
- package/examples/{clip.html → ModelClipperTool.html} +3 -1
- package/examples/SelectionZoomTool.html +64 -0
- package/examples/index.html +58 -2
- package/package.json +1 -1
- package/examples/window-resize.html +0 -60
|
@@ -24,8 +24,10 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
<div class="demo">
|
|
26
26
|
<h2>测量工具演示</h2>
|
|
27
|
-
<
|
|
28
|
-
<button onclick="tool.
|
|
27
|
+
<p>点击标签选中,变红按Delete删除</p>
|
|
28
|
+
<button onclick="tool.activate()">激活工具</button>
|
|
29
|
+
<button onclick="tool.deactivate()">停用工具(Esc)</button>
|
|
30
|
+
<button onclick="tool.toggle()">切换工具状态</button>
|
|
29
31
|
<br>
|
|
30
32
|
<button onclick="tool.removeLast()">清除上一次</button>
|
|
31
33
|
<button onclick="tool.clear()">清除所有</button>
|
|
@@ -50,8 +52,8 @@
|
|
|
50
52
|
})
|
|
51
53
|
|
|
52
54
|
// 加载测试模型
|
|
53
|
-
|
|
54
|
-
await viewer.loadZipAsync('../../assets/new.dgz')
|
|
55
|
+
await viewer.loadZipAsync('../../assets/dgz/建筑.dgz')
|
|
56
|
+
// await viewer.loadZipAsync('../../assets/new.dgz')
|
|
55
57
|
|
|
56
58
|
const tool = new DistanceMeasureTool(viewer)
|
|
57
59
|
|
|
@@ -24,21 +24,23 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
<div class="demo">
|
|
26
26
|
<h2>标签工具演示</h2>
|
|
27
|
-
<
|
|
28
|
-
<button onclick="
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
27
|
+
<p>点击添加标签 通过类名控制样式</p>
|
|
28
|
+
<button onclick="tool.activate()">激活工具</button>
|
|
29
|
+
<button onclick="tool.deactivate()">停用工具(Esc)</button>
|
|
30
|
+
<button onclick="tool.toggle()">切换工具状态</button>
|
|
31
|
+
<br>
|
|
32
|
+
<!--
|
|
33
|
+
<button onclick="tool.activate({
|
|
32
34
|
fixedY: 1,
|
|
33
35
|
onPut(point, hud) {
|
|
34
36
|
console.log('放置完成', point, hud);
|
|
35
|
-
//
|
|
37
|
+
// tool.remove(hud) // 移除指定元素
|
|
36
38
|
}
|
|
37
|
-
})">锁定Y轴为1</button>
|
|
39
|
+
})">锁定Y轴为1</button> -->
|
|
38
40
|
|
|
39
|
-
<button onclick="
|
|
40
|
-
<button onclick="
|
|
41
|
-
<button onclick="
|
|
41
|
+
<button onclick="tool.removeLast()">清除上一次标签</button>
|
|
42
|
+
<button onclick="tool.clear()">清除所有标签</button>
|
|
43
|
+
<button onclick="tool.gets()">获取所有标签</button>
|
|
42
44
|
|
|
43
45
|
</div>
|
|
44
46
|
|
|
@@ -46,7 +48,6 @@
|
|
|
46
48
|
|
|
47
49
|
import { Viewer, HUDLabelTool } from '../../index.ts'
|
|
48
50
|
|
|
49
|
-
|
|
50
51
|
const container = document.getElementById('container')
|
|
51
52
|
|
|
52
53
|
// 实例化 Viewer 对象
|
|
@@ -56,20 +57,19 @@
|
|
|
56
57
|
await viewer.loadZipAsync('../../assets/new.dgz')
|
|
57
58
|
|
|
58
59
|
// 创建工具 只需要实例化一次
|
|
59
|
-
const
|
|
60
|
+
const tool = new HUDLabelTool(viewer)
|
|
60
61
|
|
|
61
|
-
//
|
|
62
|
-
const hud =
|
|
62
|
+
// 直接给原点直接添加一个html标签
|
|
63
|
+
const hud = tool.addByPoint([0, 0, 0], {
|
|
63
64
|
className: 'my-hud',
|
|
64
65
|
html: '<h1 style="color: red">原点<h1>'
|
|
65
66
|
})
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
// viewer.shortcutManager.toggleShortcuts(false) // 关闭快捷键
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
viewer.shortcutManager.toggleShortcuts(false)
|
|
70
|
+
tool.activate()
|
|
71
71
|
|
|
72
|
-
window.
|
|
72
|
+
window.tool = tool
|
|
73
73
|
window.viewer = viewer
|
|
74
74
|
</script>
|
|
75
75
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<div class="demo">
|
|
26
26
|
<h2>剖切工具演示</h2>
|
|
27
27
|
<button onclick="viewer.clipper.activate()">激活工具</button>
|
|
28
|
-
<button onclick="viewer.clipper.deactivate()"
|
|
28
|
+
<button onclick="viewer.clipper.deactivate()">停用工具(Esc)</button>
|
|
29
29
|
|
|
30
30
|
</div>
|
|
31
31
|
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
await viewer.loadZipAsync('../../../assets/new.dgz')
|
|
58
58
|
// await viewer.loadZipAsync('../../../assets/dgz/机电综合.dgz')
|
|
59
59
|
|
|
60
|
+
viewer.clipper.activate()
|
|
61
|
+
|
|
60
62
|
window.viewer = viewer
|
|
61
63
|
</script>
|
|
62
64
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Bc-model-viewer</title>
|
|
8
|
+
<style>
|
|
9
|
+
body {
|
|
10
|
+
margin: 0;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.demo {
|
|
15
|
+
position: absolute;
|
|
16
|
+
z-index: 1;
|
|
17
|
+
top: 0;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
</head>
|
|
21
|
+
|
|
22
|
+
<body>
|
|
23
|
+
<div id="container">
|
|
24
|
+
</div>
|
|
25
|
+
<div class="demo">
|
|
26
|
+
<h2>框选放大工具演示</h2>
|
|
27
|
+
<p>框选范围越小看的越详细</p>
|
|
28
|
+
<button onclick="tool.activate()">激活工具</button>
|
|
29
|
+
<button onclick="tool.deactivate()">停用工具(Esc)</button>
|
|
30
|
+
<button onclick="tool.toggle()">切换工具状态</button>
|
|
31
|
+
<br>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<script type="module">
|
|
35
|
+
|
|
36
|
+
import { Viewer, SelectionZoomTool } from '../../index.ts'
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const container = document.getElementById('container')
|
|
40
|
+
|
|
41
|
+
// 实例化 Viewer 对象
|
|
42
|
+
const viewer = new Viewer(container, {
|
|
43
|
+
load: {
|
|
44
|
+
cache: {
|
|
45
|
+
enabled: false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// 加载测试模型
|
|
51
|
+
await viewer.loadZipAsync('../../assets/dgz/建筑.dgz')
|
|
52
|
+
// await viewer.loadZipAsync('../../assets/new.dgz')
|
|
53
|
+
|
|
54
|
+
const tool = new SelectionZoomTool(viewer)
|
|
55
|
+
|
|
56
|
+
tool.activate()
|
|
57
|
+
|
|
58
|
+
window.tool = tool
|
|
59
|
+
window.viewer = viewer
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
</body>
|
|
63
|
+
|
|
64
|
+
</html>
|
package/examples/index.html
CHANGED
|
@@ -1,11 +1,67 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
+
|
|
3
4
|
<head>
|
|
4
5
|
<meta charset="UTF-8">
|
|
5
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>
|
|
7
|
+
<title>Bc-model-viewer</title>
|
|
8
|
+
<style>
|
|
9
|
+
body {
|
|
10
|
+
margin: 0;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.demo {
|
|
15
|
+
position: absolute;
|
|
16
|
+
z-index: 1;
|
|
17
|
+
top: 0;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
7
20
|
</head>
|
|
21
|
+
|
|
8
22
|
<body>
|
|
9
|
-
|
|
23
|
+
<div id="container">
|
|
24
|
+
</div>
|
|
25
|
+
<div class="demo">
|
|
26
|
+
<h2>工具演示</h2>
|
|
27
|
+
<button onclick="tool.activate()">激活工具</button>
|
|
28
|
+
<button onclick="tool.deactivate()">停用工具</button>
|
|
29
|
+
<button onclick="tool.toggle()">切换工具状态</button>
|
|
30
|
+
<br>
|
|
31
|
+
<button onclick="tool.removeLast()">清除上一次</button>
|
|
32
|
+
<button onclick="tool.clear()">清除所有</button>
|
|
33
|
+
<br>
|
|
34
|
+
<button onclick="console.log(tool.getMeasurements())">打印数据</button>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<script type="module">
|
|
38
|
+
|
|
39
|
+
import { Viewer, DistanceMeasureTool } from '../../index.ts'
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const container = document.getElementById('container')
|
|
43
|
+
|
|
44
|
+
// 实例化 Viewer 对象
|
|
45
|
+
const viewer = new Viewer(container, {
|
|
46
|
+
load: {
|
|
47
|
+
cache: {
|
|
48
|
+
enabled: false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// 加载测试模型
|
|
54
|
+
await viewer.loadZipAsync('../../assets/dgz/建筑.dgz')
|
|
55
|
+
// await viewer.loadZipAsync('../../assets/new.dgz')
|
|
56
|
+
|
|
57
|
+
const tool = new DistanceMeasureTool(viewer)
|
|
58
|
+
|
|
59
|
+
tool.activate()
|
|
60
|
+
|
|
61
|
+
window.tool = tool
|
|
62
|
+
window.viewer = viewer
|
|
63
|
+
</script>
|
|
64
|
+
|
|
10
65
|
</body>
|
|
66
|
+
|
|
11
67
|
</html>
|
package/package.json
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Bc-model-viewer</title>
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
margin: 0;
|
|
11
|
-
position: relative;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.demo {
|
|
15
|
-
position: absolute;
|
|
16
|
-
z-index: 1;
|
|
17
|
-
top: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.container {
|
|
21
|
-
width: 100px;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.center-container {
|
|
26
|
-
width: 500px;
|
|
27
|
-
height: 300px;
|
|
28
|
-
}
|
|
29
|
-
</style>
|
|
30
|
-
</head>
|
|
31
|
-
|
|
32
|
-
<body>
|
|
33
|
-
|
|
34
|
-
<div class="container">
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<div class="demo">
|
|
38
|
-
<h2>剖切工具演示</h2>
|
|
39
|
-
<button onclick="changPos()">移动位置</button>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<script type="module">
|
|
43
|
-
|
|
44
|
-
import { Viewer, HUDLabelTool } from '../../index.ts'
|
|
45
|
-
|
|
46
|
-
const container = document.getElementsByClassName('container')[0]
|
|
47
|
-
|
|
48
|
-
const viewer = new Viewer(container)
|
|
49
|
-
|
|
50
|
-
await viewer.loadZipAsync('./test.dgz')
|
|
51
|
-
|
|
52
|
-
window.changPos = () => {
|
|
53
|
-
container.classList.add('center-container')
|
|
54
|
-
viewer.resize()
|
|
55
|
-
}
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
</body>
|
|
59
|
-
|
|
60
|
-
</html>
|