three-render-objects 1.36.1 → 1.37.1
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,6 +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>pointsHoverPrecision</b>([<i>int</i>]) | Getter/setter for the precision to use when detecting hover events over [Points](https://threejs.org/docs/#api/objects/Points) objects. | 1 |
|
|
89
90
|
| <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, an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) or [React JSX](https://react.dev/learn/writing-markup-with-jsx). ||
|
|
90
91
|
| <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
92
|
| <b>hoverDuringDrag([<i>boolean</i>]) | Getter/setter for whether to trigger hover events while using the controls via pointer dragging.| `false` |
|
|
@@ -68,6 +68,8 @@ declare class ThreeRenderObjectsGeneric<ChainableInstance> {
|
|
|
68
68
|
hoverFilter(filterFn: (obj: Object3D) => boolean): ChainableInstance;
|
|
69
69
|
lineHoverPrecision(): number;
|
|
70
70
|
lineHoverPrecision(precision: number): ChainableInstance;
|
|
71
|
+
pointsHoverPrecision(): number;
|
|
72
|
+
pointsHoverPrecision(precision: number): ChainableInstance;
|
|
71
73
|
tooltipContent(): Obj3DAccessor<string | HTMLElement | ReactHTMLElement<HTMLElement> | boolean>;
|
|
72
74
|
tooltipContent(contentAccessor: Obj3DAccessor<string | HTMLElement | ReactHTMLElement<HTMLElement> | boolean>): ChainableInstance;
|
|
73
75
|
enablePointerInteraction(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.37.1 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) :
|
|
@@ -77722,10 +77722,11 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77722
77722
|
"default": 1,
|
|
77723
77723
|
triggerUpdate: false
|
|
77724
77724
|
},
|
|
77725
|
+
pointsHoverPrecision: {
|
|
77726
|
+
"default": 1,
|
|
77727
|
+
triggerUpdate: false
|
|
77728
|
+
},
|
|
77725
77729
|
hoverOrderComparator: {
|
|
77726
|
-
"default": function _default() {
|
|
77727
|
-
return -1;
|
|
77728
|
-
},
|
|
77729
77730
|
triggerUpdate: false
|
|
77730
77731
|
},
|
|
77731
77732
|
// keep existing order by default
|
|
@@ -77775,7 +77776,8 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77775
77776
|
if (state.hoverDuringDrag || !state.isPointerDragging) {
|
|
77776
77777
|
var intersects = this.intersectingObjects(state.pointerPos.x, state.pointerPos.y).filter(function (d) {
|
|
77777
77778
|
return state.hoverFilter(d.object);
|
|
77778
|
-
})
|
|
77779
|
+
});
|
|
77780
|
+
state.hoverOrderComparator && intersects.sort(function (a, b) {
|
|
77779
77781
|
return state.hoverOrderComparator(a.object, b.object);
|
|
77780
77782
|
});
|
|
77781
77783
|
var topIntersect = intersects.length ? intersects[0] : null;
|
|
@@ -77927,6 +77929,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77927
77929
|
var relCoords = new three.Vector2(x / state.width * 2 - 1, -(y / state.height) * 2 + 1);
|
|
77928
77930
|
var raycaster = new three.Raycaster();
|
|
77929
77931
|
raycaster.params.Line.threshold = state.lineHoverPrecision; // set linePrecision
|
|
77932
|
+
raycaster.params.Points.threshold = state.pointsHoverPrecision; // set pointsPrecision
|
|
77930
77933
|
raycaster.setFromCamera(relCoords, state.camera);
|
|
77931
77934
|
return raycaster.intersectObjects(state.objects, true);
|
|
77932
77935
|
},
|