@antv/g 5.16.22 → 5.16.24
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/index.umd.js +6 -11
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -5810,7 +5810,6 @@
|
|
|
5810
5810
|
function piMod(angle) {
|
|
5811
5811
|
return (angle + Math.PI * 2) % (Math.PI * 2);
|
|
5812
5812
|
}
|
|
5813
|
-
|
|
5814
5813
|
var line = {
|
|
5815
5814
|
/**
|
|
5816
5815
|
* 计算线段的包围盒
|
|
@@ -5905,7 +5904,6 @@
|
|
|
5905
5904
|
return Math.atan2(y2 - y1, x2 - x1);
|
|
5906
5905
|
}
|
|
5907
5906
|
};
|
|
5908
|
-
|
|
5909
5907
|
var EPSILON$1 = 0.0001;
|
|
5910
5908
|
/**
|
|
5911
5909
|
* 使用牛顿切割法求最近的点
|
|
@@ -6075,7 +6073,6 @@
|
|
|
6075
6073
|
return piMod(angle);
|
|
6076
6074
|
}
|
|
6077
6075
|
};
|
|
6078
|
-
|
|
6079
6076
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
6080
6077
|
var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍
|
|
6081
6078
|
return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t;
|
|
@@ -6507,7 +6504,6 @@
|
|
|
6507
6504
|
return piMod(Math.atan2(dy, dx));
|
|
6508
6505
|
}
|
|
6509
6506
|
};
|
|
6510
|
-
|
|
6511
6507
|
function analyzePoints(points) {
|
|
6512
6508
|
// 计算每段的长度和总的长度
|
|
6513
6509
|
var totalLength = 0;
|
|
@@ -6620,7 +6616,6 @@
|
|
|
6620
6616
|
}
|
|
6621
6617
|
return minDistance;
|
|
6622
6618
|
}
|
|
6623
|
-
|
|
6624
6619
|
var polyline = {
|
|
6625
6620
|
/**
|
|
6626
6621
|
* 计算多折线的包围盒
|
|
@@ -9164,7 +9159,7 @@
|
|
|
9164
9159
|
var e=_this.createPointerEvent(from);_this.dispatchEvent(e,'pointerdown');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchstart');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightdown':'mousedown');}var trackingData=_this.trackingData(from.pointerId);trackingData.pressTargetsByButton[from.button]=e.composedPath();_this.freeEvent(e);};this.onPointerUp=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9165
9160
|
// return;
|
|
9166
9161
|
// }
|
|
9167
|
-
var now=performance.now();var e=_this.createPointerEvent(from);_this.dispatchEvent(e,'pointerup');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchend');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightup':'mouseup');}var trackingData=_this.trackingData(from.pointerId);var pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);var clickTarget=pressTarget;// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
9162
|
+
var now=performance.now();var e=_this.createPointerEvent(from,undefined,undefined,_this.context.config.alwaysTriggerPointerEventOnCanvas?_this.rootTarget:undefined);_this.dispatchEvent(e,'pointerup');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchend');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightup':'mouseup');}var trackingData=_this.trackingData(from.pointerId);var pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);var clickTarget=pressTarget;// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
9168
9163
|
// the pointerup location.
|
|
9169
9164
|
if(pressTarget&&!e.composedPath().includes(pressTarget)){var currentTarget=pressTarget;while(currentTarget&&!e.composedPath().includes(currentTarget)){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch'){_this.notifyTarget(e,'touchendoutside');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var _isRightButton=e.button===2;_this.notifyTarget(e,_isRightButton?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
9170
9165
|
// targets. That is - it's our click target!
|
|
@@ -9172,7 +9167,7 @@
|
|
|
9172
9167
|
if(!((_e$detail=e.detail)===null||_e$detail===void 0?void 0:_e$detail.preventClick)){if(!_this.context.config.useNativeClickEvent&&(clickEvent.pointerType==='mouse'||clickEvent.pointerType==='touch')){_this.dispatchEvent(clickEvent,'click');}_this.dispatchEvent(clickEvent,'pointertap');}_this.freeEvent(clickEvent);}_this.freeEvent(e);};this.onPointerMove=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9173
9168
|
// return;
|
|
9174
9169
|
// }
|
|
9175
|
-
var e=_this.createPointerEvent(from);var isMouse=e.pointerType==='mouse'||e.pointerType==='pen';var trackingData=_this.trackingData(from.pointerId);var outTarget=_this.findMountedTarget(trackingData.overTargets);// First pointerout/pointerleave
|
|
9170
|
+
var e=_this.createPointerEvent(from,undefined,undefined,_this.context.config.alwaysTriggerPointerEventOnCanvas?_this.rootTarget:undefined);var isMouse=e.pointerType==='mouse'||e.pointerType==='pen';var trackingData=_this.trackingData(from.pointerId);var outTarget=_this.findMountedTarget(trackingData.overTargets);// First pointerout/pointerleave
|
|
9176
9171
|
if(trackingData.overTargets&&outTarget!==e.target){// pointerout always occurs on the overTarget when the pointer hovers over another element.
|
|
9177
9172
|
var outType=from.type==='mousemove'?'mouseout':'pointerout';var outEvent=_this.createPointerEvent(from,outType,outTarget||undefined);_this.dispatchEvent(outEvent,'pointerout');if(isMouse)_this.dispatchEvent(outEvent,'mouseout');// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
9178
9173
|
// is dispatched to all ancestors that no longer capture the pointer.
|
|
@@ -9201,7 +9196,7 @@
|
|
|
9201
9196
|
var trackingData=_this.trackingData(from.pointerId);var pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);var e=_this.createPointerEvent(from);if(pressTarget){var currentTarget=pressTarget;while(currentTarget){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch');else if(e.pointerType==='mouse'||e.pointerType==='pen'){_this.notifyTarget(e,e.button===2?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];}_this.freeEvent(e);};this.onWheel=function(from){// if (!(from instanceof FederatedWheelEvent)) {
|
|
9202
9197
|
// return;
|
|
9203
9198
|
// }
|
|
9204
|
-
var wheelEvent=_this.createWheelEvent(from);_this.dispatchEvent(wheelEvent);_this.freeEvent(wheelEvent);};this.onClick=function(from){if(_this.context.config.useNativeClickEvent){var e=_this.createPointerEvent(from);_this.dispatchEvent(e);_this.freeEvent(e);}};this.onPointerCancel=function(from){var e=_this.createPointerEvent(from);_this.dispatchEvent(e);_this.freeEvent(e);};this.globalRuntime=globalRuntime;this.context=context;}var _proto=EventService.prototype;_proto.init=function init(){this.rootTarget=this.context.renderingContext.root.parentNode;// document
|
|
9199
|
+
var wheelEvent=_this.createWheelEvent(from);_this.dispatchEvent(wheelEvent);_this.freeEvent(wheelEvent);};this.onClick=function(from){if(_this.context.config.useNativeClickEvent){var e=_this.createPointerEvent(from);_this.dispatchEvent(e);_this.freeEvent(e);}};this.onPointerCancel=function(from){var e=_this.createPointerEvent(from,undefined,undefined,_this.context.config.alwaysTriggerPointerEventOnCanvas?_this.rootTarget:undefined);_this.dispatchEvent(e);_this.freeEvent(e);};this.globalRuntime=globalRuntime;this.context=context;}var _proto=EventService.prototype;_proto.init=function init(){this.rootTarget=this.context.renderingContext.root.parentNode;// document
|
|
9205
9200
|
this.addEventMapping('pointerdown',this.onPointerDown);this.addEventMapping('pointerup',this.onPointerUp);this.addEventMapping('pointermove',this.onPointerMove);this.addEventMapping('pointerout',this.onPointerOut);this.addEventMapping('pointerleave',this.onPointerOut);this.addEventMapping('pointercancel',this.onPointerCancel);this.addEventMapping('pointerover',this.onPointerOver);this.addEventMapping('pointerupoutside',this.onPointerUpOutside);this.addEventMapping('wheel',this.onWheel);this.addEventMapping('click',this.onClick);};_proto.destroy=function destroy(){this.emitter.removeAllListeners();this.mappingTable={};this.mappingState={};this.eventPool.clear();};_proto.client2Viewport=function client2Viewport(client){var bbox=this.context.contextService.getBoundingClientRect();return new Point(client.x-((bbox===null||bbox===void 0?void 0:bbox.left)||0),client.y-((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Client=function viewport2Client(canvas){var bbox=this.context.contextService.getBoundingClientRect();return new Point(canvas.x+((bbox===null||bbox===void 0?void 0:bbox.left)||0),canvas.y+((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Canvas=function viewport2Canvas(_ref){var x=_ref.x,y=_ref.y;var canvas=this.rootTarget.defaultView;var camera=canvas.getCamera();var _this$context$config=this.context.config,width=_this$context$config.width,height=_this$context$config.height;var projectionMatrixInverse=camera.getPerspectiveInverse();var worldMatrix=camera.getWorldTransform();var vpMatrix=multiply(this.tmpMatrix,worldMatrix,projectionMatrixInverse);var viewport=set$1(this.tmpVec3,x/width*2-1,(1-y/height)*2-1,0);transformMat4(viewport,viewport,vpMatrix);return new Point(viewport[0],viewport[1]);};_proto.canvas2Viewport=function canvas2Viewport(canvasP){var canvas=this.rootTarget.defaultView;var camera=canvas.getCamera();// World -> Clip
|
|
9206
9201
|
var projectionMatrix=camera.getPerspective();var viewMatrix=camera.getViewTransform();var vpMatrix=multiply(this.tmpMatrix,projectionMatrix,viewMatrix);var clip=set$1(this.tmpVec3,canvasP.x,canvasP.y,0);transformMat4(this.tmpVec3,this.tmpVec3,vpMatrix);// Clip -> NDC -> Viewport, flip Y
|
|
9207
9202
|
var _this$context$config2=this.context.config,width=_this$context$config2.width,height=_this$context$config2.height;return new Point((clip[0]+1)/2*width,(1-(clip[1]+1)/2)*height);};_proto.setPickHandler=function setPickHandler(pickHandler){this.pickHandler=pickHandler;};_proto.addEventMapping=function addEventMapping(type,fn){if(!this.mappingTable[type]){this.mappingTable[type]=[];}this.mappingTable[type].push({fn:fn,priority:0});this.mappingTable[type].sort(function(a,b){return a.priority-b.priority;});};_proto.mapEvent=function mapEvent(e){if(!this.rootTarget){return;}var mappers=this.mappingTable[e.type];if(mappers){for(var i=0,j=mappers.length;i<j;i++){mappers[i].fn(e);}}else {console.warn("[EventService]: Event mapping not defined for "+e.type);}};_proto.dispatchEvent=function dispatchEvent(e,type,skipPropagate){// Canvas should skip
|
|
@@ -9227,7 +9222,7 @@
|
|
|
9227
9222
|
if($el&&$el.contains){return $el.contains(target);}}if(event.nativeEvent.composedPath){return event.nativeEvent.composedPath().indexOf($el)>-1;}// account for Touch
|
|
9228
9223
|
return false;}/**
|
|
9229
9224
|
* Find HTML from composed path in native UI event.
|
|
9230
|
-
*/;_proto.getExistedHTML=function getExistedHTML(event){if(event.nativeEvent.composedPath){for(var _iterator=_createForOfIteratorHelperLoose(event.nativeEvent.composedPath()),_step;!(_step=_iterator()).done;){var eventTarget=_step.value;var existed=runtime.nativeHTMLMap.get(eventTarget);if(existed){return existed;}}}return null;};_proto.pickTarget=function pickTarget(event){return this.hitTest({clientX:event.clientX,clientY:event.clientY,viewportX:event.viewportX,viewportY:event.viewportY,x:event.canvasX,y:event.canvasY});};_proto.createPointerEvent=function createPointerEvent(from,type,target){var event=this.allocateEvent(FederatedPointerEvent);this.copyPointerData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.nativeEvent=from.nativeEvent;event.originalEvent=from;var existedHTML=this.getExistedHTML(event);event.target=target!==null&&target!==void 0?target:existedHTML||this.isNativeEventFromCanvas(event)&&this.pickTarget(event);if(typeof type==='string'){event.type=type;}return event;};_proto.createWheelEvent=function createWheelEvent(from){var event=this.allocateEvent(FederatedWheelEvent);this.copyWheelData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.nativeEvent=from.nativeEvent;event.originalEvent=from;var existedHTML=this.getExistedHTML(event);event.target=existedHTML||this.isNativeEventFromCanvas(event)&&this.pickTarget(event);return event;};_proto.trackingData=function trackingData(id){if(!this.mappingState.trackingData[id]){this.mappingState.trackingData[id]={pressTargetsByButton:{},clicksByButton:{},overTarget:null};}return this.mappingState.trackingData[id];};_proto.cloneWheelEvent=function cloneWheelEvent(from){var event=this.allocateEvent(FederatedWheelEvent);event.nativeEvent=from.nativeEvent;event.originalEvent=from.originalEvent;this.copyWheelData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.target=from.target;event.path=from.composedPath().slice();event.type=from.type;return event;};_proto.clonePointerEvent=function clonePointerEvent(from,type){var event=this.allocateEvent(FederatedPointerEvent);event.nativeEvent=from.nativeEvent;event.originalEvent=from.originalEvent;this.copyPointerData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.target=from.target;event.path=from.composedPath().slice();event.type=type!==null&&type!==void 0?type:event.type;return event;};_proto.copyPointerData=function copyPointerData(from,to){// if (
|
|
9225
|
+
*/;_proto.getExistedHTML=function getExistedHTML(event){if(event.nativeEvent.composedPath){for(var _iterator=_createForOfIteratorHelperLoose(event.nativeEvent.composedPath()),_step;!(_step=_iterator()).done;){var eventTarget=_step.value;var existed=runtime.nativeHTMLMap.get(eventTarget);if(existed){return existed;}}}return null;};_proto.pickTarget=function pickTarget(event){return this.hitTest({clientX:event.clientX,clientY:event.clientY,viewportX:event.viewportX,viewportY:event.viewportY,x:event.canvasX,y:event.canvasY});};_proto.createPointerEvent=function createPointerEvent(from,type,target,fallbackTarget){var event=this.allocateEvent(FederatedPointerEvent);this.copyPointerData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.nativeEvent=from.nativeEvent;event.originalEvent=from;var existedHTML=this.getExistedHTML(event);event.target=target!==null&&target!==void 0?target:existedHTML||this.isNativeEventFromCanvas(event)&&this.pickTarget(event)||fallbackTarget;if(typeof type==='string'){event.type=type;}return event;};_proto.createWheelEvent=function createWheelEvent(from){var event=this.allocateEvent(FederatedWheelEvent);this.copyWheelData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.nativeEvent=from.nativeEvent;event.originalEvent=from;var existedHTML=this.getExistedHTML(event);event.target=existedHTML||this.isNativeEventFromCanvas(event)&&this.pickTarget(event);return event;};_proto.trackingData=function trackingData(id){if(!this.mappingState.trackingData[id]){this.mappingState.trackingData[id]={pressTargetsByButton:{},clicksByButton:{},overTarget:null};}return this.mappingState.trackingData[id];};_proto.cloneWheelEvent=function cloneWheelEvent(from){var event=this.allocateEvent(FederatedWheelEvent);event.nativeEvent=from.nativeEvent;event.originalEvent=from.originalEvent;this.copyWheelData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.target=from.target;event.path=from.composedPath().slice();event.type=from.type;return event;};_proto.clonePointerEvent=function clonePointerEvent(from,type){var event=this.allocateEvent(FederatedPointerEvent);event.nativeEvent=from.nativeEvent;event.originalEvent=from.originalEvent;this.copyPointerData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.target=from.target;event.path=from.composedPath().slice();event.type=type!==null&&type!==void 0?type:event.type;return event;};_proto.copyPointerData=function copyPointerData(from,to){// if (
|
|
9231
9226
|
// !(
|
|
9232
9227
|
// from instanceof FederatedPointerEvent &&
|
|
9233
9228
|
// to instanceof FederatedPointerEvent
|
|
@@ -9610,7 +9605,7 @@
|
|
|
9610
9605
|
*/_this.Element=DisplayObject;/**
|
|
9611
9606
|
* rAF in auto rendering
|
|
9612
9607
|
*/_this.frameId=void 0;_this.inited=false;_this.readyPromise=void 0;_this.resolveReadyPromise=void 0;_this.context={};_this.document=new Document();_this.document.defaultView=_assertThisInitialized(_this);// create registry of custom elements
|
|
9613
|
-
_this.customElements=new CustomElementRegistry();var container=config.container,canvas=config.canvas,offscreenCanvas=config.offscreenCanvas,width=config.width,height=config.height,devicePixelRatio=config.devicePixelRatio,renderer=config.renderer,background=config.background,cursor=config.cursor,document=config.document,requestAnimationFrame=config.requestAnimationFrame,cancelAnimationFrame=config.cancelAnimationFrame,createImage=config.createImage,supportsPointerEvents=config.supportsPointerEvents,supportsTouchEvents=config.supportsTouchEvents,supportsCSSTransform=config.supportsCSSTransform,useNativeClickEvent=config.useNativeClickEvent,isTouchEvent=config.isTouchEvent,isMouseEvent=config.isMouseEvent;cleanExistedCanvas(container,_assertThisInitialized(_this));var canvasWidth=width;var canvasHeight=height;var dpr=devicePixelRatio;// use user-defined <canvas> or OffscreenCanvas
|
|
9608
|
+
_this.customElements=new CustomElementRegistry();var container=config.container,canvas=config.canvas,offscreenCanvas=config.offscreenCanvas,width=config.width,height=config.height,devicePixelRatio=config.devicePixelRatio,renderer=config.renderer,background=config.background,cursor=config.cursor,document=config.document,requestAnimationFrame=config.requestAnimationFrame,cancelAnimationFrame=config.cancelAnimationFrame,createImage=config.createImage,supportsPointerEvents=config.supportsPointerEvents,supportsTouchEvents=config.supportsTouchEvents,supportsCSSTransform=config.supportsCSSTransform,useNativeClickEvent=config.useNativeClickEvent,alwaysTriggerPointerEventOnCanvas=config.alwaysTriggerPointerEventOnCanvas,isTouchEvent=config.isTouchEvent,isMouseEvent=config.isMouseEvent;cleanExistedCanvas(container,_assertThisInitialized(_this));var canvasWidth=width;var canvasHeight=height;var dpr=devicePixelRatio;// use user-defined <canvas> or OffscreenCanvas
|
|
9614
9609
|
if(canvas){// infer width & height with dpr
|
|
9615
9610
|
dpr=devicePixelRatio||isBrowser&&window.devicePixelRatio||1;dpr=dpr>=1?Math.ceil(dpr):1;canvasWidth=width||getWidth(canvas)||canvas.width/dpr;canvasHeight=height||getHeight(canvas)||canvas.height/dpr;}/**
|
|
9616
9611
|
* implements `Window` interface
|
|
@@ -9618,7 +9613,7 @@
|
|
|
9618
9613
|
* limits query
|
|
9619
9614
|
*/ // the following feature-detect from hammer.js
|
|
9620
9615
|
// @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
|
|
9621
|
-
_this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in runtime.globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!runtime.globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof runtime.globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !runtime.globalThis.MouseEvent||event instanceof runtime.globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof runtime.globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform,useNativeClickEvent:useNativeClickEvent});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){this.context.config=mergedConfig;// bind rendering context, shared by all renderers
|
|
9616
|
+
_this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in runtime.globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!runtime.globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof runtime.globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !runtime.globalThis.MouseEvent||event instanceof runtime.globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof runtime.globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform,useNativeClickEvent:useNativeClickEvent,alwaysTriggerPointerEventOnCanvas:alwaysTriggerPointerEventOnCanvas});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){this.context.config=mergedConfig;// bind rendering context, shared by all renderers
|
|
9622
9617
|
this.context.renderingContext={/**
|
|
9623
9618
|
* the root node in scene graph
|
|
9624
9619
|
*/root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set(),force:false,dirty:false};};_proto.initDefaultCamera=function initDefaultCamera(width,height){var _this2=this;// set a default ortho camera
|