@vertexvis/viewer 0.21.0-testing.1 → 0.21.0-testing.2
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +28 -27
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js +12 -10
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.css +4 -8
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js +33 -16
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js.map +1 -1
- package/dist/components/vertex-viewer-transform-widget.js +29 -27
- package/dist/components/vertex-viewer-transform-widget.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/vertex-viewer-transform-widget.entry.js +28 -27
- package/dist/esm/vertex-viewer-transform-widget.entry.js.map +1 -1
- package/dist/esm/viewer.js +1 -1
- package/dist/types/components/viewer-transform-widget/viewer-transform-widget.d.ts +5 -1
- package/dist/types/components.d.ts +8 -0
- package/dist/viewer/p-24b66b64.entry.js +5 -0
- package/dist/viewer/p-24b66b64.entry.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/dist/viewer/viewer.esm.js.map +1 -1
- package/package.json +7 -7
- package/dist/viewer/p-3047c5f9.entry.js +0 -5
- package/dist/viewer/p-3047c5f9.entry.js.map +0 -1
|
@@ -154,7 +154,7 @@ const TransformWidgetInput = ({ ref, bounds, viewport, point, placement, distanc
|
|
|
154
154
|
const units = new DistanceUnits(distanceUnit);
|
|
155
155
|
const definedValue = (_a = distance !== null && distance !== void 0 ? distance : angle) !== null && _a !== void 0 ? _a : 0;
|
|
156
156
|
const displayValue = `${parseFloat(definedValue.toFixed(decimalPlaces))} ${distance != null ? units.unit.abbreviatedName : angles.unit.abbreviatedName}`;
|
|
157
|
-
const inputPlacement =
|
|
157
|
+
const inputPlacement = constrainInputToViewport(viewport, bounds !== null && bounds !== void 0 ? bounds : dimensions.create(0, 0), point, placement);
|
|
158
158
|
const handleChange = (event) => {
|
|
159
159
|
if (event.target != null) {
|
|
160
160
|
const parsed = parseFloat(event.target.value);
|
|
@@ -177,32 +177,34 @@ const TransformWidgetInput = ({ ref, bounds, viewport, point, placement, distanc
|
|
|
177
177
|
function constrainTo(dimension, length) {
|
|
178
178
|
return Math.min(dimension, Math.max(0, length));
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function constrainInputToViewport(viewport, inputDimensions, point, placement, padding = 5) {
|
|
181
181
|
const { width, height } = viewport.dimensions;
|
|
182
|
+
const paddedWidth = inputDimensions.width + padding;
|
|
183
|
+
const paddedHeight = inputDimensions.height + padding;
|
|
182
184
|
function toCssLength(length) {
|
|
183
185
|
return `${length}px`;
|
|
184
186
|
}
|
|
185
187
|
switch (placement) {
|
|
186
188
|
case 'top-left':
|
|
187
189
|
return {
|
|
188
|
-
right: toCssLength(constrainTo(width -
|
|
189
|
-
bottom: toCssLength(constrainTo(height -
|
|
190
|
+
right: toCssLength(constrainTo(width - paddedWidth, width - point.x)),
|
|
191
|
+
bottom: toCssLength(constrainTo(height - paddedHeight, height - point.y)),
|
|
190
192
|
};
|
|
191
193
|
case 'top-right':
|
|
192
194
|
return {
|
|
193
|
-
left: toCssLength(constrainTo(width -
|
|
194
|
-
bottom: toCssLength(constrainTo(height -
|
|
195
|
+
left: toCssLength(constrainTo(width - paddedWidth, point.x)),
|
|
196
|
+
bottom: toCssLength(constrainTo(height - paddedHeight, height - point.y)),
|
|
195
197
|
};
|
|
196
198
|
case 'bottom-left':
|
|
197
199
|
return {
|
|
198
|
-
right: toCssLength(constrainTo(width -
|
|
199
|
-
top: toCssLength(constrainTo(height -
|
|
200
|
+
right: toCssLength(constrainTo(width - paddedWidth, width - point.x)),
|
|
201
|
+
top: toCssLength(constrainTo(height - paddedHeight, point.y)),
|
|
200
202
|
};
|
|
201
203
|
case 'bottom-right':
|
|
202
204
|
default:
|
|
203
205
|
return {
|
|
204
|
-
left: toCssLength(constrainTo(width -
|
|
205
|
-
top: toCssLength(constrainTo(height -
|
|
206
|
+
left: toCssLength(constrainTo(width - paddedWidth, point.x)),
|
|
207
|
+
top: toCssLength(constrainTo(height - paddedHeight, point.y)),
|
|
206
208
|
};
|
|
207
209
|
}
|
|
208
210
|
}
|
|
@@ -543,7 +545,7 @@ class TransformWidget extends ReglComponent {
|
|
|
543
545
|
}
|
|
544
546
|
}
|
|
545
547
|
|
|
546
|
-
const viewerTransformWidgetCss = ":host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:7em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;
|
|
548
|
+
const viewerTransformWidgetCss = ":host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:7em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;border:1px solid #cccccc;width:var(--viewer-transform-widget-input-width)}input.widget-input{box-sizing:border-box;text-align:center;border:none;width:100%;outline:none}input.widget-input:focus{outline:none}";
|
|
547
549
|
|
|
548
550
|
const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
549
551
|
constructor() {
|
|
@@ -578,6 +580,11 @@ const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
578
580
|
* Determines whether or not the z-translation is disabled on the widget
|
|
579
581
|
*/
|
|
580
582
|
this.zTranslationDisabled = false;
|
|
583
|
+
/**
|
|
584
|
+
* Whether to show inputs beside the widget handles when they are interacted with.
|
|
585
|
+
* Defaults to `true`.
|
|
586
|
+
*/
|
|
587
|
+
this.showInputs = true;
|
|
581
588
|
/**
|
|
582
589
|
* The unit to show for translation inputs. Defaults to `millimeters`.
|
|
583
590
|
*
|
|
@@ -852,14 +859,17 @@ const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
852
859
|
};
|
|
853
860
|
this.updateInputPosition = () => {
|
|
854
861
|
var _a, _b;
|
|
855
|
-
const widget = this.getTransformWidget();
|
|
856
|
-
const widgetBounds = widget.getFullBounds();
|
|
857
862
|
const dragging = (_a = this.dragging) !== null && _a !== void 0 ? _a : this.lastDragged;
|
|
858
|
-
if (
|
|
863
|
+
if (this.showInputs &&
|
|
864
|
+
((_b = this.viewer) === null || _b === void 0 ? void 0 : _b.frame) != null &&
|
|
859
865
|
this.position != null &&
|
|
860
|
-
dragging != null
|
|
861
|
-
|
|
862
|
-
|
|
866
|
+
dragging != null) {
|
|
867
|
+
const widget = this.getTransformWidget();
|
|
868
|
+
const widgetBounds = widget.getFullBounds();
|
|
869
|
+
this.inputPosition =
|
|
870
|
+
widgetBounds != null
|
|
871
|
+
? computeInputPosition(this.viewer.viewport, widgetBounds, dragging.points.toArray())
|
|
872
|
+
: undefined;
|
|
863
873
|
}
|
|
864
874
|
};
|
|
865
875
|
this.getDisplayedAngle = () => {
|
|
@@ -931,7 +941,6 @@ const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
931
941
|
});
|
|
932
942
|
this.handleViewerChanged(this.viewer, undefined);
|
|
933
943
|
this.handleStyleChange();
|
|
934
|
-
this.handleInputResize();
|
|
935
944
|
}
|
|
936
945
|
disconnectedCallback() {
|
|
937
946
|
var _a, _b, _c, _d, _e;
|
|
@@ -1012,9 +1021,7 @@ const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
1012
1021
|
this.canvasRef = el;
|
|
1013
1022
|
}, class: classnames('widget', {
|
|
1014
1023
|
hovered: this.hovered != null,
|
|
1015
|
-
}), width: (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.viewport.width, height: (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.viewport.height, onPointerDown: this.handleBeginDrag }), this.inputPosition &&
|
|
1016
|
-
this.inputValue != null &&
|
|
1017
|
-
((_c = this.viewer) === null || _c === void 0 ? void 0 : _c.viewport) && (h(TransformWidgetInput, { ref: (el) => {
|
|
1024
|
+
}), width: (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.viewport.width, height: (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.viewport.height, onPointerDown: this.handleBeginDrag }), this.showInputs && this.inputPosition && ((_c = this.viewer) === null || _c === void 0 ? void 0 : _c.viewport) && (h(TransformWidgetInput, { ref: (el) => {
|
|
1018
1025
|
var _a, _b;
|
|
1019
1026
|
if (el != null) {
|
|
1020
1027
|
(_a = this.inputResizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el);
|
|
@@ -1053,12 +1060,6 @@ const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
1053
1060
|
console.warn('Cannot set disabled values - no widget defined');
|
|
1054
1061
|
}
|
|
1055
1062
|
}
|
|
1056
|
-
get currentRotation() {
|
|
1057
|
-
if (this.currentTransform != null) {
|
|
1058
|
-
return matrix4.makeRotation(quaternion.fromMatrixRotation(this.currentTransform));
|
|
1059
|
-
}
|
|
1060
|
-
return matrix4.makeIdentity();
|
|
1061
|
-
}
|
|
1062
1063
|
get hostEl() { return this; }
|
|
1063
1064
|
static get watchers() { return {
|
|
1064
1065
|
"viewer": ["handleViewerChanged"],
|
|
@@ -1083,6 +1084,7 @@ const ViewerTransformWidget = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
1083
1084
|
"xTranslationDisabled": [1028, "x-translation-disabled"],
|
|
1084
1085
|
"yTranslationDisabled": [1028, "y-translation-disabled"],
|
|
1085
1086
|
"zTranslationDisabled": [1028, "z-translation-disabled"],
|
|
1087
|
+
"showInputs": [4, "show-inputs"],
|
|
1086
1088
|
"distanceUnit": [1, "distance-unit"],
|
|
1087
1089
|
"angleUnit": [1, "angle-unit"],
|
|
1088
1090
|
"decimalPlaces": [2, "decimal-places"],
|