three-render-objects 1.34.0 → 1.36.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
|
@@ -80,13 +80,13 @@ new ThreeRenderObjects(<domElement>, { configOptions })
|
|
|
80
80
|
|
|
81
81
|
| Method | Description | Default |
|
|
82
82
|
| --- | --- | :--: |
|
|
83
|
-
| <b>onClick</b>(<i>fn</i>) | Callback function for object clicks with left mouse button. The object (or `null` if there's no object under the mouse line of sight), the event object and the
|
|
84
|
-
| <b>onRightClick</b>(<i>fn</i>) | Callback function for object right-clicks. The object (or `null` if there's no object under the mouse line of sight), the event object and the
|
|
85
|
-
| <b>onHover</b>(<i>fn</i>) | Callback function for object mouse over events. The object (or `null` if there's no object under the mouse line of sight)
|
|
83
|
+
| <b>onClick</b>(<i>fn</i>) | Callback function for object clicks with left mouse button. The object (or `null` if there's no object under the mouse line of sight), the event object and the intersection object are included as arguments `onClick(object, event, intersection)`. | - |
|
|
84
|
+
| <b>onRightClick</b>(<i>fn</i>) | Callback function for object right-clicks. The object (or `null` if there's no object under the mouse line of sight), the event object and the intersection object are included as arguments `onRightClick(object, event, intersection)`. | - |
|
|
85
|
+
| <b>onHover</b>(<i>fn</i>) | Callback function for object mouse over events. The object (or `null` if there's no object under the mouse line of sight), the previous hovered object (or `null`) and the intersection object are included as arguments: `onHover(obj, prevObj, intersection)`. | - |
|
|
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, HTML string content
|
|
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, 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
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` |
|
|
@@ -3,6 +3,7 @@ import { TrackballControls } from 'three/examples/jsm/controls/TrackballControls
|
|
|
3
3
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
4
4
|
import { FlyControls } from 'three/examples/jsm/controls/FlyControls.js';
|
|
5
5
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
6
|
+
import { ReactHTMLElement } from 'react';
|
|
6
7
|
|
|
7
8
|
interface ConfigOptions {
|
|
8
9
|
controlType?: 'trackball' | 'orbit' | 'fly';
|
|
@@ -58,17 +59,17 @@ declare class ThreeRenderObjectsGeneric<ChainableInstance> {
|
|
|
58
59
|
controls(): TrackballControls | OrbitControls | FlyControls;
|
|
59
60
|
|
|
60
61
|
// Interaction
|
|
61
|
-
onClick(callback: (obj: object | null, event: MouseEvent,
|
|
62
|
-
onRightClick(callback: (obj: object | null, event: MouseEvent,
|
|
63
|
-
onHover(callback: (obj: object | null, previousObj: object | null) => void): ChainableInstance;
|
|
62
|
+
onClick(callback: (obj: object | null, event: MouseEvent, intersection: Intersection) => void): ChainableInstance;
|
|
63
|
+
onRightClick(callback: (obj: object | null, event: MouseEvent, intersection: Intersection) => void): ChainableInstance;
|
|
64
|
+
onHover(callback: (obj: object | null, previousObj: object | null, intersection: Intersection | null) => void): ChainableInstance;
|
|
64
65
|
hoverOrderComparator(): Obj3DCompFn;
|
|
65
66
|
hoverOrderComparator(compFn: Obj3DCompFn): ChainableInstance;
|
|
66
67
|
hoverFilter(): (obj: Object3D) => boolean;
|
|
67
68
|
hoverFilter(filterFn: (obj: Object3D) => boolean): ChainableInstance;
|
|
68
69
|
lineHoverPrecision(): number;
|
|
69
70
|
lineHoverPrecision(precision: number): ChainableInstance;
|
|
70
|
-
tooltipContent(): Obj3DAccessor<string | HTMLElement>;
|
|
71
|
-
tooltipContent(contentAccessor: Obj3DAccessor<string | HTMLElement>): ChainableInstance;
|
|
71
|
+
tooltipContent(): Obj3DAccessor<string | HTMLElement | ReactHTMLElement<HTMLElement> | boolean>;
|
|
72
|
+
tooltipContent(contentAccessor: Obj3DAccessor<string | HTMLElement | ReactHTMLElement<HTMLElement> | boolean>): ChainableInstance;
|
|
72
73
|
enablePointerInteraction(): boolean;
|
|
73
74
|
enablePointerInteraction(enable: boolean): ChainableInstance;
|
|
74
75
|
hoverDuringDrag(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.36.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) :
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
function _arrayWithoutHoles(r) {
|
|
47
47
|
if (Array.isArray(r)) return _arrayLikeToArray$2(r);
|
|
48
48
|
}
|
|
49
|
-
function _defineProperty(e, r, t) {
|
|
50
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
49
|
+
function _defineProperty$1(e, r, t) {
|
|
50
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
51
51
|
value: t,
|
|
52
52
|
enumerable: true,
|
|
53
53
|
configurable: true,
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
function _toConsumableArray(r) {
|
|
94
94
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
|
|
95
95
|
}
|
|
96
|
-
function _toPrimitive(t, r) {
|
|
96
|
+
function _toPrimitive$1(t, r) {
|
|
97
97
|
if ("object" != typeof t || !t) return t;
|
|
98
98
|
var e = t[Symbol.toPrimitive];
|
|
99
99
|
if (undefined !== e) {
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
}
|
|
104
104
|
return ("string" === r ? String : Number)(t);
|
|
105
105
|
}
|
|
106
|
-
function _toPropertyKey(t) {
|
|
107
|
-
var i = _toPrimitive(t, "string");
|
|
106
|
+
function _toPropertyKey$1(t) {
|
|
107
|
+
var i = _toPrimitive$1(t, "string");
|
|
108
108
|
return "symbol" == typeof i ? i : i + "";
|
|
109
109
|
}
|
|
110
110
|
function _unsupportedIterableToArray$2(r, a) {
|
|
@@ -77430,6 +77430,8 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77430
77430
|
return [event.pageX, event.pageY];
|
|
77431
77431
|
}
|
|
77432
77432
|
|
|
77433
|
+
var n,l,u,t,i,r,o,e,f,c,s,a,p={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d=Array.isArray;function w(n,l){for(var u in l)n[u]=l[u];return n}function _(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function g(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) undefined===e[o]&&(e[o]=l.defaultProps[o]);return m(l,e,i,r,null)}function m(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:undefined,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function k(n){return n.children}function x(n,l){this.props=n,this.context=l;}function C(n,l){if(null==l)return n.__?C(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?C(n):null}function S(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return S(n)}}function M(n){(!n.__d&&(n.__d=true)&&i.push(n)&&!P.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||o)(P);}function P(){var n,u,t,r,o,f,c,s;for(i.sort(e);n=i.shift();)n.__d&&(u=i.length,r=undefined,f=(o=(t=n).__v).__e,c=[],s=[],t.__P&&((r=w({},o)).__v=o.__v+1,l.vnode&&l.vnode(r),j(t.__P,r,o,t.__n,t.__P.namespaceURI,32&o.__u?[f]:null,c,null==f?C(o):f,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,z(c,r,s),r.__e!=f&&S(r)),i.length>u&&i.sort(e));P.__r=0;}function $(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,d,w,_,g=t&&t.__k||v,m=l.length;for(f=I(u,l,g,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1===y.__i?p:g[y.__i]||p,y.__i=a,_=j(n,y,h,i,r,o,e,f,c,s),d=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&V(h.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),4&y.__u||h.__k===y.__k?f=A(y,f,n):"function"==typeof y.type&&undefined!==_?f=_:d&&(f=d.nextSibling),y.__u&=-7);return u.__e=w,f}function I(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m(null,o,null,null,null):d(o)?m(k,{children:o},null,null,null):undefined===o.constructor&&o.__b>0?m(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!==(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null===e.__v?(-1==c&&h--,"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=C(e)),q(e,e));return t}function A(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=A(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=C(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o=n.key,e=n.type,f=l[u];if(null===f||f&&o==f.key&&e===f.type&&0==(2&f.__u))return u;if(t>(null!=f&&0==(2&f.__u)?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e===f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e===f.type)return r;r++;}}return -1}function T(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y.test(l)?u:u+"px";}function F(n,l,u,t,i){var r;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c,n.addEventListener(l,r?a:s,r)):n.removeEventListener(l,r?a:s,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function O(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c++;else if(u.t<t.u)return;return t(l.event?l.event(u):u)}}}function j(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,g,m,b,C,S,M,P,I,A,H,L,T,F=u.type;if(undefined!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof F)try{if(b=u.props,C="prototype"in F&&F.prototype.render,S=(a=F.contextType)&&i[a.__c],M=a?S?S.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(C?u.__c=h=new F(b,M):(u.__c=h=new x(b,M),h.constructor=F,h.render=B),S&&S.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),C&&null==h.__s&&(h.__s=h.state),C&&null!=F.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=w({},h.__s)),w(h.__s,F.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)C&&null==F.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),C&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(C&&null==F.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v)){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),P=0;P<h._sb.length;P++)h.__h.push(h._sb[P]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),C&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,g);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,I=l.__r,A=0,C){for(h.state=h.__s,h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),C&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(v,y)),f=$(n,d(L=null!=a&&a.type===k&&null==a.key?a.props.children:a)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else for(T=o.length;T--;)_(o[T]);else u.__e=t.__e,u.__k=t.__k;l.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=N(t.__e,u,t,i,r,o,e,c,s);return (a=l.diffed)&&a(u),128&u.__u?undefined:f}function z(n,u,t){for(var i=0;i<t.length;i++)V(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function N(u,t,i,r,o,e,f,c,s){var a,h,v,y,w,g,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((w=e[a])&&"setAttribute"in w==!!x&&(x?w.localName==x:3==w.nodeType)){u=w,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=false),e=null;}if(null===x)b===k||c&&u.data===k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(w=u.attributes[a]).name]=w.value;for(a in b)if(w=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=w;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;F(u,a,null,w,o);}for(a in k)w=k[a],"children"==a?y=w:"dangerouslySetInnerHTML"==a?h=w:"value"==a?g=w:"checked"==a?m=w:c&&"function"!=typeof w||b[a]===w||F(u,a,w,b[a],o);if(h)c||v&&(h.__html===v.__html||h.__html===u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),$(u,d(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&C(i,0),c,s),null!=e)for(a=e.length;a--;)_(e[a]);c||(a="value","progress"==x&&null==g?u.removeAttribute("value"):undefined!==g&&(g!==u[a]||"progress"==x&&!g||"option"==x&&g!==b[a])&&F(u,a,g,b[a],o),a="checked",undefined!==m&&m!==u[a]&&F(u,a,m,b[a],o));}return u}function V(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l.__e(n,t);}}function q(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||V(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&q(i[r],u,t||"function"!=typeof n.type);t||_(n.__e),n.__c=n.__=n.__e=undefined;}function B(n,l,u){return this.constructor(n,u)}function D(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"=="undefined")?null:t.__k,e=[],f=[],j(t,u=(t).__k=g(k,null,[u]),o||p,p,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),z(e,u,f);}function G(l,u,t){var i,r,o,e,f=w({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=undefined===u[o]&&undefined!==e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),m(l.type,f,i||l.key,r||l.ref,null)}n=v.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},x.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=w({},this.state),"function"==typeof n&&(n=n(w({},u),this.props)),n&&w(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x.prototype.render=k,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},P.__r=0,f=/(PointerCapture)$|Capture$/i,c=0,s=O(false),a=O(true);
|
|
77434
|
+
|
|
77433
77435
|
function _arrayLikeToArray(r, a) {
|
|
77434
77436
|
(null == a || a > r.length) && (a = r.length);
|
|
77435
77437
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -77438,6 +77440,14 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77438
77440
|
function _arrayWithHoles(r) {
|
|
77439
77441
|
if (Array.isArray(r)) return r;
|
|
77440
77442
|
}
|
|
77443
|
+
function _defineProperty(e, r, t) {
|
|
77444
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
77445
|
+
value: t,
|
|
77446
|
+
enumerable: true,
|
|
77447
|
+
configurable: true,
|
|
77448
|
+
writable: true
|
|
77449
|
+
}) : e[r] = t, e;
|
|
77450
|
+
}
|
|
77441
77451
|
function _iterableToArrayLimit(r, l) {
|
|
77442
77452
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
77443
77453
|
if (null != t) {
|
|
@@ -77465,9 +77475,44 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77465
77475
|
function _nonIterableRest() {
|
|
77466
77476
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77467
77477
|
}
|
|
77478
|
+
function ownKeys(e, r) {
|
|
77479
|
+
var t = Object.keys(e);
|
|
77480
|
+
if (Object.getOwnPropertySymbols) {
|
|
77481
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
77482
|
+
r && (o = o.filter(function (r) {
|
|
77483
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
77484
|
+
})), t.push.apply(t, o);
|
|
77485
|
+
}
|
|
77486
|
+
return t;
|
|
77487
|
+
}
|
|
77488
|
+
function _objectSpread2(e) {
|
|
77489
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
77490
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
77491
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
77492
|
+
_defineProperty(e, r, t[r]);
|
|
77493
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
77494
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
77495
|
+
});
|
|
77496
|
+
}
|
|
77497
|
+
return e;
|
|
77498
|
+
}
|
|
77468
77499
|
function _slicedToArray(r, e) {
|
|
77469
77500
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
77470
77501
|
}
|
|
77502
|
+
function _toPrimitive(t, r) {
|
|
77503
|
+
if ("object" != typeof t || !t) return t;
|
|
77504
|
+
var e = t[Symbol.toPrimitive];
|
|
77505
|
+
if (undefined !== e) {
|
|
77506
|
+
var i = e.call(t, r || "default");
|
|
77507
|
+
if ("object" != typeof i) return i;
|
|
77508
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
77509
|
+
}
|
|
77510
|
+
return ("string" === r ? String : Number)(t);
|
|
77511
|
+
}
|
|
77512
|
+
function _toPropertyKey(t) {
|
|
77513
|
+
var i = _toPrimitive(t, "string");
|
|
77514
|
+
return "symbol" == typeof i ? i : i + "";
|
|
77515
|
+
}
|
|
77471
77516
|
function _typeof(o) {
|
|
77472
77517
|
"@babel/helpers - typeof";
|
|
77473
77518
|
|
|
@@ -77485,6 +77530,27 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77485
77530
|
}
|
|
77486
77531
|
}
|
|
77487
77532
|
|
|
77533
|
+
var _reactElement2VNode = function reactElement2VNode(el) {
|
|
77534
|
+
// Among other things, react VNodes (and all its children) need to have constructor: undefined attributes in order to be recognised, cloneElement (applied recursively) does the necessary conversion
|
|
77535
|
+
if (!(_typeof(el) === 'object')) return el;
|
|
77536
|
+
var res = G(el);
|
|
77537
|
+
if (res.props) {
|
|
77538
|
+
var _res$props;
|
|
77539
|
+
res.props = _objectSpread2({}, res.props);
|
|
77540
|
+
if (res !== null && res !== undefined && (_res$props = res.props) !== null && _res$props !== undefined && _res$props.children) {
|
|
77541
|
+
res.props.children = Array.isArray(res.props.children) ? res.props.children.map(_reactElement2VNode) : _reactElement2VNode(res.props.children);
|
|
77542
|
+
}
|
|
77543
|
+
}
|
|
77544
|
+
return res;
|
|
77545
|
+
};
|
|
77546
|
+
var isReactRenderable = function isReactRenderable(o) {
|
|
77547
|
+
return t(G(o));
|
|
77548
|
+
};
|
|
77549
|
+
var render = function render(jsx, domEl) {
|
|
77550
|
+
delete domEl.__k; // Wipe traces of previous preact renders
|
|
77551
|
+
D(_reactElement2VNode(jsx), domEl);
|
|
77552
|
+
};
|
|
77553
|
+
|
|
77488
77554
|
function styleInject(css, ref) {
|
|
77489
77555
|
if (ref === undefined) ref = {};
|
|
77490
77556
|
var insertAt = ref.insertAt;
|
|
@@ -77517,7 +77583,14 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77517
77583
|
props: {
|
|
77518
77584
|
content: {
|
|
77519
77585
|
"default": false
|
|
77520
|
-
}
|
|
77586
|
+
},
|
|
77587
|
+
offsetX: {
|
|
77588
|
+
triggerUpdate: false
|
|
77589
|
+
},
|
|
77590
|
+
// null or number
|
|
77591
|
+
offsetY: {
|
|
77592
|
+
triggerUpdate: false
|
|
77593
|
+
} // null or number
|
|
77521
77594
|
},
|
|
77522
77595
|
init: function init(domNode, state) {
|
|
77523
77596
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
@@ -77537,37 +77610,48 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77537
77610
|
});
|
|
77538
77611
|
state.tooltipEl // start off-screen
|
|
77539
77612
|
.style('left', '-10000px').style('display', 'none');
|
|
77613
|
+
var evSuffix = "tooltip-".concat(Math.round(Math.random() * 1e12));
|
|
77540
77614
|
state.mouseInside = false;
|
|
77541
|
-
el.on(
|
|
77615
|
+
el.on("mousemove.".concat(evSuffix), function (ev) {
|
|
77542
77616
|
state.mouseInside = true;
|
|
77543
77617
|
var mousePos = pointer(ev);
|
|
77544
77618
|
var domNode = el.node();
|
|
77545
77619
|
var canvasWidth = domNode.offsetWidth;
|
|
77546
77620
|
var canvasHeight = domNode.offsetHeight;
|
|
77547
|
-
state.
|
|
77548
|
-
// adjust horizontal position to not exceed canvas boundaries
|
|
77549
|
-
|
|
77550
|
-
// flip to above if near bottom
|
|
77551
|
-
canvasHeight > 130 && canvasHeight - mousePos[1] < 100 ? 'calc(-100% - 6px)' : '21px', ")"));
|
|
77621
|
+
var translate = [state.offsetX === null || state.offsetX === undefined
|
|
77622
|
+
// auto: adjust horizontal position to not exceed canvas boundaries
|
|
77623
|
+
? "-".concat(mousePos[0] / canvasWidth * 100, "%") : typeof state.offsetX === 'number' ? "calc(-50% + ".concat(state.offsetX, "px)") : state.offsetX, state.offsetY === null || state.offsetY === undefined
|
|
77624
|
+
// auto: flip to above if near bottom
|
|
77625
|
+
? canvasHeight > 130 && canvasHeight - mousePos[1] < 100 ? 'calc(-100% - 6px)' : '21px' : typeof state.offsetY === 'number' ? state.offsetY < 0 ? "calc(-100% - ".concat(Math.abs(state.offsetY), "px)") : "".concat(state.offsetY, "px") : state.offsetY];
|
|
77626
|
+
state.tooltipEl.style('left', mousePos[0] + 'px').style('top', mousePos[1] + 'px').style('transform', "translate(".concat(translate.join(','), ")"));
|
|
77627
|
+
state.content && state.tooltipEl.style('display', 'inline');
|
|
77552
77628
|
});
|
|
77553
|
-
el.on(
|
|
77629
|
+
el.on("mouseover.".concat(evSuffix), function () {
|
|
77554
77630
|
state.mouseInside = true;
|
|
77555
77631
|
state.content && state.tooltipEl.style('display', 'inline');
|
|
77556
77632
|
});
|
|
77557
|
-
el.on(
|
|
77633
|
+
el.on("mouseout.".concat(evSuffix), function () {
|
|
77558
77634
|
state.mouseInside = false;
|
|
77559
77635
|
state.tooltipEl.style('display', 'none');
|
|
77560
77636
|
});
|
|
77561
77637
|
},
|
|
77562
77638
|
update: function update(state) {
|
|
77563
77639
|
state.tooltipEl.style('display', !!state.content && state.mouseInside ? 'inline' : 'none');
|
|
77564
|
-
if (state.content
|
|
77640
|
+
if (!state.content) {
|
|
77641
|
+
state.tooltipEl.text('');
|
|
77642
|
+
} else if (state.content instanceof HTMLElement) {
|
|
77565
77643
|
state.tooltipEl.text(''); // empty it
|
|
77566
77644
|
state.tooltipEl.append(function () {
|
|
77567
77645
|
return state.content;
|
|
77568
77646
|
});
|
|
77647
|
+
} else if (typeof state.content === 'string') {
|
|
77648
|
+
state.tooltipEl.html(state.content);
|
|
77649
|
+
} else if (isReactRenderable(state.content)) {
|
|
77650
|
+
state.tooltipEl.text(''); // empty it
|
|
77651
|
+
render(state.content, state.tooltipEl.node());
|
|
77569
77652
|
} else {
|
|
77570
|
-
state.tooltipEl.
|
|
77653
|
+
state.tooltipEl.style('display', 'none');
|
|
77654
|
+
console.warn('Tooltip content is invalid, skipping.', state.content, state.content.toString());
|
|
77571
77655
|
}
|
|
77572
77656
|
}
|
|
77573
77657
|
});
|
|
@@ -77696,10 +77780,10 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77696
77780
|
});
|
|
77697
77781
|
var topIntersect = intersects.length ? intersects[0] : null;
|
|
77698
77782
|
topObject = topIntersect ? topIntersect.object : null;
|
|
77699
|
-
state.
|
|
77783
|
+
state.intersection = topIntersect || null;
|
|
77700
77784
|
}
|
|
77701
77785
|
if (topObject !== state.hoverObj) {
|
|
77702
|
-
state.onHover(topObject, state.hoverObj);
|
|
77786
|
+
state.onHover(topObject, state.hoverObj, state.intersection);
|
|
77703
77787
|
state.tooltip.content(topObject ? index$2(state.tooltipContent)(topObject) || null : null);
|
|
77704
77788
|
state.hoverObj = topObject;
|
|
77705
77789
|
}
|
|
@@ -77820,7 +77904,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77820
77904
|
|
|
77821
77905
|
// extract global x,y,z min/max
|
|
77822
77906
|
return Object.assign.apply(Object, _toConsumableArray(['x', 'y', 'z'].map(function (c) {
|
|
77823
|
-
return _defineProperty({}, c, [box.min[c], box.max[c]]);
|
|
77907
|
+
return _defineProperty$1({}, c, [box.min[c], box.max[c]]);
|
|
77824
77908
|
})));
|
|
77825
77909
|
},
|
|
77826
77910
|
getScreenCoords: function getScreenCoords(state, x, y, z) {
|
|
@@ -77952,11 +78036,11 @@ var<${access}> ${name} : ${structName};`;
|
|
|
77952
78036
|
// trigger click events asynchronously, to allow hoverObj to be set (on frame)
|
|
77953
78037
|
if (ev.button === 0) {
|
|
77954
78038
|
// left-click
|
|
77955
|
-
state.onClick(state.hoverObj || null, ev, state.
|
|
78039
|
+
state.onClick(state.hoverObj || null, ev, state.intersection); // trigger background clicks with null
|
|
77956
78040
|
}
|
|
77957
78041
|
if (ev.button === 2 && state.onRightClick) {
|
|
77958
78042
|
// right-click
|
|
77959
|
-
state.onRightClick(state.hoverObj || null, ev, state.
|
|
78043
|
+
state.onRightClick(state.hoverObj || null, ev, state.intersection);
|
|
77960
78044
|
}
|
|
77961
78045
|
});
|
|
77962
78046
|
}, {
|