@combeenation/3d-viewer 18.0.0 → 18.1.0-beta1
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/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/internal/screenshot-helper.d.ts +14 -0
- package/dist/lib-cjs/internal/screenshot-helper.js +100 -0
- package/dist/lib-cjs/internal/screenshot-helper.js.map +1 -0
- package/dist/lib-cjs/manager/camera-manager.d.ts +9 -1
- package/dist/lib-cjs/manager/camera-manager.js +18 -18
- package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
- package/dist/lib-cjs/manager/html-anchor-manager.js +14 -7
- package/dist/lib-cjs/manager/html-anchor-manager.js.map +1 -1
- package/package.json +11 -11
- package/src/internal/screenshot-helper.ts +102 -0
- package/src/manager/camera-manager.ts +26 -25
- package/src/manager/html-anchor-manager.ts +14 -7
|
@@ -82,8 +82,11 @@ export class HtmlAnchorManager {
|
|
|
82
82
|
parentHtmlElement,
|
|
83
83
|
anchorMesh,
|
|
84
84
|
viewer.scene.activeCamera!,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
// it's import to use `clientWidth` and `clientHeight` as it makes a difference on mobile devices that have
|
|
86
|
+
// hardware scaling activated
|
|
87
|
+
// => `width`/`height` return the upscaled values, but the basis html element for the anchors remains unscaled
|
|
88
|
+
canvas.clientWidth,
|
|
89
|
+
canvas.clientHeight,
|
|
87
90
|
1,
|
|
88
91
|
options
|
|
89
92
|
);
|
|
@@ -97,9 +100,7 @@ export class HtmlAnchorManager {
|
|
|
97
100
|
* mesh within the scene.
|
|
98
101
|
*/
|
|
99
102
|
public addHtmlAnchor(name: string, htmlElement: HTMLElement, position: Vector3, options?: HtmlAnchorOptions): void {
|
|
100
|
-
|
|
101
|
-
if (!canvasParentHtmlElement) {
|
|
102
|
-
console.warn(`No parent for desired html anchor available`);
|
|
103
|
+
if (!this.viewer.canvas) {
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
106
|
|
|
@@ -120,7 +121,10 @@ export class HtmlAnchorManager {
|
|
|
120
121
|
if (!enablePointerEvents) {
|
|
121
122
|
parentHtmlElement.style.pointerEvents = 'none';
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
+
// it's important to insert the html anchor elements right after the viewer canvas
|
|
125
|
+
// otherwise the elements could be in front of other sibling nodes, like the viewer control loading mask
|
|
126
|
+
// => see CB-10496
|
|
127
|
+
this.viewer.canvas.insertAdjacentElement('afterend', parentHtmlElement);
|
|
124
128
|
|
|
125
129
|
// NOTE: creates a sphere with fixed size, which could be problematic in scene with "strange" dimensions
|
|
126
130
|
// add a property for the sphere size if required
|
|
@@ -206,7 +210,10 @@ export class HtmlAnchorManager {
|
|
|
206
210
|
htmlContainer.append(clonedHtmlNode);
|
|
207
211
|
|
|
208
212
|
// reposition that cloned html element, so that it fits to the desired camera position
|
|
209
|
-
|
|
213
|
+
// `clientHeight`: makes difference on mobile devices that have hardware scaling activated
|
|
214
|
+
// => `height` returns the upscaled value, but the basis html element for the anchors remains
|
|
215
|
+
// unscaled
|
|
216
|
+
const baseScale = size.canvasHeight / this.viewer.canvas!.clientHeight;
|
|
210
217
|
this._updateHtmlAnchor(
|
|
211
218
|
clonedHtmlNode,
|
|
212
219
|
anchorMesh,
|