@antv/g 5.8.12 → 5.9.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/dist/index.umd.js +117 -364
- 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
|
// },
|
|
@@ -13032,179 +13040,13 @@
|
|
|
13032
13040
|
}
|
|
13033
13041
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13034
13042
|
}
|
|
13035
|
-
/** @deprecated */
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
function __spreadArrays() {
|
|
13039
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
13040
|
-
s += arguments[i].length;
|
|
13041
|
-
}
|
|
13042
|
-
|
|
13043
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
13044
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
13045
|
-
r[k] = a[j];
|
|
13046
|
-
}
|
|
13047
|
-
}
|
|
13048
|
-
|
|
13049
|
-
return r;
|
|
13050
|
-
}
|
|
13051
|
-
|
|
13052
|
-
var toString$1 = {}.toString;
|
|
13053
|
-
|
|
13054
|
-
var isType$1 = function isType(value, type) {
|
|
13055
|
-
return toString$1.call(value) === '[object ' + type + ']';
|
|
13056
|
-
};
|
|
13057
|
-
/**
|
|
13058
|
-
* 是否为函数
|
|
13059
|
-
* @param {*} fn 对象
|
|
13060
|
-
* @return {Boolean} 是否函数
|
|
13061
|
-
*/
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
var isFunction$2 = function isFunction(value) {
|
|
13065
|
-
return isType$1(value, 'Function');
|
|
13066
|
-
};
|
|
13067
|
-
|
|
13068
|
-
var isArray = function isArray(value) {
|
|
13069
|
-
return Array.isArray ? Array.isArray(value) : isType$1(value, 'Array');
|
|
13070
|
-
};
|
|
13071
|
-
|
|
13072
|
-
var isObject$1 = function isObject(value) {
|
|
13073
|
-
/**
|
|
13074
|
-
* isObject({}) => true
|
|
13075
|
-
* isObject([1, 2, 3]) => true
|
|
13076
|
-
* isObject(Function) => true
|
|
13077
|
-
* isObject(null) => false
|
|
13078
|
-
*/
|
|
13079
|
-
var type = typeof value;
|
|
13080
|
-
return value !== null && type === 'object' || type === 'function';
|
|
13081
|
-
};
|
|
13082
|
-
|
|
13083
|
-
function each(elements, func) {
|
|
13084
|
-
if (!elements) {
|
|
13085
|
-
return;
|
|
13086
|
-
}
|
|
13087
|
-
|
|
13088
|
-
var rst;
|
|
13089
|
-
|
|
13090
|
-
if (isArray(elements)) {
|
|
13091
|
-
for (var i = 0, len = elements.length; i < len; i++) {
|
|
13092
|
-
rst = func(elements[i], i);
|
|
13093
|
-
|
|
13094
|
-
if (rst === false) {
|
|
13095
|
-
break;
|
|
13096
|
-
}
|
|
13097
|
-
}
|
|
13098
|
-
} else if (isObject$1(elements)) {
|
|
13099
|
-
for (var k in elements) {
|
|
13100
|
-
if (elements.hasOwnProperty(k)) {
|
|
13101
|
-
rst = func(elements[k], k);
|
|
13102
|
-
|
|
13103
|
-
if (rst === false) {
|
|
13104
|
-
break;
|
|
13105
|
-
}
|
|
13106
|
-
}
|
|
13107
|
-
}
|
|
13108
|
-
}
|
|
13109
|
-
}
|
|
13110
|
-
|
|
13111
|
-
var isString$1 = function isString(str) {
|
|
13112
|
-
return isType$1(str, 'String');
|
|
13113
|
-
};
|
|
13114
|
-
/**
|
|
13115
|
-
* 判断是否数字
|
|
13116
|
-
* @return {Boolean} 是否数字
|
|
13117
|
-
*/
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
var isNumber$1 = function isNumber(value) {
|
|
13121
|
-
return isType$1(value, 'Number');
|
|
13122
|
-
}; // @ts-ignore
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
var values = Object.values ? function (obj) {
|
|
13126
|
-
return Object.values(obj);
|
|
13127
|
-
} : function (obj) {
|
|
13128
|
-
var result = [];
|
|
13129
|
-
each(obj, function (value, key) {
|
|
13130
|
-
if (!(isFunction$2(obj) && key === 'prototype')) {
|
|
13131
|
-
result.push(value);
|
|
13132
|
-
}
|
|
13133
|
-
});
|
|
13134
|
-
return result;
|
|
13135
|
-
};
|
|
13136
|
-
/**
|
|
13137
|
-
* _.memoize(calColor);
|
|
13138
|
-
* _.memoize(calColor, (...args) => args[0]);
|
|
13139
|
-
* @param f
|
|
13140
|
-
* @param resolver
|
|
13141
|
-
*/
|
|
13142
|
-
|
|
13143
|
-
var memoize$1 = function memoize(f, resolver) {
|
|
13144
|
-
if (!isFunction$2(f)) {
|
|
13145
|
-
throw new TypeError('Expected a function');
|
|
13146
|
-
}
|
|
13147
|
-
|
|
13148
|
-
var memoized = function memoized() {
|
|
13149
|
-
var args = [];
|
|
13150
|
-
|
|
13151
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
13152
|
-
args[_i] = arguments[_i];
|
|
13153
|
-
} // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
var key = resolver ? resolver.apply(this, args) : args[0];
|
|
13157
|
-
var cache = memoized.cache;
|
|
13158
|
-
|
|
13159
|
-
if (cache.has(key)) {
|
|
13160
|
-
return cache.get(key);
|
|
13161
|
-
}
|
|
13162
|
-
|
|
13163
|
-
var result = f.apply(this, args); // 缓存起来
|
|
13164
|
-
|
|
13165
|
-
cache.set(key, result);
|
|
13166
|
-
return result;
|
|
13167
|
-
};
|
|
13168
|
-
|
|
13169
|
-
memoized.cache = new Map();
|
|
13170
|
-
return memoized;
|
|
13171
|
-
};
|
|
13172
|
-
|
|
13173
|
-
var ctx;
|
|
13174
|
-
/**
|
|
13175
|
-
* 计算文本的宽度
|
|
13176
|
-
*/
|
|
13177
|
-
|
|
13178
|
-
memoize$1(function (text, font) {
|
|
13179
|
-
if (font === void 0) {
|
|
13180
|
-
font = {};
|
|
13181
|
-
}
|
|
13182
|
-
|
|
13183
|
-
var fontSize = font.fontSize,
|
|
13184
|
-
fontFamily = font.fontFamily,
|
|
13185
|
-
fontWeight = font.fontWeight,
|
|
13186
|
-
fontStyle = font.fontStyle,
|
|
13187
|
-
fontVariant = font.fontVariant;
|
|
13188
|
-
|
|
13189
|
-
if (!ctx) {
|
|
13190
|
-
ctx = document.createElement('canvas').getContext('2d');
|
|
13191
|
-
}
|
|
13192
|
-
|
|
13193
|
-
ctx.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
|
|
13194
|
-
return ctx.measureText(isString$1(text) ? text : '').width;
|
|
13195
|
-
}, function (text, font) {
|
|
13196
|
-
if (font === void 0) {
|
|
13197
|
-
font = {};
|
|
13198
|
-
}
|
|
13199
|
-
|
|
13200
|
-
return __spreadArrays([text], values(font)).join('');
|
|
13201
|
-
});
|
|
13202
13043
|
/**
|
|
13203
13044
|
* Common utilities
|
|
13204
13045
|
* @module glMatrix
|
|
13205
13046
|
*/
|
|
13206
13047
|
// Configuration Constants
|
|
13207
13048
|
|
|
13049
|
+
|
|
13208
13050
|
var EPSILON$1 = 0.000001;
|
|
13209
13051
|
var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
|
13210
13052
|
if (!Math.hypot) Math.hypot = function () {
|
|
@@ -14299,12 +14141,12 @@
|
|
|
14299
14141
|
options = {};
|
|
14300
14142
|
}
|
|
14301
14143
|
|
|
14302
|
-
var landmark = isString
|
|
14144
|
+
var landmark = isString(name) ? this.landmarks.find(function (l) {
|
|
14303
14145
|
return l.name === name;
|
|
14304
14146
|
}) : name;
|
|
14305
14147
|
|
|
14306
14148
|
if (landmark) {
|
|
14307
|
-
var _ref = isNumber
|
|
14149
|
+
var _ref = isNumber(options) ? {
|
|
14308
14150
|
duration: options
|
|
14309
14151
|
} : options,
|
|
14310
14152
|
_ref$easing = _ref.easing,
|
|
@@ -14440,6 +14282,94 @@
|
|
|
14440
14282
|
|
|
14441
14283
|
GlobalContainer$1.register(exports.AdvancedCamera);
|
|
14442
14284
|
|
|
14285
|
+
DisplayObject.prototype.getCount = function () {
|
|
14286
|
+
return this.childElementCount;
|
|
14287
|
+
}; // @ts-ignore
|
|
14288
|
+
|
|
14289
|
+
|
|
14290
|
+
DisplayObject.prototype.getParent = function () {
|
|
14291
|
+
return this.parentElement;
|
|
14292
|
+
}; // @ts-ignore
|
|
14293
|
+
|
|
14294
|
+
|
|
14295
|
+
DisplayObject.prototype.getChildren = function () {
|
|
14296
|
+
return this.children;
|
|
14297
|
+
}; // @ts-ignore
|
|
14298
|
+
|
|
14299
|
+
|
|
14300
|
+
DisplayObject.prototype.getFirst = function () {
|
|
14301
|
+
return this.firstElementChild;
|
|
14302
|
+
}; // @ts-ignore
|
|
14303
|
+
|
|
14304
|
+
|
|
14305
|
+
DisplayObject.prototype.getLast = function () {
|
|
14306
|
+
return this.lastElementChild;
|
|
14307
|
+
}; // @ts-ignore
|
|
14308
|
+
|
|
14309
|
+
|
|
14310
|
+
DisplayObject.prototype.getChildByIndex = function (index) {
|
|
14311
|
+
return this.children[index] || null;
|
|
14312
|
+
}; // @ts-ignore
|
|
14313
|
+
|
|
14314
|
+
|
|
14315
|
+
DisplayObject.prototype.add = function (child, index) {
|
|
14316
|
+
return this.appendChild(child, index);
|
|
14317
|
+
}; // @ts-ignore
|
|
14318
|
+
|
|
14319
|
+
|
|
14320
|
+
DisplayObject.prototype.setClip = function (clipPath) {
|
|
14321
|
+
this.style.clipPath = clipPath;
|
|
14322
|
+
}; // @ts-ignore
|
|
14323
|
+
|
|
14324
|
+
|
|
14325
|
+
DisplayObject.prototype.getClip = function () {
|
|
14326
|
+
return this.style.clipPath || null;
|
|
14327
|
+
}; // @ts-ignore
|
|
14328
|
+
|
|
14329
|
+
|
|
14330
|
+
DisplayObject.prototype.set = function (name, value) {
|
|
14331
|
+
this.config[name] = value;
|
|
14332
|
+
}; // @ts-ignore
|
|
14333
|
+
|
|
14334
|
+
|
|
14335
|
+
DisplayObject.prototype.get = function (name) {
|
|
14336
|
+
return this.config[name];
|
|
14337
|
+
}; // @ts-ignore
|
|
14338
|
+
|
|
14339
|
+
|
|
14340
|
+
DisplayObject.prototype.moveTo = function (position, y, z) {
|
|
14341
|
+
if (y === void 0) {
|
|
14342
|
+
y = 0;
|
|
14343
|
+
}
|
|
14344
|
+
|
|
14345
|
+
if (z === void 0) {
|
|
14346
|
+
z = 0;
|
|
14347
|
+
}
|
|
14348
|
+
|
|
14349
|
+
this.setPosition(position, y, z);
|
|
14350
|
+
return this;
|
|
14351
|
+
}; // @ts-ignore
|
|
14352
|
+
|
|
14353
|
+
|
|
14354
|
+
DisplayObject.prototype.move = function (position, y, z) {
|
|
14355
|
+
if (y === void 0) {
|
|
14356
|
+
y = 0;
|
|
14357
|
+
}
|
|
14358
|
+
|
|
14359
|
+
if (z === void 0) {
|
|
14360
|
+
z = 0;
|
|
14361
|
+
}
|
|
14362
|
+
|
|
14363
|
+
this.setPosition(position, y, z);
|
|
14364
|
+
return this;
|
|
14365
|
+
}; // @ts-ignore
|
|
14366
|
+
|
|
14367
|
+
|
|
14368
|
+
DisplayObject.prototype.setZIndex = function (zIndex) {
|
|
14369
|
+
this.style.zIndex = zIndex;
|
|
14370
|
+
return this;
|
|
14371
|
+
};
|
|
14372
|
+
|
|
14443
14373
|
function _regeneratorRuntime$1() {
|
|
14444
14374
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
14445
14375
|
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
@@ -16388,22 +16318,6 @@
|
|
|
16388
16318
|
}
|
|
16389
16319
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16390
16320
|
}
|
|
16391
|
-
/** @deprecated */
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
function __spreadArrays$1() {
|
|
16395
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
16396
|
-
s += arguments[i].length;
|
|
16397
|
-
}
|
|
16398
|
-
|
|
16399
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
16400
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
16401
|
-
r[k] = a[j];
|
|
16402
|
-
}
|
|
16403
|
-
}
|
|
16404
|
-
|
|
16405
|
-
return r;
|
|
16406
|
-
}
|
|
16407
16321
|
|
|
16408
16322
|
function _defineProperties$7(target, props) {
|
|
16409
16323
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -17098,167 +17012,6 @@
|
|
|
17098
17012
|
};
|
|
17099
17013
|
};
|
|
17100
17014
|
|
|
17101
|
-
var toString$2 = {}.toString;
|
|
17102
|
-
|
|
17103
|
-
var isType$2 = function isType(value, type) {
|
|
17104
|
-
return toString$2.call(value) === '[object ' + type + ']';
|
|
17105
|
-
};
|
|
17106
|
-
/**
|
|
17107
|
-
* 是否为函数
|
|
17108
|
-
* @param {*} fn 对象
|
|
17109
|
-
* @return {Boolean} 是否函数
|
|
17110
|
-
*/
|
|
17111
|
-
|
|
17112
|
-
|
|
17113
|
-
var isFunction$3 = function isFunction(value) {
|
|
17114
|
-
return isType$2(value, 'Function');
|
|
17115
|
-
}; // isFinite,
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
var isNil$1 = function isNil(value) {
|
|
17119
|
-
/**
|
|
17120
|
-
* isNil(null) => true
|
|
17121
|
-
* isNil() => true
|
|
17122
|
-
*/
|
|
17123
|
-
return value === null || value === undefined;
|
|
17124
|
-
};
|
|
17125
|
-
|
|
17126
|
-
var isArray$1 = function isArray(value) {
|
|
17127
|
-
return Array.isArray ? Array.isArray(value) : isType$2(value, 'Array');
|
|
17128
|
-
};
|
|
17129
|
-
|
|
17130
|
-
var isObject$2 = function isObject(value) {
|
|
17131
|
-
/**
|
|
17132
|
-
* isObject({}) => true
|
|
17133
|
-
* isObject([1, 2, 3]) => true
|
|
17134
|
-
* isObject(Function) => true
|
|
17135
|
-
* isObject(null) => false
|
|
17136
|
-
*/
|
|
17137
|
-
var type = typeof value;
|
|
17138
|
-
return value !== null && type === 'object' || type === 'function';
|
|
17139
|
-
};
|
|
17140
|
-
|
|
17141
|
-
function each$1(elements, func) {
|
|
17142
|
-
if (!elements) {
|
|
17143
|
-
return;
|
|
17144
|
-
}
|
|
17145
|
-
|
|
17146
|
-
var rst;
|
|
17147
|
-
|
|
17148
|
-
if (isArray$1(elements)) {
|
|
17149
|
-
for (var i = 0, len = elements.length; i < len; i++) {
|
|
17150
|
-
rst = func(elements[i], i);
|
|
17151
|
-
|
|
17152
|
-
if (rst === false) {
|
|
17153
|
-
break;
|
|
17154
|
-
}
|
|
17155
|
-
}
|
|
17156
|
-
} else if (isObject$2(elements)) {
|
|
17157
|
-
for (var k in elements) {
|
|
17158
|
-
if (elements.hasOwnProperty(k)) {
|
|
17159
|
-
rst = func(elements[k], k);
|
|
17160
|
-
|
|
17161
|
-
if (rst === false) {
|
|
17162
|
-
break;
|
|
17163
|
-
}
|
|
17164
|
-
}
|
|
17165
|
-
}
|
|
17166
|
-
}
|
|
17167
|
-
}
|
|
17168
|
-
|
|
17169
|
-
var isString$2 = function isString(str) {
|
|
17170
|
-
return isType$2(str, 'String');
|
|
17171
|
-
};
|
|
17172
|
-
|
|
17173
|
-
var clamp$1 = function clamp(a, min, max) {
|
|
17174
|
-
if (a < min) {
|
|
17175
|
-
return min;
|
|
17176
|
-
} else if (a > max) {
|
|
17177
|
-
return max;
|
|
17178
|
-
}
|
|
17179
|
-
|
|
17180
|
-
return a;
|
|
17181
|
-
}; // @ts-ignore
|
|
17182
|
-
|
|
17183
|
-
|
|
17184
|
-
var values$1 = Object.values ? function (obj) {
|
|
17185
|
-
return Object.values(obj);
|
|
17186
|
-
} : function (obj) {
|
|
17187
|
-
var result = [];
|
|
17188
|
-
each$1(obj, function (value, key) {
|
|
17189
|
-
if (!(isFunction$3(obj) && key === 'prototype')) {
|
|
17190
|
-
result.push(value);
|
|
17191
|
-
}
|
|
17192
|
-
});
|
|
17193
|
-
return result;
|
|
17194
|
-
};
|
|
17195
|
-
/**
|
|
17196
|
-
* _.memoize(calColor);
|
|
17197
|
-
* _.memoize(calColor, (...args) => args[0]);
|
|
17198
|
-
* @param f
|
|
17199
|
-
* @param resolver
|
|
17200
|
-
*/
|
|
17201
|
-
|
|
17202
|
-
var memoize$2 = function memoize(f, resolver) {
|
|
17203
|
-
if (!isFunction$3(f)) {
|
|
17204
|
-
throw new TypeError('Expected a function');
|
|
17205
|
-
}
|
|
17206
|
-
|
|
17207
|
-
var memoized = function memoized() {
|
|
17208
|
-
var args = [];
|
|
17209
|
-
|
|
17210
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
17211
|
-
args[_i] = arguments[_i];
|
|
17212
|
-
} // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
var key = resolver ? resolver.apply(this, args) : args[0];
|
|
17216
|
-
var cache = memoized.cache;
|
|
17217
|
-
|
|
17218
|
-
if (cache.has(key)) {
|
|
17219
|
-
return cache.get(key);
|
|
17220
|
-
}
|
|
17221
|
-
|
|
17222
|
-
var result = f.apply(this, args); // 缓存起来
|
|
17223
|
-
|
|
17224
|
-
cache.set(key, result);
|
|
17225
|
-
return result;
|
|
17226
|
-
};
|
|
17227
|
-
|
|
17228
|
-
memoized.cache = new Map();
|
|
17229
|
-
return memoized;
|
|
17230
|
-
};
|
|
17231
|
-
|
|
17232
|
-
var ctx$1;
|
|
17233
|
-
/**
|
|
17234
|
-
* 计算文本的宽度
|
|
17235
|
-
*/
|
|
17236
|
-
|
|
17237
|
-
memoize$2(function (text, font) {
|
|
17238
|
-
if (font === void 0) {
|
|
17239
|
-
font = {};
|
|
17240
|
-
}
|
|
17241
|
-
|
|
17242
|
-
var fontSize = font.fontSize,
|
|
17243
|
-
fontFamily = font.fontFamily,
|
|
17244
|
-
fontWeight = font.fontWeight,
|
|
17245
|
-
fontStyle = font.fontStyle,
|
|
17246
|
-
fontVariant = font.fontVariant;
|
|
17247
|
-
|
|
17248
|
-
if (!ctx$1) {
|
|
17249
|
-
ctx$1 = document.createElement('canvas').getContext('2d');
|
|
17250
|
-
}
|
|
17251
|
-
|
|
17252
|
-
ctx$1.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
|
|
17253
|
-
return ctx$1.measureText(isString$2(text) ? text : '').width;
|
|
17254
|
-
}, function (text, font) {
|
|
17255
|
-
if (font === void 0) {
|
|
17256
|
-
font = {};
|
|
17257
|
-
}
|
|
17258
|
-
|
|
17259
|
-
return __spreadArrays$1([text], values$1(font)).join('');
|
|
17260
|
-
});
|
|
17261
|
-
|
|
17262
17015
|
var convertToDash = function convertToDash(str) {
|
|
17263
17016
|
str = str.replace(/([A-Z])/g, function (letter) {
|
|
17264
17017
|
return "-" + letter.toLowerCase();
|
|
@@ -17322,8 +17075,8 @@
|
|
|
17322
17075
|
amplitude = _params$ === void 0 ? 1 : _params$,
|
|
17323
17076
|
_params$2 = _params[1],
|
|
17324
17077
|
period = _params$2 === void 0 ? 0.5 : _params$2;
|
|
17325
|
-
var a = clamp
|
|
17326
|
-
var p = clamp
|
|
17078
|
+
var a = clamp(Number(amplitude), 1, 10);
|
|
17079
|
+
var p = clamp(Number(period), 0.1, 2);
|
|
17327
17080
|
if (t === 0 || t === 1) return t;
|
|
17328
17081
|
return -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p);
|
|
17329
17082
|
};
|
|
@@ -17342,10 +17095,10 @@
|
|
|
17342
17095
|
damping = _params2$3 === void 0 ? 10 : _params2$3,
|
|
17343
17096
|
_params2$4 = _params2[3],
|
|
17344
17097
|
velocity = _params2$4 === void 0 ? 0 : _params2$4;
|
|
17345
|
-
mass = clamp
|
|
17346
|
-
stiffness = clamp
|
|
17347
|
-
damping = clamp
|
|
17348
|
-
velocity = clamp
|
|
17098
|
+
mass = clamp(mass, 0.1, 1000);
|
|
17099
|
+
stiffness = clamp(stiffness, 0.1, 1000);
|
|
17100
|
+
damping = clamp(damping, 0.1, 1000);
|
|
17101
|
+
velocity = clamp(velocity, 0.1, 1000);
|
|
17349
17102
|
var w0 = Math.sqrt(stiffness / mass);
|
|
17350
17103
|
var zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
|
17351
17104
|
var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
|
|
@@ -17430,7 +17183,7 @@
|
|
|
17430
17183
|
steps = _params3$ === void 0 ? 10 : _params3$,
|
|
17431
17184
|
type = _params3[1];
|
|
17432
17185
|
var trunc = type == 'start' ? Math.ceil : Math.floor;
|
|
17433
|
-
return trunc(clamp
|
|
17186
|
+
return trunc(clamp(t, 0, 1) * steps) / steps;
|
|
17434
17187
|
}; // @ts-ignore
|
|
17435
17188
|
|
|
17436
17189
|
|
|
@@ -18139,7 +17892,7 @@
|
|
|
18139
17892
|
for (var i = 0; i < keyframes.length; i++) {
|
|
18140
17893
|
var offset = keyframes[i].offset;
|
|
18141
17894
|
|
|
18142
|
-
if (!isNil
|
|
17895
|
+
if (!isNil(offset)) {
|
|
18143
17896
|
if (offset < previousOffset) {
|
|
18144
17897
|
throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
|
|
18145
17898
|
}
|
|
@@ -18172,7 +17925,7 @@
|
|
|
18172
17925
|
for (var _i = 1; _i < length; _i++) {
|
|
18173
17926
|
var _offset = keyframes[_i].computedOffset;
|
|
18174
17927
|
|
|
18175
|
-
if (!isNil
|
|
17928
|
+
if (!isNil(_offset) && !isNil(previousOffset)) {
|
|
18176
17929
|
for (var j = 1; j < _i - previousIndex; j++) {
|
|
18177
17930
|
keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
|
|
18178
17931
|
}
|