@antv/g 5.8.12 → 5.9.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/dist/index.umd.js +105 -9
- package/dist/index.umd.min.js +2 -2
- package/package.json +10 -10
package/dist/index.umd.js
CHANGED
|
@@ -11661,7 +11661,8 @@
|
|
|
11661
11661
|
for(i=0;i<baseline;++i){for(var j=0;j<line;j+=4){if(imagedata[idx+j]!==255){stop=true;break;}}if(!stop){idx+=line;}else {break;}}properties.ascent=baseline-i;idx=pixels-line;stop=false;// descent. scan from bottom to top until we find a non red pixel
|
|
11662
11662
|
for(i=height;i>baseline;--i){for(var _j=0;_j<line;_j+=4){if(imagedata[idx+_j]!==255){stop=true;break;}}if(!stop){idx-=line;}else {break;}}properties.descent=i-baseline;properties.fontSize=properties.ascent+properties.descent;this.cache[font]=properties;return properties;};_proto.measureText=function measureText(text,parsedStyle,offscreenCanvas){var fontSize=parsedStyle.fontSize,wordWrap=parsedStyle.wordWrap,strokeHeight=parsedStyle.lineHeight,lineWidth=parsedStyle.lineWidth,textBaseline=parsedStyle.textBaseline,textAlign=parsedStyle.textAlign,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$leading=parsedStyle.leading,leading=_parsedStyle$leading===void 0?0:_parsedStyle$leading;var font=toFontString(parsedStyle);var fontProperties=this.measureFont(font,offscreenCanvas);// fallback in case UA disallow canvas data extraction
|
|
11663
11663
|
// (toDataURI, getImageData functions)
|
|
11664
|
-
if(fontProperties.fontSize===0){fontProperties.fontSize=fontSize;fontProperties.ascent=fontSize;}var context=this.offscreenCanvas.getOrCreateContext(offscreenCanvas);context.font=font
|
|
11664
|
+
if(fontProperties.fontSize===0){fontProperties.fontSize=fontSize;fontProperties.ascent=fontSize;}var context=this.offscreenCanvas.getOrCreateContext(offscreenCanvas);context.font=font;// no overflowing by default
|
|
11665
|
+
parsedStyle.isOverflowing=false;var outputText=wordWrap?this.wordWrap(text,parsedStyle,offscreenCanvas):text;var lines=outputText.split(/(?:\r\n|\r|\n)/);var lineWidths=new Array(lines.length);var maxLineWidth=0;for(var i=0;i<lines.length;i++){var _lineWidth=context.measureText(lines[i]).width+(lines[i].length-1)*letterSpacing;lineWidths[i]=_lineWidth;maxLineWidth=Math.max(maxLineWidth,_lineWidth);}var width=maxLineWidth+lineWidth;// if (dropShadow) {
|
|
11665
11666
|
// width += dropShadowDistance;
|
|
11666
11667
|
// }
|
|
11667
11668
|
var lineHeight=strokeHeight||fontProperties.fontSize+lineWidth;var height=Math.max(lineHeight,fontProperties.fontSize+lineWidth)+(lines.length-1)*(lineHeight+leading);// if (dropShadow) {
|
|
@@ -11669,7 +11670,10 @@
|
|
|
11669
11670
|
// }
|
|
11670
11671
|
lineHeight+=leading;// handle vertical text baseline
|
|
11671
11672
|
var offsetY=0;if(textBaseline==='middle'){offsetY=-height/2;}else if(textBaseline==='bottom'||textBaseline==='alphabetic'||textBaseline==='ideographic'){offsetY=-height;}else if(textBaseline==='top'||textBaseline==='hanging'){offsetY=0;}return {font:font,width:width,height:height,lines:lines,lineWidths:lineWidths,lineHeight:lineHeight,maxLineWidth:maxLineWidth,fontProperties:fontProperties,lineMetrics:lineWidths.map(function(width,i){var offsetX=0;// handle horizontal text align
|
|
11672
|
-
if(textAlign==='center'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};};_proto.wordWrap=function wordWrap(text,
|
|
11673
|
+
if(textAlign==='center'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};};_proto.wordWrap=function wordWrap(text,parsedStyle,offscreenCanvas){var _this2=this;var _parsedStyle$wordWrap=parsedStyle.wordWrapWidth,wordWrapWidth=_parsedStyle$wordWrap===void 0?0:_parsedStyle$wordWrap,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$maxLines=parsedStyle.maxLines,maxLines=_parsedStyle$maxLines===void 0?Infinity:_parsedStyle$maxLines,textOverflow=parsedStyle.textOverflow;var context=this.offscreenCanvas.getOrCreateContext(offscreenCanvas);var maxWidth=wordWrapWidth+letterSpacing;var ellipsis='';if(textOverflow==='ellipsis'){ellipsis='...';}else if(textOverflow&&textOverflow!=='clip'){ellipsis=textOverflow;}var lines=[];var currentIndex=0;var currentWidth=0;var cache={};var calcWidth=function calcWidth(char){return _this2.getFromCache(char,letterSpacing,cache,context);};var ellipsisWidth=Array.from(ellipsis).reduce(function(prev,cur){return prev+calcWidth(cur);},0);var chars=Array.from(text);for(var i=0;i<chars.length;i++){var char=chars[i];var prevChar=text[i-1];var nextChar=text[i+1];var width=calcWidth(char);if(this.isNewline(char)){currentIndex++;currentWidth=0;lines[currentIndex]='';continue;}if(currentWidth>0&¤tWidth+width>maxWidth){if(currentIndex+1>=maxLines){parsedStyle.isOverflowing=true;// If there is not enough space to display the string itself, it is clipped.
|
|
11674
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
11675
|
+
if(ellipsisWidth>0&&ellipsisWidth<=maxWidth){// Backspace from line's end.
|
|
11676
|
+
var lastLineWidth=0;var lastLineIndex=0;for(var _i=0;_i<lines[currentIndex].length;_i++){var _width=calcWidth(lines[currentIndex][_i]);if(lastLineWidth+_width+ellipsisWidth>maxWidth){lastLineIndex=_i;break;}lastLineWidth+=_width;}lines[currentIndex]=(lines[currentIndex]||'').slice(0,lastLineIndex)+ellipsis;}break;}currentIndex++;currentWidth=0;lines[currentIndex]='';if(this.isBreakingSpace(char)){continue;}if(!this.canBreakInLastChar(char)){lines=this.trimToBreakable(lines);currentWidth=this.sumTextWidthByCache(lines[currentIndex]||'',cache);}if(this.shouldBreakByKinsokuShorui(char,nextChar)){lines=this.trimByKinsokuShorui(lines);currentWidth+=calcWidth(prevChar||'');}}currentWidth+=width;lines[currentIndex]=(lines[currentIndex]||'')+char;}return lines.join('\n');};_proto.isBreakingSpace=function isBreakingSpace(char){if(typeof char!=='string'){return false;}return TEXT_METRICS.BreakingSpaces.indexOf(char.charCodeAt(0))>=0;};_proto.isNewline=function isNewline(char){if(typeof char!=='string'){return false;}return TEXT_METRICS.Newlines.indexOf(char.charCodeAt(0))>=0;};_proto.trimToBreakable=function trimToBreakable(prev){var next=[].concat(prev);var prevLine=next[next.length-2];var index=this.findBreakableIndex(prevLine);if(index===-1||!prevLine)return next;var trimmedChar=prevLine.slice(index,index+1);var isTrimmedWithSpace=this.isBreakingSpace(trimmedChar);var trimFrom=index+1;var trimTo=index+(isTrimmedWithSpace?0:1);next[next.length-1]+=prevLine.slice(trimFrom,prevLine.length);next[next.length-2]=prevLine.slice(0,trimTo);return next;};_proto.canBreakInLastChar=function canBreakInLastChar(char){if(char&&LATIN_REGEX.test(char))return false;return true;};_proto.sumTextWidthByCache=function sumTextWidthByCache(text,cache){return text.split('').reduce(function(sum,c){if(!cache[c])throw Error('cannot count the word without cache');return sum+cache[c];},0);};_proto.findBreakableIndex=function findBreakableIndex(line){for(var i=line.length-1;i>=0;i--){if(!LATIN_REGEX.test(line[i]))return i;}return -1;};_proto.getFromCache=function getFromCache(key,letterSpacing,cache,context){var width=cache[key];if(typeof width!=='number'){var spacing=key.length*letterSpacing;width=context.measureText(key).width+spacing;cache[key]=width;}return width;};return TextService;}();exports.TextService=__decorate([singleton(),__param(0,inject(exports.OffscreenCanvasCreator))],exports.TextService);exports.TextUpdater=/*#__PURE__*/function(){function TextUpdater(textService){this.textService=void 0;this.textService=textService;}var _proto=TextUpdater.prototype;_proto.isReadyToMeasure=function isReadyToMeasure(parsedStyle,object){var text=parsedStyle.text,textAlign=parsedStyle.textAlign,textBaseline=parsedStyle.textBaseline,fontSize=parsedStyle.fontSize,fontStyle=parsedStyle.fontStyle,fontWeight=parsedStyle.fontWeight,fontVariant=parsedStyle.fontVariant,lineWidth=parsedStyle.lineWidth;return text&&fontSize&&fontStyle&&fontWeight&&fontVariant&&textAlign&&textBaseline&&!isNil(lineWidth);};_proto.update=function update(parsedStyle,object){var _object$ownerDocument,_object$ownerDocument2;var text=parsedStyle.text,textAlign=parsedStyle.textAlign,lineWidth=parsedStyle.lineWidth,textBaseline=parsedStyle.textBaseline,dx=parsedStyle.dx,dy=parsedStyle.dy;var _ref=(object===null||object===void 0?void 0:(_object$ownerDocument=object.ownerDocument)===null||_object$ownerDocument===void 0?void 0:(_object$ownerDocument2=_object$ownerDocument.defaultView)===null||_object$ownerDocument2===void 0?void 0:_object$ownerDocument2.getConfig())||{},offscreenCanvas=_ref.offscreenCanvas;if(!this.isReadyToMeasure(parsedStyle,object)){// if (!text || !textAlign || !textBaseline ||) {
|
|
11673
11677
|
parsedStyle.metrics={font:'',width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]};return {width:0,height:0,x:0,y:0,offsetX:0,offsetY:0};}var metrics=this.textService.measureText(text,parsedStyle,offscreenCanvas);parsedStyle.metrics=metrics;var width=metrics.width,height=metrics.height,lineHeight=metrics.lineHeight,fontProperties=metrics.fontProperties;// anchor is left-top by default
|
|
11674
11678
|
var halfExtents=[width/2,height/2,0];// default 'left'
|
|
11675
11679
|
var anchor=[0,1];var lineXOffset=0;if(textAlign==='center'){lineXOffset=lineWidth/2;anchor=[0.5,1];}else if(textAlign==='right'||textAlign==='end'){lineXOffset=lineWidth;anchor=[1,1];}var lineYOffset=0;if(textBaseline==='middle'){// eslint-disable-next-line prefer-destructuring
|
|
@@ -11833,17 +11837,19 @@
|
|
|
11833
11837
|
*/;_proto.elementsFromBBox=function elementsFromBBox(minX,minY,maxX,maxY){var rBush=this.defaultView.getRBushRoot();var rBushNodes=rBush.search({minX:minX,minY:minY,maxX:maxX,maxY:maxY});var displayObjectPool=GlobalContainer$1.get(exports.DisplayObjectPool);var hitTestList=[];rBushNodes.forEach(function(_ref2){var id=_ref2.id;var displayObject=displayObjectPool.getByEntity(id);var pointerEvents=displayObject.parsedStyle.pointerEvents;// account for `visibility`
|
|
11834
11838
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
11835
11839
|
var isVisibilityAffected=['auto','visiblepainted','visiblefill','visiblestroke','visible'].includes(pointerEvents);if((!isVisibilityAffected||isVisibilityAffected&&displayObject.isVisible())&&!displayObject.isCulled()&&displayObject.isInteractive()){hitTestList.push(displayObject);}});// find group with max z-index
|
|
11836
|
-
hitTestList.sort(function(a,b){return b.sortable.renderOrder-a.sortable.renderOrder;});return hitTestList;}
|
|
11840
|
+
hitTestList.sort(function(a,b){return b.sortable.renderOrder-a.sortable.renderOrder;});return hitTestList;};_proto.elementFromPointSync=function elementFromPointSync(x,y){var _this$defaultView$can=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can.x,viewportY=_this$defaultView$can.y;var _this$defaultView$get=this.defaultView.getConfig(),width=_this$defaultView$get.width,height=_this$defaultView$get.height;// outside canvas' viewport
|
|
11841
|
+
if(viewportX<0||viewportY<0||viewportX>width||viewportY>height){return null;}var _this$defaultView$vie=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie.x,clientY=_this$defaultView$vie.y;var _this$defaultView$get2=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:true,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]}),picked=_this$defaultView$get2.picked;return picked&&picked[0]||this.documentElement;}/**
|
|
11837
11842
|
* Do picking with API instead of triggering interactive events.
|
|
11838
11843
|
*
|
|
11839
11844
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementFromPoint
|
|
11840
|
-
*/;_proto.elementFromPoint=/*#__PURE__*/function(){var _elementFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(x,y){var _this$defaultView$
|
|
11841
|
-
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context.next=4;break;}return _context.abrupt("return",null);case 4:_this$defaultView$
|
|
11845
|
+
*/;_proto.elementFromPoint=/*#__PURE__*/function(){var _elementFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(x,y){var _this$defaultView$can2,viewportX,viewportY,_this$defaultView$get3,width,height,_this$defaultView$vie2,clientX,clientY,_yield$this$defaultVi,picked;return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_this$defaultView$can2=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can2.x,viewportY=_this$defaultView$can2.y;_this$defaultView$get3=this.defaultView.getConfig(),width=_this$defaultView$get3.width,height=_this$defaultView$get3.height;// outside canvas' viewport
|
|
11846
|
+
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context.next=4;break;}return _context.abrupt("return",null);case 4:_this$defaultView$vie2=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie2.x,clientY=_this$defaultView$vie2.y;_context.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:true,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi=_context.sent;picked=_yield$this$defaultVi.picked;return _context.abrupt("return",picked&&picked[0]||this.documentElement);case 10:case"end":return _context.stop();}}},_callee,this);}));function elementFromPoint(_x,_x2){return _elementFromPoint.apply(this,arguments);}return elementFromPoint;}();_proto.elementsFromPointSync=function elementsFromPointSync(x,y){var _this$defaultView$can3=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can3.x,viewportY=_this$defaultView$can3.y;var _this$defaultView$get4=this.defaultView.getConfig(),width=_this$defaultView$get4.width,height=_this$defaultView$get4.height;// outside canvas' viewport
|
|
11847
|
+
if(viewportX<0||viewportY<0||viewportX>width||viewportY>height){return [];}var _this$defaultView$vie3=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie3.x,clientY=_this$defaultView$vie3.y;var _this$defaultView$get5=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:false,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]}),picked=_this$defaultView$get5.picked;if(picked[picked.length-1]!==this.documentElement){picked.push(this.documentElement);}return picked;}/**
|
|
11842
11848
|
* Do picking with API instead of triggering interactive events.
|
|
11843
11849
|
*
|
|
11844
11850
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementsFromPoint
|
|
11845
|
-
*/;_proto.elementsFromPoint=/*#__PURE__*/function(){var _elementsFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x,y){var _this$defaultView$
|
|
11846
|
-
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context2.next=4;break;}return _context2.abrupt("return",[]);case 4:_this$defaultView$
|
|
11851
|
+
*/;_proto.elementsFromPoint=/*#__PURE__*/function(){var _elementsFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x,y){var _this$defaultView$can4,viewportX,viewportY,_this$defaultView$get6,width,height,_this$defaultView$vie4,clientX,clientY,_yield$this$defaultVi2,picked;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_this$defaultView$can4=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can4.x,viewportY=_this$defaultView$can4.y;_this$defaultView$get6=this.defaultView.getConfig(),width=_this$defaultView$get6.width,height=_this$defaultView$get6.height;// outside canvas' viewport
|
|
11852
|
+
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context2.next=4;break;}return _context2.abrupt("return",[]);case 4:_this$defaultView$vie4=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie4.x,clientY=_this$defaultView$vie4.y;_context2.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:false,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi2=_context2.sent;picked=_yield$this$defaultVi2.picked;if(picked[picked.length-1]!==this.documentElement){picked.push(this.documentElement);}return _context2.abrupt("return",picked);case 11:case"end":return _context2.stop();}}},_callee2,this);}));function elementsFromPoint(_x3,_x4){return _elementsFromPoint.apply(this,arguments);}return elementsFromPoint;}()/**
|
|
11847
11853
|
* eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
|
|
11848
11854
|
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11849
11855
|
;_proto.appendChild=function appendChild(newChild,index){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -12281,7 +12287,7 @@
|
|
|
12281
12287
|
// selectSubString(charnum: number, nchars: number): void {
|
|
12282
12288
|
// throw new Error('Method not implemented.');
|
|
12283
12289
|
// }
|
|
12284
|
-
;_proto.getLineBoundingRects=function getLineBoundingRects(){var _this$parsedStyle$met2;return ((_this$parsedStyle$met2=this.parsedStyle.metrics)===null||_this$parsedStyle$met2===void 0?void 0:_this$parsedStyle$met2.lineMetrics)||[];};return Text;}(DisplayObject);/**
|
|
12290
|
+
;_proto.getLineBoundingRects=function getLineBoundingRects(){var _this$parsedStyle$met2;return ((_this$parsedStyle$met2=this.parsedStyle.metrics)===null||_this$parsedStyle$met2===void 0?void 0:_this$parsedStyle$met2.lineMetrics)||[];};_proto.isOverflowing=function isOverflowing(){return !!this.parsedStyle.isOverflowing;};return Text;}(DisplayObject);/**
|
|
12285
12291
|
* why we need re-render
|
|
12286
12292
|
*/(function(RenderReason){RenderReason[RenderReason["CAMERA_CHANGED"]=0]="CAMERA_CHANGED";RenderReason[RenderReason["DISPLAY_OBJECT_CHANGED"]=1]="DISPLAY_OBJECT_CHANGED";RenderReason[RenderReason["NONE"]=2]="NONE";})(exports.RenderReason||(exports.RenderReason={}));var RenderingContext=exports.Syringe.defineToken('');var PROPAGATION_LIMIT=2048;exports.EventService=/*#__PURE__*/function(){function EventService(renderingContext,contextService,canvasConfig,displayObjectPool){var _this=this;this.renderingContext=void 0;this.contextService=void 0;this.canvasConfig=void 0;this.displayObjectPool=void 0;this.rootTarget=void 0;this.emitter=new eventemitter3.EventEmitter();this.cursor='default';this.mappingTable={};this.mappingState={trackingData:{}};this.eventPool=new Map();this.pickHandler=void 0;this.tmpMatrix=create$1();this.tmpVec3=create$2();this.onPointerDown=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(from){var e,isRightButton,trackingData;return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(from instanceof FederatedPointerEvent){_context.next=2;break;}return _context.abrupt("return");case 2:_context.next=4;return _this.createPointerEvent(from);case 4:e=_context.sent;_this.dispatchEvent(e,'pointerdown');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchstart');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightdown':'mousedown');}trackingData=_this.trackingData(from.pointerId);trackingData.pressTargetsByButton[from.button]=e.composedPath();_this.freeEvent(e);case 10:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}();this.onPointerUp=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(from){var now,e,isRightButton,trackingData,pressTarget,clickTarget,currentTarget,_isRightButton,_e$detail,clickEvent,clickHistory;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(from instanceof FederatedPointerEvent){_context2.next=2;break;}return _context2.abrupt("return");case 2:now=performance.now();_context2.next=5;return _this.createPointerEvent(from);case 5:e=_context2.sent;_this.dispatchEvent(e,'pointerup');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchend');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightup':'mouseup');}trackingData=_this.trackingData(from.pointerId);pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);clickTarget=pressTarget;// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
12287
12293
|
// the pointerup location.
|
|
@@ -12471,6 +12477,8 @@
|
|
|
12471
12477
|
*/afterRender:new SyncHook(['objectToRender']),endFrame:new SyncHook([]),destroy:new SyncHook([]),/**
|
|
12472
12478
|
* use async but faster method such as GPU-based picking in `g-plugin-device-renderer`
|
|
12473
12479
|
*/pick:new AsyncSeriesWaterfallHook(['result']),/**
|
|
12480
|
+
* Unsafe but sync version of pick.
|
|
12481
|
+
*/pickSync:new SyncWaterfallHook(['result']),/**
|
|
12474
12482
|
* used in event system
|
|
12475
12483
|
*/pointerDown:new SyncHook(['event']),pointerUp:new SyncHook(['event']),pointerMove:new SyncHook(['event']),pointerOut:new SyncHook(['event']),pointerOver:new SyncHook(['event']),pointerWheel:new SyncHook(['event']),pointerCancel:new SyncHook(['event'])};this.renderingPluginProvider=renderingPluginProvider;this.canvasConfig=canvasConfig;this.renderingContext=renderingContext;this.sceneGraphService=sceneGraphService;this.styleValueRegistry=styleValueRegistry;this.camera=camera;}var _proto=RenderingService.prototype;_proto.init=/*#__PURE__*/function(){var _init=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _this=this;return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:// register rendering plugins
|
|
12476
12484
|
this.renderingPluginProvider.getContributions({cache:false}).forEach(function(plugin){plugin.apply(_this);});// await this.hooks.init.callPromise();
|
|
@@ -12723,7 +12731,7 @@
|
|
|
12723
12731
|
{n:'text',l:true,d:'',syntax:exports.PropertySyntax.TEXT,p:50},{n:'textTransform',l:true,inh:true,k:['capitalize','uppercase','lowercase','none'],d:'none',syntax:exports.PropertySyntax.TEXT_TRANSFORM,p:51// it must get parsed after text
|
|
12724
12732
|
},{n:'font',l:true},{n:'fontSize',int:true,inh:true,/**
|
|
12725
12733
|
* @see https://www.w3schools.com/css/css_font_size.asp
|
|
12726
|
-
*/d:'16px',l:true,syntax:exports.PropertySyntax.LENGTH_PERCENTAGE},{n:'fontFamily',l:true,inh:true,d:'sans-serif'},{n:'fontStyle',l:true,inh:true,k:['normal','italic','oblique'],d:'normal'},{n:'fontWeight',l:true,inh:true,k:['normal','bold','bolder','lighter'],d:'normal'},{n:'fontVariant',l:true,inh:true,k:['normal','small-caps'],d:'normal'},{n:'lineHeight',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'letterSpacing',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'miterLimit',l:true,syntax:exports.PropertySyntax.NUMBER,d:function d(nodeName){if(nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYGON||nodeName===exports.Shape.POLYLINE){return '4';}return '10';}},{n:'wordWrap',l:true},{n:'wordWrapWidth',l:true},{n:'leading',l:true},{n:'textBaseline',l:true,inh:true,k:['top','hanging','middle','alphabetic','ideographic','bottom'],d:'alphabetic'},{n:'textAlign',l:true,inh:true,k:['start','center','end','left','right'],d:'start'},// {
|
|
12734
|
+
*/d:'16px',l:true,syntax:exports.PropertySyntax.LENGTH_PERCENTAGE},{n:'fontFamily',l:true,inh:true,d:'sans-serif'},{n:'fontStyle',l:true,inh:true,k:['normal','italic','oblique'],d:'normal'},{n:'fontWeight',l:true,inh:true,k:['normal','bold','bolder','lighter'],d:'normal'},{n:'fontVariant',l:true,inh:true,k:['normal','small-caps'],d:'normal'},{n:'lineHeight',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'letterSpacing',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'miterLimit',l:true,syntax:exports.PropertySyntax.NUMBER,d:function d(nodeName){if(nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYGON||nodeName===exports.Shape.POLYLINE){return '4';}return '10';}},{n:'wordWrap',l:true},{n:'wordWrapWidth',l:true},{n:'maxLines',l:true},{n:'textOverflow',l:true,d:'clip'},{n:'leading',l:true},{n:'textBaseline',l:true,inh:true,k:['top','hanging','middle','alphabetic','ideographic','bottom'],d:'alphabetic'},{n:'textAlign',l:true,inh:true,k:['start','center','end','left','right'],d:'start'},// {
|
|
12727
12735
|
// n: 'whiteSpace',
|
|
12728
12736
|
// l: true,
|
|
12729
12737
|
// },
|
|
@@ -14440,6 +14448,94 @@
|
|
|
14440
14448
|
|
|
14441
14449
|
GlobalContainer$1.register(exports.AdvancedCamera);
|
|
14442
14450
|
|
|
14451
|
+
DisplayObject.prototype.getCount = function () {
|
|
14452
|
+
return this.childElementCount;
|
|
14453
|
+
}; // @ts-ignore
|
|
14454
|
+
|
|
14455
|
+
|
|
14456
|
+
DisplayObject.prototype.getParent = function () {
|
|
14457
|
+
return this.parentElement;
|
|
14458
|
+
}; // @ts-ignore
|
|
14459
|
+
|
|
14460
|
+
|
|
14461
|
+
DisplayObject.prototype.getChildren = function () {
|
|
14462
|
+
return this.children;
|
|
14463
|
+
}; // @ts-ignore
|
|
14464
|
+
|
|
14465
|
+
|
|
14466
|
+
DisplayObject.prototype.getFirst = function () {
|
|
14467
|
+
return this.firstElementChild;
|
|
14468
|
+
}; // @ts-ignore
|
|
14469
|
+
|
|
14470
|
+
|
|
14471
|
+
DisplayObject.prototype.getLast = function () {
|
|
14472
|
+
return this.lastElementChild;
|
|
14473
|
+
}; // @ts-ignore
|
|
14474
|
+
|
|
14475
|
+
|
|
14476
|
+
DisplayObject.prototype.getChildByIndex = function (index) {
|
|
14477
|
+
return this.children[index] || null;
|
|
14478
|
+
}; // @ts-ignore
|
|
14479
|
+
|
|
14480
|
+
|
|
14481
|
+
DisplayObject.prototype.add = function (child, index) {
|
|
14482
|
+
return this.appendChild(child, index);
|
|
14483
|
+
}; // @ts-ignore
|
|
14484
|
+
|
|
14485
|
+
|
|
14486
|
+
DisplayObject.prototype.setClip = function (clipPath) {
|
|
14487
|
+
this.style.clipPath = clipPath;
|
|
14488
|
+
}; // @ts-ignore
|
|
14489
|
+
|
|
14490
|
+
|
|
14491
|
+
DisplayObject.prototype.getClip = function () {
|
|
14492
|
+
return this.style.clipPath || null;
|
|
14493
|
+
}; // @ts-ignore
|
|
14494
|
+
|
|
14495
|
+
|
|
14496
|
+
DisplayObject.prototype.set = function (name, value) {
|
|
14497
|
+
this.config[name] = value;
|
|
14498
|
+
}; // @ts-ignore
|
|
14499
|
+
|
|
14500
|
+
|
|
14501
|
+
DisplayObject.prototype.get = function (name) {
|
|
14502
|
+
return this.config[name];
|
|
14503
|
+
}; // @ts-ignore
|
|
14504
|
+
|
|
14505
|
+
|
|
14506
|
+
DisplayObject.prototype.moveTo = function (position, y, z) {
|
|
14507
|
+
if (y === void 0) {
|
|
14508
|
+
y = 0;
|
|
14509
|
+
}
|
|
14510
|
+
|
|
14511
|
+
if (z === void 0) {
|
|
14512
|
+
z = 0;
|
|
14513
|
+
}
|
|
14514
|
+
|
|
14515
|
+
this.setPosition(position, y, z);
|
|
14516
|
+
return this;
|
|
14517
|
+
}; // @ts-ignore
|
|
14518
|
+
|
|
14519
|
+
|
|
14520
|
+
DisplayObject.prototype.move = function (position, y, z) {
|
|
14521
|
+
if (y === void 0) {
|
|
14522
|
+
y = 0;
|
|
14523
|
+
}
|
|
14524
|
+
|
|
14525
|
+
if (z === void 0) {
|
|
14526
|
+
z = 0;
|
|
14527
|
+
}
|
|
14528
|
+
|
|
14529
|
+
this.setPosition(position, y, z);
|
|
14530
|
+
return this;
|
|
14531
|
+
}; // @ts-ignore
|
|
14532
|
+
|
|
14533
|
+
|
|
14534
|
+
DisplayObject.prototype.setZIndex = function (zIndex) {
|
|
14535
|
+
this.style.zIndex = zIndex;
|
|
14536
|
+
return this;
|
|
14537
|
+
};
|
|
14538
|
+
|
|
14443
14539
|
function _regeneratorRuntime$1() {
|
|
14444
14540
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
14445
14541
|
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|