three-render-objects 1.33.1 → 1.34.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/README.md
CHANGED
|
@@ -86,7 +86,7 @@ new ThreeRenderObjects(<domElement>, { configOptions })
|
|
|
86
86
|
| <b>hoverOrderComparator</b>([<i>fn</i>]) | Getter/setter for the comparator function to use when hovering over multiple objects under the same line of sight. This function can be used to prioritize hovering some objects over others. | By default, hovering priority is based solely on camera proximity (closest object wins). |
|
|
87
87
|
| <b>hoverFilter</b>([<i>fn</i>]) | Getter/setter for the filter function that defines whether an object is eligible for hovering and other interactions. This function receives an object as sole argument and should return a `boolean` value | `() => true` |
|
|
88
88
|
| <b>lineHoverPrecision</b>([<i>int</i>]) | Getter/setter for the precision to use when detecting hover events over [Line](https://threejs.org/docs/#api/objects/Line) objects. | 1 |
|
|
89
|
-
| <b>tooltipContent</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for label (shown in tooltip). Supports plain text or HTML
|
|
89
|
+
| <b>tooltipContent</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for label (shown in tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). ||
|
|
90
90
|
| <b>enablePointerInteraction([<i>boolean</i>]) | Getter/setter for whether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click and tooltip labels, at the cost of performance. If you're looking for maximum gain in your render performance it's recommended to switch off this property. | `true` |
|
|
91
91
|
| <b>hoverDuringDrag([<i>boolean</i>]) | Getter/setter for whether to trigger hover events while using the controls via pointer dragging.| `false` |
|
|
92
92
|
| <b>clickAfterDrag([<i>boolean</i>]) | Getter/setter for whether to trigger a click event after dragging using the controls.| `false` |
|
|
@@ -67,8 +67,8 @@ declare class ThreeRenderObjectsGeneric<ChainableInstance> {
|
|
|
67
67
|
hoverFilter(filterFn: (obj: Object3D) => boolean): ChainableInstance;
|
|
68
68
|
lineHoverPrecision(): number;
|
|
69
69
|
lineHoverPrecision(precision: number): ChainableInstance;
|
|
70
|
-
tooltipContent(): Obj3DAccessor<string>;
|
|
71
|
-
tooltipContent(contentAccessor: Obj3DAccessor<string>): ChainableInstance;
|
|
70
|
+
tooltipContent(): Obj3DAccessor<string | HTMLElement>;
|
|
71
|
+
tooltipContent(contentAccessor: Obj3DAccessor<string | HTMLElement>): ChainableInstance;
|
|
72
72
|
enablePointerInteraction(): boolean;
|
|
73
73
|
enablePointerInteraction(enable: boolean): ChainableInstance;
|
|
74
74
|
hoverDuringDrag(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.34.0 three-render-objects - https://github.com/vasturiano/three-render-objects
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['three'], factory) :
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var css_248z$1 = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n
|
|
35
|
+
var css_248z$1 = ".scene-nav-info {\n position: absolute;\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
36
36
|
styleInject$1(css_248z$1);
|
|
37
37
|
|
|
38
38
|
function _arrayLikeToArray$2(r, a) {
|
|
@@ -77510,7 +77510,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77510
77510
|
}
|
|
77511
77511
|
}
|
|
77512
77512
|
|
|
77513
|
-
var css_248z = ".float-tooltip-kap {\n position: absolute;\n padding:
|
|
77513
|
+
var css_248z = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n max-width: max(50%, 150px);\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
|
|
77514
77514
|
styleInject(css_248z);
|
|
77515
77515
|
|
|
77516
77516
|
var index = index$1({
|
|
@@ -77525,6 +77525,9 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77525
77525
|
style = _ref$style === undefined ? {} : _ref$style;
|
|
77526
77526
|
var isD3Selection = !!domNode && _typeof(domNode) === 'object' && !!domNode.node && typeof domNode.node === 'function';
|
|
77527
77527
|
var el = select(isD3Selection ? domNode.node() : domNode);
|
|
77528
|
+
|
|
77529
|
+
// make sure container is positioned, to provide anchor for tooltip
|
|
77530
|
+
el.style('position') === 'static' && el.style('position', 'relative');
|
|
77528
77531
|
state.tooltipEl = el.append('div').attr('class', 'float-tooltip-kap');
|
|
77529
77532
|
Object.entries(style).forEach(function (_ref2) {
|
|
77530
77533
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
@@ -77533,7 +77536,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77533
77536
|
return state.tooltipEl.style(k, v);
|
|
77534
77537
|
});
|
|
77535
77538
|
state.tooltipEl // start off-screen
|
|
77536
|
-
.style('left', '-
|
|
77539
|
+
.style('left', '-10000px').style('display', 'none');
|
|
77537
77540
|
state.mouseInside = false;
|
|
77538
77541
|
el.on('mousemove.tooltip', function (ev) {
|
|
77539
77542
|
state.mouseInside = true;
|
|
@@ -77545,7 +77548,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77545
77548
|
// adjust horizontal position to not exceed canvas boundaries
|
|
77546
77549
|
.style('transform', "translate(-".concat(mousePos[0] / canvasWidth * 100, "%, ").concat(
|
|
77547
77550
|
// flip to above if near bottom
|
|
77548
|
-
canvasHeight - mousePos[1] < 100 ? 'calc(-100% - 6px)' : '21px', ")"));
|
|
77551
|
+
canvasHeight > 130 && canvasHeight - mousePos[1] < 100 ? 'calc(-100% - 6px)' : '21px', ")"));
|
|
77549
77552
|
});
|
|
77550
77553
|
el.on('mouseover.tooltip', function () {
|
|
77551
77554
|
state.mouseInside = true;
|
|
@@ -77558,7 +77561,14 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77558
77561
|
},
|
|
77559
77562
|
update: function update(state) {
|
|
77560
77563
|
state.tooltipEl.style('display', !!state.content && state.mouseInside ? 'inline' : 'none');
|
|
77561
|
-
|
|
77564
|
+
if (state.content instanceof HTMLElement) {
|
|
77565
|
+
state.tooltipEl.text(''); // empty it
|
|
77566
|
+
state.tooltipEl.append(function () {
|
|
77567
|
+
return state.content;
|
|
77568
|
+
});
|
|
77569
|
+
} else {
|
|
77570
|
+
state.tooltipEl.html(state.content || '');
|
|
77571
|
+
}
|
|
77562
77572
|
}
|
|
77563
77573
|
});
|
|
77564
77574
|
|