@sequent-org/ifc-viewer 1.2.4-ci.24.0 → 1.2.4-ci.25.0
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/package.json +1 -1
- package/src/IfcViewer.js +1 -1
- package/src/viewer/NavCube.js +26 -24
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequent-org/ifc-viewer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.4-ci.
|
|
4
|
+
"version": "1.2.4-ci.25.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "IFC 3D model viewer component for web applications - fully self-contained with local IFCLoader",
|
|
7
7
|
"main": "src/index.js",
|
package/src/IfcViewer.js
CHANGED
|
@@ -302,7 +302,7 @@ export class IfcViewer {
|
|
|
302
302
|
</div>
|
|
303
303
|
|
|
304
304
|
<!-- Верхняя панель управления -->
|
|
305
|
-
<div id="ifcToolbar" class="d-flex px-4" style="border:0px red solid; width: 250px; position: absolute; z-index:
|
|
305
|
+
<div id="ifcToolbar" class="d-flex px-4" style="border:0px red solid; width: 250px; position: absolute; z-index: 60; justify-content:space-between; bottom: 10px; left: calc(50% - 125px); ">
|
|
306
306
|
|
|
307
307
|
<div class="navbar-end flex gap-2">
|
|
308
308
|
|
package/src/viewer/NavCube.js
CHANGED
|
@@ -30,12 +30,12 @@ export class NavCube {
|
|
|
30
30
|
// Полупрозрачный куб с окрашенными сторонами (+X/-X, +Y/-Y, +Z/-Z)
|
|
31
31
|
const geom = new THREE.BoxGeometry(1, 1, 1);
|
|
32
32
|
const mats = [
|
|
33
|
-
new THREE.MeshBasicMaterial({ color:
|
|
34
|
-
new THREE.MeshBasicMaterial({ color:
|
|
35
|
-
new THREE.MeshBasicMaterial({ color:
|
|
36
|
-
new THREE.MeshBasicMaterial({ color:
|
|
37
|
-
new THREE.MeshBasicMaterial({ color:
|
|
38
|
-
new THREE.MeshBasicMaterial({ color:
|
|
33
|
+
new THREE.MeshBasicMaterial({ color: 0x80CBC4, transparent: true, opacity: this.faceOpacity }), // +X (сзади - зеленый)
|
|
34
|
+
new THREE.MeshBasicMaterial({ color: 0xA5D6A7, transparent: true, opacity: this.faceOpacity }), // -X (спереди - зеленый)
|
|
35
|
+
new THREE.MeshBasicMaterial({ color: 0xFF8A65, transparent: true, opacity: this.faceOpacity }), // +Y (верх - красный )
|
|
36
|
+
new THREE.MeshBasicMaterial({ color: 0xEF9A9A, transparent: true, opacity: this.faceOpacity }), // -Y (низ - красный)
|
|
37
|
+
new THREE.MeshBasicMaterial({ color: 0x90CAF9, transparent: true, opacity: this.faceOpacity }), // +Z (справа - синий)
|
|
38
|
+
new THREE.MeshBasicMaterial({ color: 0x9FA8DA, transparent: true, opacity: this.faceOpacity }), // -Z (слева - синий)
|
|
39
39
|
];
|
|
40
40
|
this.cube = new THREE.Mesh(geom, mats);
|
|
41
41
|
this.cube.name = "nav-cube";
|
|
@@ -53,7 +53,7 @@ export class NavCube {
|
|
|
53
53
|
|
|
54
54
|
// Рёбра для читабельности
|
|
55
55
|
const edges = new THREE.EdgesGeometry(geom, 1);
|
|
56
|
-
const lineMat = new THREE.LineBasicMaterial({ color:
|
|
56
|
+
const lineMat = new THREE.LineBasicMaterial({ color: 0xEEEEEE, depthTest: true });
|
|
57
57
|
this.cubeEdges = new THREE.LineSegments(edges, lineMat);
|
|
58
58
|
this.cubeEdges.renderOrder = 999;
|
|
59
59
|
this.cube.add(this.cubeEdges);
|
|
@@ -90,20 +90,21 @@ export class NavCube {
|
|
|
90
90
|
this.homeBtn = document.createElement('button');
|
|
91
91
|
this.homeBtn.type = 'button';
|
|
92
92
|
this.homeBtn.title = 'Home';
|
|
93
|
-
this.homeBtn.
|
|
93
|
+
this.homeBtn.innerHTML = `
|
|
94
|
+
<svg fill="#000000" width="20px" height="20px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon">
|
|
95
|
+
<path d="M946.5 505L534.6 93.4a31.93 31.93 0 0 0-45.2 0L77.5 505c-12 12-18.8 28.3-18.8 45.3 0 35.3 28.7 64 64 64h43.4V908c0 17.7 14.3 32 32 32H448V716h112v224h265.9c17.7 0 32-14.3 32-32V614.3h43.4c17 0 33.3-6.7 45.3-18.8 24.9-25 24.9-65.5-.1-90.5z"/>
|
|
96
|
+
</svg>
|
|
97
|
+
`;
|
|
94
98
|
this.homeBtn.style.position = 'absolute';
|
|
95
|
-
this.homeBtn.style.zIndex = '40';
|
|
96
|
-
this.homeBtn.style.width = '
|
|
97
|
-
this.homeBtn.style.height = '
|
|
98
|
-
this.homeBtn.style.lineHeight = '28px';
|
|
99
|
-
this.homeBtn.style.textAlign = 'center';
|
|
99
|
+
this.homeBtn.style.zIndex = '40';
|
|
100
|
+
this.homeBtn.style.width = '30px';
|
|
101
|
+
this.homeBtn.style.height = '30px';
|
|
100
102
|
this.homeBtn.style.borderRadius = '6px';
|
|
101
|
-
this.homeBtn.style.border = '
|
|
102
|
-
this.homeBtn.style.background = 'rgba(0,0,0,0.
|
|
103
|
+
this.homeBtn.style.border = '0px solid rgba(255,255,255,0.1)';
|
|
104
|
+
this.homeBtn.style.background = 'rgba(0, 0, 0, 0.05)';
|
|
103
105
|
this.homeBtn.style.color = '#fff';
|
|
104
106
|
this.homeBtn.style.cursor = 'pointer';
|
|
105
|
-
this.homeBtn.style.userSelect = 'none';
|
|
106
|
-
this.homeBtn.style.font = '14px/28px system-ui, sans-serif';
|
|
107
|
+
this.homeBtn.style.userSelect = 'none';
|
|
107
108
|
// Позиция задаётся в renderOverlay относительно текущего размера
|
|
108
109
|
this.homeBtn.addEventListener('click', () => { try { this.onHome && this.onHome(); } catch(_) {} });
|
|
109
110
|
try { this.container.appendChild(this.homeBtn); } catch(_) {}
|
|
@@ -177,15 +178,15 @@ export class NavCube {
|
|
|
177
178
|
|
|
178
179
|
// Позиционируем кнопку Home слева от куба
|
|
179
180
|
if (this.homeBtn) {
|
|
180
|
-
this.homeBtn.style.top = `${this.marginPx +
|
|
181
|
-
this.homeBtn.style.left = `${Math.max(2, fullW - this.marginPx - vpSize -
|
|
181
|
+
this.homeBtn.style.top = `${this.marginPx + 20}px`;
|
|
182
|
+
this.homeBtn.style.left = `${Math.max(2, fullW - this.marginPx - vpSize - 60)}px`;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
// ================= Подписи граней =================
|
|
186
187
|
#addFaceLabels() {
|
|
187
188
|
const makeFaceTexture = (text) => {
|
|
188
|
-
const size = 512; // квадрат для равномерности
|
|
189
|
+
const size = Math.floor(512 / 0.98); // квадрат для равномерности
|
|
189
190
|
const canvas = document.createElement('canvas');
|
|
190
191
|
canvas.width = size; canvas.height = size;
|
|
191
192
|
const ctx = canvas.getContext('2d');
|
|
@@ -193,12 +194,13 @@ export class NavCube {
|
|
|
193
194
|
ctx.clearRect(0, 0, size, size);
|
|
194
195
|
// Чёрный крупный текст по центру
|
|
195
196
|
ctx.fillStyle = '#000';
|
|
196
|
-
// Уменьшаем шрифт
|
|
197
|
-
const fontPx = Math.floor(size * 0.
|
|
197
|
+
// Уменьшаем шрифт для лучшего размещения длинных слов
|
|
198
|
+
const fontPx = Math.floor(size * 0.2); // было 0.35, стало 0.25
|
|
198
199
|
ctx.font = `bold ${fontPx}px sans-serif`;
|
|
199
200
|
ctx.textAlign = 'center';
|
|
200
201
|
ctx.textBaseline = 'middle';
|
|
201
202
|
ctx.fillText(text.toUpperCase(), size / 2, size / 2);
|
|
203
|
+
|
|
202
204
|
const tex = new THREE.CanvasTexture(canvas);
|
|
203
205
|
tex.minFilter = THREE.LinearFilter;
|
|
204
206
|
tex.magFilter = THREE.LinearFilter;
|
|
@@ -209,8 +211,8 @@ export class NavCube {
|
|
|
209
211
|
const tex = makeFaceTexture(text);
|
|
210
212
|
if (!tex) return null;
|
|
211
213
|
const mat = new THREE.MeshBasicMaterial({ map: tex, transparent: true, depthTest: true, depthWrite: false });
|
|
212
|
-
// Уменьшаем
|
|
213
|
-
const plane = new THREE.Mesh(new THREE.PlaneGeometry(0.
|
|
214
|
+
// Уменьшаем размер плашки для лучшего размещения текста
|
|
215
|
+
const plane = new THREE.Mesh(new THREE.PlaneGeometry(0.98, 0.98), mat);
|
|
214
216
|
// Ориентируем плоскость, чтобы нормаль смотрела как normal
|
|
215
217
|
const q = new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 0, 1), normal);
|
|
216
218
|
plane.setRotationFromQuaternion(q);
|