@antv/g 5.13.1 → 5.13.3

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 CHANGED
@@ -2814,6 +2814,20 @@
2814
2814
  out[2] = a[2] * b;
2815
2815
  return out;
2816
2816
  }
2817
+ /**
2818
+ * Calculates the euclidian distance between two vec3's
2819
+ *
2820
+ * @param {ReadonlyVec3} a the first operand
2821
+ * @param {ReadonlyVec3} b the second operand
2822
+ * @returns {Number} distance between a and b
2823
+ */
2824
+
2825
+ function distance(a, b) {
2826
+ var x = b[0] - a[0];
2827
+ var y = b[1] - a[1];
2828
+ var z = b[2] - a[2];
2829
+ return Math.hypot(x, y, z);
2830
+ }
2817
2831
  /**
2818
2832
  * Normalize a vec3
2819
2833
  *
@@ -2994,6 +3008,12 @@
2994
3008
  */
2995
3009
 
2996
3010
  var sub$1 = subtract$1;
3011
+ /**
3012
+ * Alias for {@link vec3.distance}
3013
+ * @function
3014
+ */
3015
+
3016
+ var dist = distance;
2997
3017
  /**
2998
3018
  * Alias for {@link vec3.length}
2999
3019
  * @function
@@ -5264,11 +5284,16 @@
5264
5284
  return result[0].length === result[1].length ? result : equalizeSegments(result[0], result[1], tl);
5265
5285
  }
5266
5286
 
5287
+ var toString = {}.toString;
5288
+ var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
5289
+
5267
5290
  /**
5268
- * @see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isfunction
5291
+ * 是否为函数
5292
+ * @param {*} fn 对象
5293
+ * @return {Boolean} 是否函数
5269
5294
  */
5270
5295
  var isFunction = (function (value) {
5271
- return typeof value === 'function';
5296
+ return isType(value, 'Function');
5272
5297
  });
5273
5298
 
5274
5299
  // isFinite,
@@ -5280,9 +5305,6 @@
5280
5305
  return value === null || value === undefined;
5281
5306
  };
5282
5307
 
5283
- var toString = {}.toString;
5284
- var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
5285
-
5286
5308
  var isArray = (function (value) {
5287
5309
  return Array.isArray ? Array.isArray(value) : isType(value, 'Array');
5288
5310
  });
@@ -5816,7 +5838,7 @@
5816
5838
  * @return {number} 距离
5817
5839
  */
5818
5840
 
5819
- function distance(x1, y1, x2, y2) {
5841
+ function distance$1(x1, y1, x2, y2) {
5820
5842
  var dx = x1 - x2;
5821
5843
  var dy = y1 - y2;
5822
5844
  return Math.sqrt(dx * dx + dy * dy);
@@ -5864,7 +5886,7 @@
5864
5886
  * @return {number} 距离
5865
5887
  */
5866
5888
  length: function length(x1, y1, x2, y2) {
5867
- return distance(x1, y1, x2, y2);
5889
+ return distance$1(x1, y1, x2, y2);
5868
5890
  },
5869
5891
 
5870
5892
  /**
@@ -5899,13 +5921,13 @@
5899
5921
  var cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
5900
5922
 
5901
5923
  if (cross < 0) {
5902
- return distance(x1, y1, x, y);
5924
+ return distance$1(x1, y1, x, y);
5903
5925
  }
5904
5926
 
5905
5927
  var lengthSquare = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
5906
5928
 
5907
5929
  if (cross > lengthSquare) {
5908
- return distance(x2, y2, x, y);
5930
+ return distance$1(x2, y2, x, y);
5909
5931
  }
5910
5932
 
5911
5933
  return this.pointToLine(x1, y1, x2, y2, x, y);
@@ -5973,7 +5995,7 @@
5973
5995
  var _t = i * increaseRate;
5974
5996
 
5975
5997
  var v1 = [tCallback.apply(void 0, xArr.concat([_t])), tCallback.apply(void 0, yArr.concat([_t]))];
5976
- var d1 = distance(v0[0], v0[1], v1[0], v1[1]);
5998
+ var d1 = distance$1(v0[0], v0[1], v1[0], v1[1]);
5977
5999
 
5978
6000
  if (d1 < d) {
5979
6001
  t = _t;
@@ -6008,14 +6030,14 @@
6008
6030
  var next = t + interval;
6009
6031
  var _v = [tCallback.apply(void 0, xArr.concat([prev])), tCallback.apply(void 0, yArr.concat([prev]))];
6010
6032
 
6011
- var _d = distance(v0[0], v0[1], _v[0], _v[1]);
6033
+ var _d = distance$1(v0[0], v0[1], _v[0], _v[1]);
6012
6034
 
6013
6035
  if (prev >= 0 && _d < d) {
6014
6036
  t = prev;
6015
6037
  d = _d;
6016
6038
  } else {
6017
6039
  var v2 = [tCallback.apply(void 0, xArr.concat([next])), tCallback.apply(void 0, yArr.concat([next]))];
6018
- var d2 = distance(v0[0], v0[1], v2[0], v2[1]);
6040
+ var d2 = distance$1(v0[0], v0[1], v2[0], v2[1]);
6019
6041
 
6020
6042
  if (next <= 1 && d2 < d) {
6021
6043
  t = next;
@@ -6042,7 +6064,7 @@
6042
6064
  var y = yArr[i];
6043
6065
  var nextX = xArr[(i + 1) % count];
6044
6066
  var nextY = yArr[(i + 1) % count];
6045
- totalLength += distance(x, y, nextX, nextY);
6067
+ totalLength += distance$1(x, y, nextX, nextY);
6046
6068
  }
6047
6069
 
6048
6070
  return totalLength / 2;
@@ -6089,7 +6111,7 @@
6089
6111
 
6090
6112
  function quadraticLength(x1, y1, x2, y2, x3, y3, iterationCount) {
6091
6113
  if (iterationCount === 0) {
6092
- return (distance(x1, y1, x2, y2) + distance(x2, y2, x3, y3) + distance(x1, y1, x3, y3)) / 2;
6114
+ return (distance$1(x1, y1, x2, y2) + distance$1(x2, y2, x3, y3) + distance$1(x1, y1, x3, y3)) / 2;
6093
6115
  }
6094
6116
 
6095
6117
  var quadratics = divideQuadratic(x1, y1, x2, y2, x3, y3, 0.5);
@@ -6126,7 +6148,7 @@
6126
6148
  },
6127
6149
  pointDistance: function pointDistance(x1, y1, x2, y2, x3, y3, x0, y0) {
6128
6150
  var point = this.nearestPoint(x1, y1, x2, y2, x3, y3, x0, y0);
6129
- return distance(point.x, point.y, x0, y0);
6151
+ return distance$1(point.x, point.y, x0, y0);
6130
6152
  },
6131
6153
  interpolationAt: quadraticAt,
6132
6154
  pointAt: function pointAt(x1, y1, x2, y2, x3, y3, t) {
@@ -6250,7 +6272,7 @@
6250
6272
  },
6251
6273
  pointDistance: function pointDistance(x1, y1, x2, y2, x3, y3, x4, y4, x0, y0, length) {
6252
6274
  var point = this.nearestPoint(x1, y1, x2, y2, x3, y3, x4, y4, x0, y0, length);
6253
- return distance(point.x, point.y, x0, y0);
6275
+ return distance$1(point.x, point.y, x0, y0);
6254
6276
  },
6255
6277
  interpolationAt: cubicAt,
6256
6278
  pointAt: function pointAt(x1, y1, x2, y2, x3, y3, x4, y4, t) {
@@ -6379,7 +6401,7 @@
6379
6401
  */
6380
6402
  pointDistance: function pointDistance(x, y, rx, ry, x0, y0) {
6381
6403
  var nearestPoint = this.nearestPoint(x, y, rx, ry, x0, y0);
6382
- return distance(nearestPoint.x, nearestPoint.y, x0, y0);
6404
+ return distance$1(nearestPoint.x, nearestPoint.y, x0, y0);
6383
6405
  },
6384
6406
 
6385
6407
  /**
@@ -6611,7 +6633,7 @@
6611
6633
  },
6612
6634
  pointDistance: function pointDistance(cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) {
6613
6635
  var nearestPoint = this.nearestPoint(cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0);
6614
- return distance(nearestPoint.x, nearestPoint.y, x0, y0);
6636
+ return distance$1(nearestPoint.x, nearestPoint.y, x0, y0);
6615
6637
  },
6616
6638
  pointAt: function pointAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, t) {
6617
6639
  var angle = (endAngle - startAngle) * t + startAngle;
@@ -6636,7 +6658,7 @@
6636
6658
  for (var i = 0; i < points.length - 1; i++) {
6637
6659
  var from = points[i];
6638
6660
  var to = points[i + 1];
6639
- var length = distance(from[0], from[1], to[0], to[1]);
6661
+ var length = distance$1(from[0], from[1], to[0], to[1]);
6640
6662
  var seg = {
6641
6663
  from: from,
6642
6664
  to: to,
@@ -6662,7 +6684,7 @@
6662
6684
  for (var i = 0; i < points.length - 1; i++) {
6663
6685
  var from = points[i];
6664
6686
  var to = points[i + 1];
6665
- totalLength += distance(from[0], from[1], to[0], to[1]);
6687
+ totalLength += distance$1(from[0], from[1], to[0], to[1]);
6666
6688
  }
6667
6689
 
6668
6690
  return totalLength;
@@ -7235,7 +7257,7 @@
7235
7257
  set$1(this.planes[5].normal,m3+m2,m7+m6,m11+m10);this.planes[5].distance=m15+m14;this.planes.forEach(function(plane){plane.normalize();plane.updatePNVertexFlag();});};return Frustum;}();var Point=/*#__PURE__*/function(){function Point(x,y){if(x===void 0){x=0;}if(y===void 0){y=0;}this.x=0;this.y=0;this.x=x;this.y=y;}var _proto=Point.prototype;_proto.clone=function clone(){return new Point(this.x,this.y);};_proto.copyFrom=function copyFrom(p){this.x=p.x;this.y=p.y;};return Point;}();var Rectangle=/*#__PURE__*/function(){function Rectangle(x,y,width,height){this.x=void 0;this.y=void 0;this.width=void 0;this.height=void 0;this.left=void 0;this.right=void 0;this.top=void 0;this.bottom=void 0;this.x=x;this.y=y;this.width=width;this.height=height;this.left=x;this.right=x+width;this.top=y;this.bottom=y+height;}var _proto=Rectangle.prototype;_proto.toJSON=function toJSON(){};return Rectangle;}();(function(Shape){Shape["GROUP"]="g";Shape["CIRCLE"]="circle";Shape["ELLIPSE"]="ellipse";Shape["IMAGE"]="image";Shape["RECT"]="rect";Shape["LINE"]="line";Shape["POLYLINE"]="polyline";Shape["POLYGON"]="polygon";Shape["TEXT"]="text";Shape["PATH"]="path";Shape["HTML"]="html";Shape["MESH"]="mesh";})(exports.Shape||(exports.Shape={}));var camelCase=memoize(function(str){if(str===void 0){str='';}return str.replace(/-([a-z])/g,function(g){return g[1].toUpperCase();});});function DCHECK(bool){if(!bool){throw new Error();}}function DCHECK_EQ(a,b){if(a!==b){throw new Error();}}function DCHECK_NE(a,b){if(a===b){throw new Error();}}function isFunction$1(func){return typeof func==='function';}var definedProps=function definedProps(obj){return Object.fromEntries(Object.entries(obj).filter(function(_ref){var v=_ref[1];return v!==undefined;}));};var FORMAT_ATTR_MAP={d:{alias:'path'},strokeDasharray:{alias:'lineDash'},strokeWidth:{alias:'lineWidth'},textAnchor:{alias:'textAlign'},src:{alias:'img'}};var formatAttributeName=memoize(function(name){var attributeName=camelCase(name);var map=FORMAT_ATTR_MAP[attributeName];attributeName=(map===null||map===void 0?void 0:map.alias)||attributeName;return attributeName;});var canvasMap={};var defaultCanvasIdCounter=0;/**
7236
7258
  * destroy existed canvas with the same id
7237
7259
  */function cleanExistedCanvas(container,canvas){if(container){var id=typeof container==='string'?container:container.id||defaultCanvasIdCounter++;if(canvasMap[id]){canvasMap[id].destroy();}canvasMap[id]=canvas;}}var isBrowser=typeof window!=='undefined'&&typeof window.document!=='undefined';function sortByZIndex(o1,o2){var zIndex1=Number(o1.style.zIndex);var zIndex2=Number(o2.style.zIndex);if(zIndex1===zIndex2){// return o1.entity.getComponent(Sortable).lastSortedIndex - o2.entity.getComponent(Sortable).lastSortedIndex;
7238
- var parent=o1.parentNode;if(parent){var children=parent.childNodes||[];return children.indexOf(o1)-children.indexOf(o2);}}return zIndex1-zIndex2;}function findClosestClipPathTarget(object){var el=object;do{var _el$style;var clipPath=(_el$style=el.style)===null||_el$style===void 0?void 0:_el$style.clipPath;if(clipPath)return el;el=el.parentElement;}while(el!==null);return null;}var PX_SUFFIX='px';function setDOMSize($el,width,height){if(isBrowser&&$el.style){$el.style.width=width+PX_SUFFIX;$el.style.height=height+PX_SUFFIX;}}function getStyle($el,property){if(isBrowser){return document.defaultView.getComputedStyle($el,null).getPropertyValue(property);}}function getWidth($el){var width=getStyle($el,'width');if(width==='auto'){return $el.offsetWidth;}return parseFloat(width);}function getHeight($el){var height=getStyle($el,'height');if(height==='auto'){return $el.offsetHeight;}return parseFloat(height);}var ERROR_MSG_METHOD_NOT_IMPLEMENTED='Method not implemented.';var ERROR_MSG_USE_DOCUMENT_ELEMENT='Use document.documentElement instead.';// borrow from hammer.js
7260
+ var parent=o1.parentNode;if(parent){var children=parent.childNodes||[];return children.indexOf(o1)-children.indexOf(o2);}}return zIndex1-zIndex2;}function findClosestClipPathTarget(object){var el=object;do{var _el$style;var clipPath=(_el$style=el.style)===null||_el$style===void 0?void 0:_el$style.clipPath;if(clipPath)return el;el=el.parentElement;}while(el!==null);return null;}var PX_SUFFIX='px';function setDOMSize($el,width,height){if(isBrowser&&$el.style){$el.style.width=width+PX_SUFFIX;$el.style.height=height+PX_SUFFIX;}}function getStyle($el,property){if(isBrowser){return document.defaultView.getComputedStyle($el,null).getPropertyValue(property);}}function getWidth($el){var width=getStyle($el,'width');if(width==='auto'){return $el.offsetWidth;}return parseFloat(width);}function getHeight($el){var height=getStyle($el,'height');if(height==='auto'){return $el.offsetHeight;}return parseFloat(height);}var ERROR_MSG_METHOD_NOT_IMPLEMENTED='Method not implemented.';var ERROR_MSG_USE_DOCUMENT_ELEMENT='Use document.documentElement instead.';var ERROR_MSG_APPEND_DESTROYED_ELEMENT='Cannot append a destroyed element.';// borrow from hammer.js
7239
7261
  var MOUSE_POINTER_ID=1;var TOUCH_TO_POINTER={touchstart:'pointerdown',touchend:'pointerup',touchendoutside:'pointerupoutside',touchmove:'pointermove',touchcancel:'pointercancel'};function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else "return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return {value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}(innerFn,self,context),generator;}function tryCatch(fn,obj,arg){try{return {type:"normal",arg:fn.call(obj,arg)};}catch(err){return {type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==typeof value&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return {next:doneResult};}function doneResult(){return {value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return !!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return {__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return "[object Generator]";}),exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else {if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return "break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _extends(){_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return {};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _createForOfIteratorHelperLoose(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;return function(){if(i>=o.length)return {done:true};return {done:false,value:o[i++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}// These units are iterated through, so be careful when adding or changing the
7240
7262
  // order.
7241
7263
  (function(UnitType){UnitType[UnitType["kUnknown"]=0]="kUnknown";UnitType[UnitType["kNumber"]=1]="kNumber";UnitType[UnitType["kPercentage"]=2]="kPercentage";// Length units
@@ -7959,12 +7981,13 @@
7959
7981
  * eg.
7960
7982
  * * [0.5, 0.5] -> [CSSUnitValue, CSSUnitValue]
7961
7983
  */var parseNumberList=memoize(function(string){if(isString(string)){return string.split(' ').map(parseNumber);}else {return string.map(parseNumber);}});function mergeNumbers(left,right){return [left,right,numberToString];}function clampedMergeNumbers(min,max){return function(left,right){return [left,right,function(x){return numberToString(clamp(x,min,max));}];};}function mergeNumberLists(left,right){if(left.length!==right.length){return;}return [left,right,function(numberList){return numberList;}];}var internalParsePath=function internalParsePath(path){// empty path
7962
- if(path===''||Array.isArray(path)&&path.length===0){return {absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:[],totalLength:0,zCommandIndexes:[],rect:{x:0,y:0,width:0,height:0}};}var absolutePath;try{absolutePath=normalizePath(path);}catch(e){absolutePath=normalizePath('');console.error("[g]: Invalid SVG Path definition: "+path);}var hasArc=hasArcOrBezier(absolutePath);var _extractPolygons=extractPolygons(absolutePath),polygons=_extractPolygons.polygons,polylines=_extractPolygons.polylines;// convert to curves to do morphing & picking later
7963
- // @see http://thednp.github.io/kute.js/svgCubicMorph.html
7964
- var _path2Curve=path2Curve(absolutePath,true),curve=_path2Curve[0],zCommandIndexes=_path2Curve[1];// for later use
7984
+ if(path===''||Array.isArray(path)&&path.length===0){return {absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};}var absolutePath;try{absolutePath=normalizePath(path);}catch(e){absolutePath=normalizePath('');console.error("[g]: Invalid SVG Path definition: "+path);}var hasArc=hasArcOrBezier(absolutePath);var _extractPolygons=extractPolygons(absolutePath),polygons=_extractPolygons.polygons,polylines=_extractPolygons.polylines;// for later use
7965
7985
  var segments=path2Segments(absolutePath);// Only calculate bbox here since we don't need length now.
7966
- var _getPathBBox=getPathBBox(segments,0),x=_getPathBBox.x,y=_getPathBBox.y,width=_getPathBBox.width,height=_getPathBBox.height;return {absolutePath:absolutePath,hasArc:hasArc,segments:segments,polygons:polygons,polylines:polylines,curve:curve,// Delay the calculation of length.
7967
- totalLength:0,zCommandIndexes:zCommandIndexes,rect:{x:Number.isFinite(x)?x:0,y:Number.isFinite(y)?y:0,width:Number.isFinite(width)?width:0,height:Number.isFinite(height)?height:0}};};var memoizedParsePath=memoize(internalParsePath);function parsePath(path,object){var result=isString(path)?memoizedParsePath(path):internalParsePath(path);if(object){object.parsedStyle.defX=result.rect.x;object.parsedStyle.defY=result.rect.y;}return result;}function mergePaths(left,right,object){var curve1=left.curve;var curve2=right.curve;var curves=[curve1,curve2];if(curve1.length!==curve2.length){curves=equalizeSegments(curve1,curve2);}var curve0=getDrawDirection(curves[0])!==getDrawDirection(curves[1])?reverseCurve(curves[0]):clonePath(curves[0]);return [curve0,getRotatedCurve(curves[1],curve0),function(pathArray){// need converting to path string?
7986
+ var _getPathBBox=getPathBBox(segments,0),x=_getPathBBox.x,y=_getPathBBox.y,width=_getPathBBox.width,height=_getPathBBox.height;return {absolutePath:absolutePath,hasArc:hasArc,segments:segments,polygons:polygons,polylines:polylines,// curve,
7987
+ // Delay the calculation of length.
7988
+ totalLength:0,rect:{x:Number.isFinite(x)?x:0,y:Number.isFinite(y)?y:0,width:Number.isFinite(width)?width:0,height:Number.isFinite(height)?height:0}};};var memoizedParsePath=memoize(internalParsePath);function parsePath(path,object){var result=isString(path)?memoizedParsePath(path):internalParsePath(path);if(object){object.parsedStyle.defX=result.rect.x;object.parsedStyle.defY=result.rect.y;}return result;}function mergePaths(left,right,object){var curve1=left.curve;var curve2=right.curve;if(!curve1||curve1.length===0){// convert to curves to do morphing & picking later
7989
+ // @see http://thednp.github.io/kute.js/svgCubicMorph.html
7990
+ curve1=path2Curve(left.absolutePath,false);left.curve=curve1;}if(!curve2||curve2.length===0){curve2=path2Curve(right.absolutePath,false);right.curve=curve2;}var curves=[curve1,curve2];if(curve1.length!==curve2.length){curves=equalizeSegments(curve1,curve2);}var curve0=getDrawDirection(curves[0])!==getDrawDirection(curves[1])?reverseCurve(curves[0]):clonePath(curves[0]);return [curve0,getRotatedCurve(curves[1],curve0),function(pathArray){// need converting to path string?
7968
7991
  return pathArray;}];}/**
7969
7992
  * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/points
7970
7993
  *
@@ -8067,7 +8090,7 @@
8067
8090
  var point=offsetPath.getPoint(offsetDistance);if(point){object.parsedStyle.defX=point.x;object.parsedStyle.defY=point.y;object.setLocalPosition(point.x,point.y);}}};return CSSPropertyOffsetDistance;}();/**
8068
8091
  * opacity
8069
8092
  */var CSSPropertyOpacity=/*#__PURE__*/function(){function CSSPropertyOpacity(){this.parser=parseNumber;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOpacity.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyOpacity;}();var CSSPropertyPath=/*#__PURE__*/function(){function CSSPropertyPath(){this.parser=parsePath;this.mixer=mergePaths;}var _proto=CSSPropertyPath.prototype;_proto.calculator=function calculator(name,oldParsed,parsed){// unset
8070
- if(parsed instanceof CSSKeywordValue&&parsed.value==='unset'){return {absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:[],totalLength:0,zCommandIndexes:[],rect:new Rectangle(0,0,0,0)};}return parsed;};/**
8093
+ if(parsed instanceof CSSKeywordValue&&parsed.value==='unset'){return {absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Rectangle(0,0,0,0)};}return parsed;};/**
8071
8094
  * update local position
8072
8095
  */_proto.postProcessor=function postProcessor(object){if(object.nodeName===exports.Shape.PATH){var _object$parsedStyle=object.parsedStyle,_object$parsedStyle$d=_object$parsedStyle.defX,defX=_object$parsedStyle$d===void 0?0:_object$parsedStyle$d,_object$parsedStyle$d2=_object$parsedStyle.defY,defY=_object$parsedStyle$d2===void 0?0:_object$parsedStyle$d2;object.setLocalPosition(defX,defY);}};return CSSPropertyPath;}();var CSSPropertyPoints=/*#__PURE__*/function(){function CSSPropertyPoints(){this.parser=parsePoints;}var _proto=CSSPropertyPoints.prototype;/**
8073
8096
  * update local position
@@ -8204,12 +8227,32 @@
8204
8227
  var extra={// 水平方向投影
8205
8228
  xExtra:Math.cos(currentAngle/2-xAngle)*(lineWidth/2*(1/Math.sin(currentAngle/2)))-lineWidth/2||0,// 垂直方向投影
8206
8229
  yExtra:Math.cos(yAngle-currentAngle/2)*(lineWidth/2*(1/Math.sin(currentAngle/2)))-lineWidth/2||0};return extra;}// 点对称
8207
- function toSymmetry(point,center){return [center[0]+(center[0]-point[0]),center[1]+(center[1]-point[1])];}function path2Segments(path){var segments=[];var currentPoint=null;// 当前图形
8230
+ function toSymmetry(point,center){return [center[0]+(center[0]-point[0]),center[1]+(center[1]-point[1])];}var angleBetween$1=function angleBetween(v0,v1){var p=v0.x*v1.x+v0.y*v1.y;var n=Math.sqrt((Math.pow(v0.x,2)+Math.pow(v0.y,2))*(Math.pow(v1.x,2)+Math.pow(v1.y,2)));var sign=v0.x*v1.y-v0.y*v1.x<0?-1:1;var angle=sign*Math.acos(p/n);return angle;};/**
8231
+ * @see https://github.com/rveciana/svg-path-properties/blob/b6bd9a322966f6ef7a311872d80c56e3718de861/src/arc.ts#L121
8232
+ */var pointOnEllipticalArc=function pointOnEllipticalArc(p0,rx,ry,xAxisRotation,largeArcFlag,sweepFlag,p1,t){// In accordance to: http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters
8233
+ rx=Math.abs(rx);ry=Math.abs(ry);xAxisRotation=mod(xAxisRotation,360);var xAxisRotationRadians=deg2rad(xAxisRotation);// If the endpoints are identical, then this is equivalent to omitting the elliptical arc segment entirely.
8234
+ if(p0.x===p1.x&&p0.y===p1.y){return {x:p0.x,y:p0.y,ellipticalArcAngle:0};// Check if angle is correct
8235
+ }// If rx = 0 or ry = 0 then this arc is treated as a straight line segment joining the endpoints.
8236
+ if(rx===0||ry===0){//return this.pointOnLine(p0, p1, t);
8237
+ return {x:0,y:0,ellipticalArcAngle:0};// Check if angle is correct
8238
+ }// Following "Conversion from endpoint to center parameterization"
8239
+ // http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
8240
+ // Step #1: Compute transformedPoint
8241
+ var dx=(p0.x-p1.x)/2;var dy=(p0.y-p1.y)/2;var transformedPoint={x:Math.cos(xAxisRotationRadians)*dx+Math.sin(xAxisRotationRadians)*dy,y:-Math.sin(xAxisRotationRadians)*dx+Math.cos(xAxisRotationRadians)*dy};// Ensure radii are large enough
8242
+ var radiiCheck=Math.pow(transformedPoint.x,2)/Math.pow(rx,2)+Math.pow(transformedPoint.y,2)/Math.pow(ry,2);if(radiiCheck>1){rx=Math.sqrt(radiiCheck)*rx;ry=Math.sqrt(radiiCheck)*ry;}// Step #2: Compute transformedCenter
8243
+ var cSquareNumerator=Math.pow(rx,2)*Math.pow(ry,2)-Math.pow(rx,2)*Math.pow(transformedPoint.y,2)-Math.pow(ry,2)*Math.pow(transformedPoint.x,2);var cSquareRootDenom=Math.pow(rx,2)*Math.pow(transformedPoint.y,2)+Math.pow(ry,2)*Math.pow(transformedPoint.x,2);var cRadicand=cSquareNumerator/cSquareRootDenom;// Make sure this never drops below zero because of precision
8244
+ cRadicand=cRadicand<0?0:cRadicand;var cCoef=(largeArcFlag!==sweepFlag?1:-1)*Math.sqrt(cRadicand);var transformedCenter={x:cCoef*(rx*transformedPoint.y/ry),y:cCoef*(-(ry*transformedPoint.x)/rx)};// Step #3: Compute center
8245
+ var center={x:Math.cos(xAxisRotationRadians)*transformedCenter.x-Math.sin(xAxisRotationRadians)*transformedCenter.y+(p0.x+p1.x)/2,y:Math.sin(xAxisRotationRadians)*transformedCenter.x+Math.cos(xAxisRotationRadians)*transformedCenter.y+(p0.y+p1.y)/2};// Step #4: Compute start/sweep angles
8246
+ // Start angle of the elliptical arc prior to the stretch and rotate operations.
8247
+ // Difference between the start and end angles
8248
+ var startVector={x:(transformedPoint.x-transformedCenter.x)/rx,y:(transformedPoint.y-transformedCenter.y)/ry};var startAngle=angleBetween$1({x:1,y:0},startVector);var endVector={x:(-transformedPoint.x-transformedCenter.x)/rx,y:(-transformedPoint.y-transformedCenter.y)/ry};var sweepAngle=angleBetween$1(startVector,endVector);if(!sweepFlag&&sweepAngle>0){sweepAngle-=2*Math.PI;}else if(sweepFlag&&sweepAngle<0){sweepAngle+=2*Math.PI;}// We use % instead of `mod(..)` because we want it to be -360deg to 360deg(but actually in radians)
8249
+ sweepAngle%=2*Math.PI;// From http://www.w3.org/TR/SVG/implnote.html#ArcParameterizationAlternatives
8250
+ var angle=startAngle+sweepAngle*t;var ellipseComponentX=rx*Math.cos(angle);var ellipseComponentY=ry*Math.sin(angle);var point={x:Math.cos(xAxisRotationRadians)*ellipseComponentX-Math.sin(xAxisRotationRadians)*ellipseComponentY+center.x,y:Math.sin(xAxisRotationRadians)*ellipseComponentX+Math.cos(xAxisRotationRadians)*ellipseComponentY+center.y,ellipticalArcStartAngle:startAngle,ellipticalArcEndAngle:startAngle+sweepAngle,ellipticalArcAngle:angle,ellipticalArcCenter:center,resultantRx:rx,resultantRy:ry};return point;};function path2Segments(path){var segments=[];var currentPoint=null;// 当前图形
8208
8251
  var nextParams=null;// 下一节点的 path 参数
8209
8252
  var startMovePoint=null;// 开始 M 的点,可能会有多个
8210
8253
  var lastStartMovePointIndex=0;// 最近一个开始点 M 的索引
8211
8254
  var count=path.length;for(var i=0;i<count;i++){var params=path[i];nextParams=path[i+1];var command=params[0];// 数学定义上的参数,便于后面的计算
8212
- var segment={command:command,prePoint:currentPoint,params:params,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null};switch(command){case'M':startMovePoint=[params[1],params[2]];lastStartMovePointIndex=i;break;case'A':var arcParams=getArcParams(currentPoint,params);segment.arcParams=arcParams;break;}if(command==='Z'){// 有了 Z 后,当前节点从开始 M 的点开始
8255
+ var segment={command:command,prePoint:currentPoint,params:params,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null};switch(command){case'M':startMovePoint=[params[1],params[2]];lastStartMovePointIndex=i;break;case'A':var arcParams=getArcParams(currentPoint,params);segment.arcParams=arcParams;break;}if(command==='Z'){// 有了 Z 后,当前节点从开始 M 的点开始
8213
8256
  currentPoint=startMovePoint;// 如果当前点的命令为 Z,相当于当前点为最近一个 M 点,则下一个点直接指向最近一个 M 点的下一个点
8214
8257
  nextParams=path[lastStartMovePointIndex+1];}else {var len=params.length;currentPoint=[params[len-2],params[len-1]];}if(nextParams&&nextParams[0]==='Z'){// 如果下一个点的命令为 Z,则下一个点直接指向最近一个 M 点
8215
8258
  nextParams=path[lastStartMovePointIndex];if(segments[lastStartMovePointIndex]){// 如果下一个点的命令为 Z,则最近一个 M 点的前一个点为当前点
@@ -8223,7 +8266,9 @@
8223
8266
  if(segment.startTangent[0]===0&&segment.startTangent[1]===0){segment.startTangent=[cp1[0]-cp2[0],cp1[1]-cp2[1]];}if(segment.endTangent[0]===0&&segment.endTangent[1]===0){segment.endTangent=[cp2[0]-cp1[0],cp2[1]-cp1[1]];}}else if(command==='S'){var _preSegment=segments[i-1];var _cp2=toSymmetry(_preSegment.currentPoint,prePoint);var _cp3=[params[1],params[2]];if(_preSegment.command==='C'){segment.command='C';// 将 S 命令变换为 C 命令
8224
8267
  segment.startTangent=[prePoint[0]-_cp2[0],prePoint[1]-_cp2[1]];segment.endTangent=[currentPoint[0]-_cp3[0],currentPoint[1]-_cp3[1]];}else {// @ts-ignore
8225
8268
  segment.command='SQ';// 将 S 命令变换为 SQ 命令
8226
- segment.startTangent=[prePoint[0]-_cp3[0],prePoint[1]-_cp3[1]];segment.endTangent=[currentPoint[0]-_cp3[0],currentPoint[1]-_cp3[1]];}}else if(command==='A'){var d=0.001;var _ref=segment.arcParams||{},_ref$cx=_ref.cx,cx=_ref$cx===void 0?0:_ref$cx,_ref$cy=_ref.cy,cy=_ref$cy===void 0?0:_ref$cy,_ref$rx=_ref.rx,rx=_ref$rx===void 0?0:_ref$rx,_ref$ry=_ref.ry,ry=_ref$ry===void 0?0:_ref$ry,_ref$sweepFlag=_ref.sweepFlag,sweepFlag=_ref$sweepFlag===void 0?0:_ref$sweepFlag,_ref$startAngle=_ref.startAngle,startAngle=_ref$startAngle===void 0?0:_ref$startAngle,_ref$endAngle=_ref.endAngle,endAngle=_ref$endAngle===void 0?0:_ref$endAngle;if(sweepFlag===0){d*=-1;}var dx1=rx*Math.cos(startAngle-d)+cx;var dy1=ry*Math.sin(startAngle-d)+cy;segment.startTangent=[dx1-startMovePoint[0],dy1-startMovePoint[1]];var dx2=rx*Math.cos(startAngle+endAngle+d)+cx;var dy2=ry*Math.sin(startAngle+endAngle-d)+cy;segment.endTangent=[prePoint[0]-dx2,prePoint[1]-dy2];}segments.push(segment);}return segments;}// 向量长度
8269
+ segment.startTangent=[prePoint[0]-_cp3[0],prePoint[1]-_cp3[1]];segment.endTangent=[currentPoint[0]-_cp3[0],currentPoint[1]-_cp3[1]];}}else if(command==='A'){var _getTangentAtRatio=getTangentAtRatio(segment,0),dx1=_getTangentAtRatio.x,dy1=_getTangentAtRatio.y;var _getTangentAtRatio2=getTangentAtRatio(segment,1,false),dx2=_getTangentAtRatio2.x,dy2=_getTangentAtRatio2.y;segment.startTangent=[dx1,dy1];segment.endTangent=[dx2,dy2];}segments.push(segment);}return segments;}/**
8270
+ * Use length instead of ratio
8271
+ */function getTangentAtRatio(segment,ratio,sign){if(sign===void 0){sign=true;}var _segment$arcParams=segment.arcParams,_segment$arcParams$rx=_segment$arcParams.rx,rx=_segment$arcParams$rx===void 0?0:_segment$arcParams$rx,_segment$arcParams$ry=_segment$arcParams.ry,ry=_segment$arcParams$ry===void 0?0:_segment$arcParams$ry,xRotation=_segment$arcParams.xRotation,arcFlag=_segment$arcParams.arcFlag,sweepFlag=_segment$arcParams.sweepFlag;var p1=pointOnEllipticalArc({x:segment.prePoint[0],y:segment.prePoint[1]},rx,ry,xRotation,!!arcFlag,!!sweepFlag,{x:segment.currentPoint[0],y:segment.currentPoint[1]},ratio);var p2=pointOnEllipticalArc({x:segment.prePoint[0],y:segment.prePoint[1]},rx,ry,xRotation,!!arcFlag,!!sweepFlag,{x:segment.currentPoint[0],y:segment.currentPoint[1]},sign?ratio+0.005:ratio-0.005);var xDist=p2.x-p1.x;var yDist=p2.y-p1.y;var dist=Math.sqrt(xDist*xDist+yDist*yDist);return {x:-xDist/dist,y:-yDist/dist};}// 向量长度
8227
8272
  function vMag(v){return Math.sqrt(v[0]*v[0]+v[1]*v[1]);}// u.v/|u||v|,计算夹角的余弦值
8228
8273
  function vRatio(u,v){// 当存在一个向量的长度为 0 时,夹角也为 0,即夹角的余弦值为 1
8229
8274
  return vMag(u)*vMag(v)?(u[0]*v[0]+u[1]*v[1])/(vMag(u)*vMag(v)):1;}// 向量角度
@@ -8236,14 +8281,15 @@
8236
8281
  var v=[(-1*xp-cxp)/rx,(-1*yp-cyp)/ry];// 计算起始点和圆心的连线,与 x 轴正方向的夹角
8237
8282
  var theta=vAngle([1,0],u);// 计算圆弧起始点和终止点与椭圆圆心连线的夹角
8238
8283
  var dTheta=vAngle(u,v);if(vRatio(u,v)<=-1){dTheta=Math.PI;}if(vRatio(u,v)>=1){dTheta=0;}if(sweepFlag===0&&dTheta>0){dTheta=dTheta-2*Math.PI;}if(sweepFlag===1&&dTheta<0){dTheta=dTheta+2*Math.PI;}return {cx:cx,cy:cy,// 弧形的起点和终点相同时,长轴和短轴的长度按 0 处理
8239
- rx:isSamePoint(startPoint,[x2,y2])?0:rx,ry:isSamePoint(startPoint,[x2,y2])?0:ry,startAngle:theta,endAngle:theta+dTheta,xRotation:xRotation,arcFlag:arcFlag,sweepFlag:sweepFlag};}function commandsToPathString(commands,object,transform){var _object$parsedStyle=object.parsedStyle,_object$parsedStyle$d=_object$parsedStyle.defX,defX=_object$parsedStyle$d===void 0?0:_object$parsedStyle$d,_object$parsedStyle$d2=_object$parsedStyle.defY,defY=_object$parsedStyle$d2===void 0?0:_object$parsedStyle$d2;return commands.reduce(function(prev,cur){var path='';if(cur[0]==='M'||cur[0]==='L'){var p=fromValues$2(cur[1]-defX,cur[2]-defY,0);if(transform){transformMat4(p,p,transform);}path=""+cur[0]+p[0]+","+p[1];}else if(cur[0]==='Z'){path=cur[0];}else if(cur[0]==='C'){var p1=fromValues$2(cur[1]-defX,cur[2]-defY,0);var p2=fromValues$2(cur[3]-defX,cur[4]-defY,0);var p3=fromValues$2(cur[5]-defX,cur[6]-defY,0);if(transform){transformMat4(p1,p1,transform);transformMat4(p2,p2,transform);transformMat4(p3,p3,transform);}path=""+cur[0]+p1[0]+","+p1[1]+","+p2[0]+","+p2[1]+","+p3[0]+","+p3[1];}else if(cur[0]==='A'){var c=fromValues$2(cur[6]-defX,cur[7]-defY,0);if(transform){transformMat4(c,c,transform);}path=""+cur[0]+cur[1]+","+cur[2]+","+cur[3]+","+cur[4]+","+cur[5]+","+c[0]+","+c[1];}return prev+=path;},'');}function lineToCommands(x1,y1,x2,y2){return [['M',x1,y1],['L',x2,y2]];}function ellipseToCommands(rx,ry,cx,cy){var factor=(-1+Math.sqrt(2))/3*4;var dx=rx*factor;var dy=ry*factor;var left=cx-rx;var right=cx+rx;var top=cy-ry;var bottom=cy+ry;return [['M',left,cy],['C',left,cy-dy,cx-dx,top,cx,top],['C',cx+dx,top,right,cy-dy,right,cy],['C',right,cy+dy,cx+dx,bottom,cx,bottom],['C',cx-dx,bottom,left,cy+dy,left,cy],['Z']];}function polygonToCommands(points,closed){var result=points.map(function(point,i){return [i===0?'M':'L',point[0],point[1]];});if(closed){result.push(['Z']);}return result;}function rectToCommands(width,height,x,y,radius){// @see https://gist.github.com/danielpquinn/dd966af424030d47e476
8284
+ rx:isSamePoint(startPoint,[x2,y2])?0:rx,ry:isSamePoint(startPoint,[x2,y2])?0:ry,startAngle:theta,endAngle:theta+dTheta,xRotation:xRotation,arcFlag:arcFlag,sweepFlag:sweepFlag};}function commandsToPathString(commands,object,transform){var _object$parsedStyle=object.parsedStyle,_object$parsedStyle$d=_object$parsedStyle.defX,defX=_object$parsedStyle$d===void 0?0:_object$parsedStyle$d,_object$parsedStyle$d2=_object$parsedStyle.defY,defY=_object$parsedStyle$d2===void 0?0:_object$parsedStyle$d2;return commands.reduce(function(prev,cur){var path='';if(cur[0]==='M'||cur[0]==='L'){var p=fromValues$2(cur[1]-defX,cur[2]-defY,0);if(transform){transformMat4(p,p,transform);}path=""+cur[0]+p[0]+","+p[1];}else if(cur[0]==='Z'){path=cur[0];}else if(cur[0]==='C'){var p1=fromValues$2(cur[1]-defX,cur[2]-defY,0);var p2=fromValues$2(cur[3]-defX,cur[4]-defY,0);var p3=fromValues$2(cur[5]-defX,cur[6]-defY,0);if(transform){transformMat4(p1,p1,transform);transformMat4(p2,p2,transform);transformMat4(p3,p3,transform);}path=""+cur[0]+p1[0]+","+p1[1]+","+p2[0]+","+p2[1]+","+p3[0]+","+p3[1];}else if(cur[0]==='A'){var c=fromValues$2(cur[6]-defX,cur[7]-defY,0);if(transform){transformMat4(c,c,transform);}path=""+cur[0]+cur[1]+","+cur[2]+","+cur[3]+","+cur[4]+","+cur[5]+","+c[0]+","+c[1];}else if(cur[0]==='Q'){var _p=fromValues$2(cur[1]-defX,cur[2]-defY,0);var _p2=fromValues$2(cur[3]-defX,cur[4]-defY,0);if(transform){transformMat4(_p,_p,transform);transformMat4(_p2,_p2,transform);}path=""+cur[0]+cur[1]+","+cur[2]+","+cur[3]+","+cur[4]+"}";}return prev+=path;},'');}function lineToCommands(x1,y1,x2,y2){return [['M',x1,y1],['L',x2,y2]];}function ellipseToCommands(rx,ry,cx,cy){var factor=(-1+Math.sqrt(2))/3*4;var dx=rx*factor;var dy=ry*factor;var left=cx-rx;var right=cx+rx;var top=cy-ry;var bottom=cy+ry;return [['M',left,cy],['C',left,cy-dy,cx-dx,top,cx,top],['C',cx+dx,top,right,cy-dy,right,cy],['C',right,cy+dy,cx+dx,bottom,cx,bottom],['C',cx-dx,bottom,left,cy+dy,left,cy],['Z']];}function polygonToCommands(points,closed){var result=points.map(function(point,i){return [i===0?'M':'L',point[0],point[1]];});if(closed){result.push(['Z']);}return result;}function rectToCommands(width,height,x,y,radius){// @see https://gist.github.com/danielpquinn/dd966af424030d47e476
8240
8285
  if(radius){var tlr=radius[0],trr=radius[1],brr=radius[2],blr=radius[3];var signX=width>0?1:-1;var signY=height>0?1:-1;// sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
8241
8286
  var sweepFlag=signX+signY!==0?1:0;return [['M',signX*tlr+x,y],['L',width-signX*trr+x,y],trr?['A',trr,trr,0,0,sweepFlag,width+x,signY*trr+y]:null,['L',width+x,height-signY*brr+y],brr?['A',brr,brr,0,0,sweepFlag,width+x-signX*brr,height+y]:null,['L',x+signX*blr,height+y],blr?['A',blr,blr,0,0,sweepFlag,x,height+y-signY*blr]:null,['L',x,signY*tlr+y],tlr?['A',tlr,tlr,0,0,sweepFlag,signX*tlr+x,y]:null,['Z']].filter(function(command){return command;});}return [['M',x,y],['L',x+width,y],['L',x+width,y+height],['L',x,y+height],['Z']];}/**
8242
8287
  * convert object to path, should account for:
8243
8288
  * * transform & origin
8244
8289
  * * anchor
8245
8290
  * * lineWidth
8246
- */function convertToPath(object,transform){if(transform===void 0){transform=object.getLocalTransform();}var commands=[];switch(object.nodeName){case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,y1=_object$parsedStyle2.y1,x2=_object$parsedStyle2.x2,y2=_object$parsedStyle2.y2;commands=lineToCommands(x1,y1,x2,y2);break;case exports.Shape.CIRCLE:{var _object$parsedStyle3=object.parsedStyle,r=_object$parsedStyle3.r,cx=_object$parsedStyle3.cx,cy=_object$parsedStyle3.cy;commands=ellipseToCommands(r,r,cx,cy);break;}case exports.Shape.ELLIPSE:{var _object$parsedStyle4=object.parsedStyle,rx=_object$parsedStyle4.rx,ry=_object$parsedStyle4.ry,_cx=_object$parsedStyle4.cx,_cy=_object$parsedStyle4.cy;commands=ellipseToCommands(rx,ry,_cx,_cy);break;}case exports.Shape.POLYLINE:case exports.Shape.POLYGON:var points=object.parsedStyle.points;commands=polygonToCommands(points.points,object.nodeName===exports.Shape.POLYGON);break;case exports.Shape.RECT:var _object$parsedStyle5=object.parsedStyle,width=_object$parsedStyle5.width,height=_object$parsedStyle5.height,x=_object$parsedStyle5.x,y=_object$parsedStyle5.y,radius=_object$parsedStyle5.radius;var hasRadius=radius&&radius.some(function(r){return r!==0;});commands=rectToCommands(width,height,x,y,hasRadius&&radius.map(function(r){return clamp(r,0,Math.min(Math.abs(width)/2,Math.abs(height)/2));}));break;case exports.Shape.PATH:var _object$parsedStyle$p=object.parsedStyle.path,curve=_object$parsedStyle$p.curve,zCommandIndexes=_object$parsedStyle$p.zCommandIndexes;commands=[].concat(curve);zCommandIndexes.forEach(function(zIndex,index){commands.splice(zIndex+index+1,0,['Z']);});break;}if(commands.length){return commandsToPathString(commands,object,transform);}}function translatePathToString(pathArray,x,y,startOffsetX,startOffsetY,endOffsetX,endOffsetY){if(startOffsetX===void 0){startOffsetX=0;}if(startOffsetY===void 0){startOffsetY=0;}if(endOffsetX===void 0){endOffsetX=0;}if(endOffsetY===void 0){endOffsetY=0;}var newValue=pathArray.map(function(params,i){var command=params[0];var isClosed=pathArray[pathArray.length-1][0]==='Z';var offsetX=i===pathArray.length-(isClosed?2:1)?endOffsetX:0;var offsetY=i===pathArray.length-(isClosed?2:1)?endOffsetY:0;switch(command){case'M':return "M "+(params[1]-x+startOffsetX)+","+(params[2]-y+startOffsetY);case'L':return "L "+(params[1]-x+offsetX)+","+(params[2]-y+offsetY);case'Q':return "Q "+(params[1]-x)+" "+(params[2]-y)+","+(params[3]-x+offsetX)+" "+(params[4]-y+offsetY);case'C':return "C "+(params[1]-x)+" "+(params[2]-y)+","+(params[3]-x)+" "+(params[4]-y)+","+(params[5]-x+offsetX)+" "+(params[6]-y+offsetY);case'A':return "A "+params[1]+" "+params[2]+" "+params[3]+" "+params[4]+" "+params[5]+" "+(params[6]-x+offsetX)+" "+(params[7]-y+offsetY);case'Z':return 'Z';}}).join(' ');if(~newValue.indexOf('NaN')){return '';}return newValue;}function isFillOrStrokeAffected(pointerEvents,fill,stroke){// account for pointerEvents
8291
+ */function convertToPath(object,transform){if(transform===void 0){transform=object.getLocalTransform();}var commands=[];switch(object.nodeName){case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,y1=_object$parsedStyle2.y1,x2=_object$parsedStyle2.x2,y2=_object$parsedStyle2.y2;commands=lineToCommands(x1,y1,x2,y2);break;case exports.Shape.CIRCLE:{var _object$parsedStyle3=object.parsedStyle,r=_object$parsedStyle3.r,cx=_object$parsedStyle3.cx,cy=_object$parsedStyle3.cy;commands=ellipseToCommands(r,r,cx,cy);break;}case exports.Shape.ELLIPSE:{var _object$parsedStyle4=object.parsedStyle,rx=_object$parsedStyle4.rx,ry=_object$parsedStyle4.ry,_cx=_object$parsedStyle4.cx,_cy=_object$parsedStyle4.cy;commands=ellipseToCommands(rx,ry,_cx,_cy);break;}case exports.Shape.POLYLINE:case exports.Shape.POLYGON:var points=object.parsedStyle.points;commands=polygonToCommands(points.points,object.nodeName===exports.Shape.POLYGON);break;case exports.Shape.RECT:var _object$parsedStyle5=object.parsedStyle,width=_object$parsedStyle5.width,height=_object$parsedStyle5.height,x=_object$parsedStyle5.x,y=_object$parsedStyle5.y,radius=_object$parsedStyle5.radius;var hasRadius=radius&&radius.some(function(r){return r!==0;});commands=rectToCommands(width,height,x,y,hasRadius&&radius.map(function(r){return clamp(r,0,Math.min(Math.abs(width)/2,Math.abs(height)/2));}));break;case exports.Shape.PATH:var absolutePath=object.parsedStyle.path.absolutePath;commands=[].concat(absolutePath);break;}if(commands.length){return commandsToPathString(commands,object,transform);}}function translatePathToString(absolutePath,defX,defY,startOffsetX,startOffsetY,endOffsetX,endOffsetY){if(startOffsetX===void 0){startOffsetX=0;}if(startOffsetY===void 0){startOffsetY=0;}if(endOffsetX===void 0){endOffsetX=0;}if(endOffsetY===void 0){endOffsetY=0;}var newValue=absolutePath.map(function(params,i){var command=params[0];var nextSegment=absolutePath[i+1];var useStartOffset=i===0&&startOffsetX!==0&&startOffsetY!==0;var useEndOffset=(i===absolutePath.length-1||nextSegment&&(nextSegment[0]==='M'||nextSegment[0]==='Z'))&&endOffsetX!==0&&endOffsetY!==0;switch(command){case'M':// Use start marker offset
8292
+ if(useStartOffset){return "M "+(params[1]-defX+startOffsetX)+","+(params[2]-defY+startOffsetY)+" L "+(params[1]-defX)+","+(params[2]-defY);}else {return "M "+(params[1]-defX)+","+(params[2]-defY);}case'L':return "L "+(params[1]-defX+(useEndOffset?endOffsetX:0))+","+(params[2]-defY+(useEndOffset?endOffsetY:0));case'Q':return "Q "+(params[1]-defX)+" "+(params[2]-defY)+","+(params[3]-defX)+" "+(params[4]-defY)+(useEndOffset?" L "+(params[3]-defX+endOffsetX)+","+(params[4]-defY+endOffsetY):'');case'C':return "C "+(params[1]-defX)+" "+(params[2]-defY)+","+(params[3]-defX)+" "+(params[4]-defY)+","+(params[5]-defX)+" "+(params[6]-defY)+(useEndOffset?" L "+(params[5]-defX+endOffsetX)+","+(params[6]-defY+endOffsetY):'');case'A':return "A "+params[1]+" "+params[2]+" "+params[3]+" "+params[4]+" "+params[5]+" "+(params[6]-defX)+" "+(params[7]-defY)+(useEndOffset?" L "+(params[6]-defX+endOffsetX)+","+(params[7]-defY+endOffsetY):'');case'Z':return 'Z';}}).join(' ');if(~newValue.indexOf('NaN')){return '';}return newValue;}function isFillOrStrokeAffected(pointerEvents,fill,stroke){// account for pointerEvents
8247
8293
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
8248
8294
  var hasFill=false;var hasStroke=false;var isFillOtherThanNone=!!fill&&!fill.isNone;var isStrokeOtherThanNone=!!stroke&&!stroke.isNone;if(pointerEvents==='visiblepainted'||pointerEvents==='painted'||pointerEvents==='auto'){hasFill=isFillOtherThanNone;hasStroke=isStrokeOtherThanNone;}else if(pointerEvents==='visiblefill'||pointerEvents==='fill'){hasFill=true;}else if(pointerEvents==='visiblestroke'||pointerEvents==='stroke'){hasStroke=true;}else if(pointerEvents==='visible'||pointerEvents==='all'){// The values of the fill and stroke do not affect event processing.
8249
8295
  hasFill=true;hasStroke=true;}return [hasFill,hasStroke];}// @ts-nocheck
@@ -8691,11 +8737,13 @@
8691
8737
  };_this.attributes={};return _this;}Element.isElement=function isElement(target){return !!target.getAttribute;}/**
8692
8738
  * Unique id.
8693
8739
  */;var _proto=Element.prototype;// eslint-disable-next-line @typescript-eslint/no-unused-vars
8694
- _proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.appendChild=function appendChild(child,index){var _this$ownerDocument;runtime.sceneGraphService.attach(child,this,index);if((_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView){this.ownerDocument.defaultView.mountChildren(child);}insertedEvent.relatedNode=this;child.dispatchEvent(insertedEvent);return child;};_proto.insertBefore=function insertBefore(newChild,refChild){if(!refChild){this.appendChild(newChild);}else {var index=this.childNodes.indexOf(refChild);this.appendChild(newChild,index-1);}return newChild;};_proto.replaceChild=function replaceChild(newChild,oldChild){var index=this.childNodes.indexOf(oldChild);this.removeChild(oldChild);this.appendChild(newChild,index);return oldChild;};_proto.removeChild=function removeChild(child){var _child$ownerDocument;// should emit on itself before detach
8740
+ _proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.appendChild=function appendChild(child,index){var _this$ownerDocument;if(child.destroyed){throw new Error(ERROR_MSG_APPEND_DESTROYED_ELEMENT);}runtime.sceneGraphService.attach(child,this,index);if((_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView){this.ownerDocument.defaultView.mountChildren(child);}insertedEvent.relatedNode=this;child.dispatchEvent(insertedEvent);return child;};_proto.insertBefore=function insertBefore(newChild,refChild){if(!refChild){this.appendChild(newChild);}else {var index=this.childNodes.indexOf(refChild);this.appendChild(newChild,index-1);}return newChild;};_proto.replaceChild=function replaceChild(newChild,oldChild){var index=this.childNodes.indexOf(oldChild);this.removeChild(oldChild);this.appendChild(newChild,index);return oldChild;};_proto.removeChild=function removeChild(child){var _child$ownerDocument;// should emit on itself before detach
8695
8741
  removedEvent.relatedNode=this;child.dispatchEvent(removedEvent);if((_child$ownerDocument=child.ownerDocument)===null||_child$ownerDocument===void 0?void 0:_child$ownerDocument.defaultView){child.ownerDocument.defaultView.unmountChildren(child);}// remove from scene graph
8696
8742
  runtime.sceneGraphService.detach(child);return child;}/**
8697
- * Remove all children and destroy them.
8698
- */;_proto.removeChildren=function removeChildren(){var _this2=this;this.childNodes.slice().forEach(function(child){_this2.removeChild(child);child.destroy();});}/**
8743
+ * Remove all children which can be appended to its original parent later again.
8744
+ */;_proto.removeChildren=function removeChildren(){var _this2=this;this.childNodes.slice().forEach(function(child){_this2.removeChild(child);});}/**
8745
+ * Recursively destroy all children which can not be appended to its original parent later again.
8746
+ */;_proto.destroyChildren=function destroyChildren(){this.childNodes.slice().forEach(function(child){child.destroyChildren();child.destroy();});}/**
8699
8747
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
8700
8748
  */;_proto.matches=function matches(selector){return runtime.sceneGraphService.matches(selector,this);};_proto.getElementById=function getElementById(id){return runtime.sceneGraphService.querySelector("#"+id,this);};_proto.getElementsByName=function getElementsByName(name){return runtime.sceneGraphService.querySelectorAll("[name=\""+name+"\"]",this);};_proto.getElementsByClassName=function getElementsByClassName(className){return runtime.sceneGraphService.querySelectorAll("."+className,this);};_proto.getElementsByTagName=function getElementsByTagName(tagName){return runtime.sceneGraphService.querySelectorAll(tagName,this);};_proto.querySelector=function querySelector(selectors){return runtime.sceneGraphService.querySelector(selectors,this);};_proto.querySelectorAll=function querySelectorAll(selectors){return runtime.sceneGraphService.querySelectorAll(selectors,this);}/**
8701
8749
  * should traverses the element and its parents (heading toward the document root)
@@ -8879,12 +8927,7 @@
8879
8927
  */;_proto.getAnimations=function getAnimations(){return this.activeAnimations;}/**
8880
8928
  * create an animation with WAAPI
8881
8929
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/animate
8882
- */;_proto.animate=function animate(keyframes,options){var _this$ownerDocument;var timeline=(_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.timeline;// account for clip path, use target's timeline
8883
- // if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
8884
- // const target = this.parsedStyle.clipPathTargets[0];
8885
- // timeline = target.ownerDocument?.timeline;
8886
- // }
8887
- if(timeline){return timeline.play(this,keyframes,options);}return null;}// #endregion animatable
8930
+ */;_proto.animate=function animate(keyframes,options){var _this$ownerDocument;var timeline=(_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.timeline;if(timeline){return timeline.play(this,keyframes,options);}return null;}// #endregion animatable
8888
8931
  // #region visible
8889
8932
  /**
8890
8933
  * shortcut for Used value of `visibility`
@@ -9002,8 +9045,7 @@
9002
9045
  this.transformMarker(true);this.transformMarker(false);this.placeMarkerMid(this.parsedStyle.markerMid);}else if(attrName==='markerStartOffset'||attrName==='markerEndOffset'){this.transformMarker(true);this.transformMarker(false);}else if(attrName==='markerStart'){if(prevParsedValue&&prevParsedValue instanceof DisplayObject){this.markerStartAngle=0;prevParsedValue.remove();}// CSSKeyword 'unset'
9003
9046
  if(newParsedValue&&newParsedValue instanceof DisplayObject){this.markerStartAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(true);}}else if(attrName==='markerEnd'){if(prevParsedValue&&prevParsedValue instanceof DisplayObject){this.markerEndAngle=0;prevParsedValue.remove();}if(newParsedValue&&newParsedValue instanceof DisplayObject){this.markerEndAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(false);}}else if(attrName==='markerMid'){this.placeMarkerMid(newParsedValue);}};_proto.transformMarker=function transformMarker(isStart){var _this$parsedStyle2=this.parsedStyle,markerStart=_this$parsedStyle2.markerStart,markerEnd=_this$parsedStyle2.markerEnd,markerStartOffset=_this$parsedStyle2.markerStartOffset,markerEndOffset=_this$parsedStyle2.markerEndOffset,defX=_this$parsedStyle2.defX,defY=_this$parsedStyle2.defY;var marker=isStart?markerStart:markerEnd;if(!marker||!(marker instanceof DisplayObject)){return;}var rad=0;var x;var y;var ox;var oy;var offset;var originalAngle;if(isStart){var _this$getStartTangent=this.getStartTangent(),p1=_this$getStartTangent[0],p2=_this$getStartTangent[1];ox=p2[0]-defX;oy=p2[1]-defY;x=p1[0]-p2[0];y=p1[1]-p2[1];offset=markerStartOffset||0;originalAngle=this.markerStartAngle;}else {var _this$getEndTangent=this.getEndTangent(),_p=_this$getEndTangent[0],_p2=_this$getEndTangent[1];ox=_p2[0]-defX;oy=_p2[1]-defY;x=_p[0]-_p2[0];y=_p[1]-_p2[1];offset=markerEndOffset||0;originalAngle=this.markerEndAngle;}rad=Math.atan2(y,x);// account for markerOffset
9004
9047
  marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.placeMarkerMid=function placeMarkerMid(marker){var _this$parsedStyle3=this.parsedStyle,segments=_this$parsedStyle3.path.segments,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;// clear all existed markers
9005
- this.markerMidList.forEach(function(marker){marker.remove();});if(marker&&marker instanceof DisplayObject){// FIXME: should use original path instead of parsed curve
9006
- for(var i=1;i<segments.length-1;i++){var _segments$i$currentPo=segments[i].currentPoint,ox=_segments$i$currentPo[0],oy=_segments$i$currentPo[1];var cloned=i===1?marker:marker.cloneNode(true);this.markerMidList.push(cloned);this.appendChild(cloned);cloned.setLocalPosition(ox-defX,oy-defY);// TODO: orient of marker
9048
+ this.markerMidList.forEach(function(marker){marker.remove();});if(marker&&marker instanceof DisplayObject){for(var i=1;i<segments.length-1;i++){var _segments$i$currentPo=segments[i].currentPoint,ox=_segments$i$currentPo[0],oy=_segments$i$currentPo[1];var cloned=i===1?marker:marker.cloneNode(true);this.markerMidList.push(cloned);this.appendChild(cloned);cloned.setLocalPosition(ox-defX,oy-defY);// TODO: orient of marker
9007
9049
  }}}/**
9008
9050
  * Returns the total length of the path.
9009
9051
  * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement/getTotalLength
@@ -9599,7 +9641,11 @@
9599
9641
  var canvasConfig=this.context.config;canvasConfig.width=width;canvasConfig.height=height;// resize context
9600
9642
  this.getContextService().resize(width,height);// resize camera
9601
9643
  var camera=this.context.camera;var projectionMode=camera.getProjectionMode();camera.setPosition(width/2,height/2,DEFAULT_CAMERA_Z).setFocalPoint(width/2,height/2,0);if(projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC){camera.setOrthographic(width/-2,width/2,height/2,height/-2,camera.getNear(),camera.getFar());}else {camera.setAspect(width/height);}this.dispatchEvent(new CustomEvent(exports.CanvasEvent.RESIZE,{width:width,height:height}));}// proxy to document.documentElement
9602
- ;_proto.appendChild=function appendChild(child,index){return this.document.documentElement.appendChild(child,index);};_proto.insertBefore=function insertBefore(newChild,refChild){return this.document.documentElement.insertBefore(newChild,refChild);};_proto.removeChild=function removeChild(child){return this.document.documentElement.removeChild(child);};_proto.removeChildren=function removeChildren(){this.document.documentElement.removeChildren();};_proto.render=function render(){this.dispatchEvent(beforeRenderEvent);var renderingService=this.getRenderingService();renderingService.render(this.getConfig());this.dispatchEvent(afterRenderEvent);};_proto.run=function run(){var _this3=this;var tick=function tick(){_this3.render();_this3.frameId=requestAnimationFrame(tick);};tick();};_proto.initRenderer=/*#__PURE__*/function(){var _initRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(renderer){return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(renderer){_context2.next=2;break;}throw new Error('Renderer is required.');case 2:// reset
9644
+ ;_proto.appendChild=function appendChild(child,index){return this.document.documentElement.appendChild(child,index);};_proto.insertBefore=function insertBefore(newChild,refChild){return this.document.documentElement.insertBefore(newChild,refChild);};_proto.removeChild=function removeChild(child){return this.document.documentElement.removeChild(child);}/**
9645
+ * Remove all children which can be appended to its original parent later again.
9646
+ */;_proto.removeChildren=function removeChildren(){this.document.documentElement.removeChildren();}/**
9647
+ * Recursively destroy all children which can not be appended to its original parent later again.
9648
+ */;_proto.destroyChildren=function destroyChildren(){this.document.documentElement.destroyChildren();};_proto.render=function render(){this.dispatchEvent(beforeRenderEvent);var renderingService=this.getRenderingService();renderingService.render(this.getConfig());this.dispatchEvent(afterRenderEvent);};_proto.run=function run(){var _this3=this;var tick=function tick(){_this3.render();_this3.frameId=requestAnimationFrame(tick);};tick();};_proto.initRenderer=/*#__PURE__*/function(){var _initRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(renderer){return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(renderer){_context2.next=2;break;}throw new Error('Renderer is required.');case 2:// reset
9603
9649
  this.inited=false;this.readyPromise=undefined;// FIXME: should re-create here?
9604
9650
  this.context.rBushRoot=new RBush();// reset rendering plugins
9605
9651
  this.context.renderingPlugins=[];this.context.renderingPlugins.push(new EventPlugin(),new PrepareRendererPlugin(),new DirtyCheckPlugin(),new CullingPlugin([new FrustumCullingStrategy()]));//
@@ -9611,11 +9657,12 @@
9611
9657
  var plugins=renderer.getPlugins();plugins.forEach(function(plugin){plugin.context=_this4.context;plugin.init();});};_proto.setRenderer=/*#__PURE__*/function(){var _setRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer){var canvasConfig,oldRenderer;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:// update canvas' config
9612
9658
  canvasConfig=this.getConfig();if(!(canvasConfig.renderer===renderer)){_context3.next=3;break;}return _context3.abrupt("return");case 3:oldRenderer=canvasConfig.renderer;canvasConfig.renderer=renderer;// keep all children undestroyed
9613
9659
  this.destroy(false,true);// destroy all plugins, reverse will mutate origin array
9614
- [].concat(oldRenderer===null||oldRenderer===void 0?void 0:oldRenderer.getPlugins()).reverse().forEach(function(plugin){plugin.destroy();});_context3.next=9;return this.initRenderer(renderer);case 9:case"end":return _context3.stop();}}},_callee3,this);}));function setRenderer(_x2){return _setRenderer.apply(this,arguments);}return setRenderer;}();_proto.setCursor=function setCursor(cursor){var canvasConfig=this.getConfig();canvasConfig.cursor=cursor;this.getContextService().applyCursorStyle(cursor);};_proto.unmountChildren=function unmountChildren(parent){var _this5=this;if(this.inited){var path=[];parent.forEach(function(child){if(child.isConnected){path.push(child);}});// unmount from leaf to root
9615
- path.reverse().forEach(function(child){// trigger before unmounted
9616
- if(child.isCustomElement){if(child.disconnectedCallback){child.disconnectedCallback();}}if(child.isMutationObserved){child.dispatchEvent(unmountedEvent);}else {unmountedEvent.target=child;_this5.dispatchEvent(unmountedEvent,true);}// skip document.documentElement
9617
- if(child!==_this5.document.documentElement){child.ownerDocument=null;}child.isConnected=false;});}};_proto.mountChildren=function mountChildren(parent){var _this6=this;if(this.inited){parent.forEach(function(child){if(!child.isConnected){child.ownerDocument=_this6.document;child.isConnected=true;if(child.isMutationObserved){child.dispatchEvent(mountedEvent);}else {mountedEvent.target=child;_this6.dispatchEvent(mountedEvent,true);}// trigger after mounted
9618
- if(child.isCustomElement){if(child.connectedCallback){child.connectedCallback();}}}});}else {console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.",'appended child: ',parent.nodeName);}};_proto.client2Viewport=function client2Viewport(client){return this.getEventService().client2Viewport(client);};_proto.viewport2Client=function viewport2Client(canvas){return this.getEventService().viewport2Client(canvas);};_proto.viewport2Canvas=function viewport2Canvas(viewport){return this.getEventService().viewport2Canvas(viewport);};_proto.canvas2Viewport=function canvas2Viewport(canvas){return this.getEventService().canvas2Viewport(canvas);}/**
9660
+ [].concat(oldRenderer===null||oldRenderer===void 0?void 0:oldRenderer.getPlugins()).reverse().forEach(function(plugin){plugin.destroy();});_context3.next=9;return this.initRenderer(renderer);case 9:case"end":return _context3.stop();}}},_callee3,this);}));function setRenderer(_x2){return _setRenderer.apply(this,arguments);}return setRenderer;}();_proto.setCursor=function setCursor(cursor){var canvasConfig=this.getConfig();canvasConfig.cursor=cursor;this.getContextService().applyCursorStyle(cursor);};_proto.unmountChildren=function unmountChildren(parent){var _this5=this;// unmountChildren recursively
9661
+ parent.childNodes.forEach(function(child){_this5.unmountChildren(child);});if(this.inited){if(parent.isMutationObserved){parent.dispatchEvent(unmountedEvent);}else {unmountedEvent.target=parent;this.dispatchEvent(unmountedEvent,true);}// skip document.documentElement
9662
+ if(parent!==this.document.documentElement){parent.ownerDocument=null;}parent.isConnected=false;}// trigger after unmounted
9663
+ if(parent.isCustomElement){if(parent.disconnectedCallback){parent.disconnectedCallback();}}};_proto.mountChildren=function mountChildren(parent){var _this6=this;if(this.inited){if(!parent.isConnected){parent.ownerDocument=this.document;parent.isConnected=true;if(parent.isMutationObserved){parent.dispatchEvent(mountedEvent);}else {mountedEvent.target=parent;this.dispatchEvent(mountedEvent,true);}}}else {console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.",'appended child: ',parent.nodeName);}// recursively mount children
9664
+ parent.childNodes.forEach(function(child){_this6.mountChildren(child);});// trigger after mounted
9665
+ if(parent.isCustomElement){if(parent.connectedCallback){parent.connectedCallback();}}};_proto.client2Viewport=function client2Viewport(client){return this.getEventService().client2Viewport(client);};_proto.viewport2Client=function viewport2Client(canvas){return this.getEventService().viewport2Client(canvas);};_proto.viewport2Canvas=function viewport2Canvas(viewport){return this.getEventService().viewport2Canvas(viewport);};_proto.canvas2Viewport=function canvas2Viewport(canvas){return this.getEventService().canvas2Viewport(canvas);}/**
9619
9666
  * @deprecated
9620
9667
  * @alias client2Viewport
9621
9668
  */;_proto.getPointByClient=function getPointByClient(clientX,clientY){return this.client2Viewport({x:clientX,y:clientY});}/**
@@ -9623,40 +9670,6 @@
9623
9670
  * @alias viewport2Client
9624
9671
  */;_proto.getClientByPoint=function getClientByPoint(x,y){return this.viewport2Client({x:x,y:y});};_createClass(Canvas,[{key:"ready",get:function get(){var _this7=this;if(!this.readyPromise){this.readyPromise=new Promise(function(resolve){_this7.resolveReadyPromise=function(){resolve(_this7);};});if(this.inited){this.resolveReadyPromise();}}return this.readyPromise;}}]);return Canvas;}(EventTarget);
9625
9672
 
9626
- var toString$1 = {}.toString;
9627
- var isType$1 = function (value, type) { return toString$1.call(value) === '[object ' + type + ']'; };
9628
-
9629
- // isFinite,
9630
- var isNil$1 = function (value) {
9631
- /**
9632
- * isNil(null) => true
9633
- * isNil() => true
9634
- */
9635
- return value === null || value === undefined;
9636
- };
9637
-
9638
- var isString$1 = (function (str) {
9639
- return isType$1(str, 'String');
9640
- });
9641
-
9642
- var clamp$1 = function (a, min, max) {
9643
- if (a < min) {
9644
- return min;
9645
- }
9646
- else if (a > max) {
9647
- return max;
9648
- }
9649
- return a;
9650
- };
9651
-
9652
- /**
9653
- * 判断是否数字
9654
- * @return {Boolean} 是否数字
9655
- */
9656
- var isNumber$1 = function (value) {
9657
- return isType$1(value, 'Number');
9658
- };
9659
-
9660
9673
  function _inheritsLoose$1(subClass, superClass) {
9661
9674
  subClass.prototype = Object.create(superClass.prototype);
9662
9675
  subClass.prototype.constructor = subClass;
@@ -9671,946 +9684,6 @@
9671
9684
  };
9672
9685
  return _setPrototypeOf$1(o, p);
9673
9686
  }
9674
- /**
9675
- * Common utilities
9676
- * @module glMatrix
9677
- */
9678
- // Configuration Constants
9679
-
9680
-
9681
- var EPSILON$2 = 0.000001;
9682
- var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
9683
- if (!Math.hypot) Math.hypot = function () {
9684
- var y = 0,
9685
- i = arguments.length;
9686
-
9687
- while (i--) {
9688
- y += arguments[i] * arguments[i];
9689
- }
9690
-
9691
- return Math.sqrt(y);
9692
- };
9693
- /**
9694
- * 3x3 Matrix
9695
- * @module mat3
9696
- */
9697
-
9698
- /**
9699
- * Creates a new identity mat3
9700
- *
9701
- * @returns {mat3} a new 3x3 matrix
9702
- */
9703
-
9704
- function create$6() {
9705
- var out = new ARRAY_TYPE$1(9);
9706
-
9707
- if (ARRAY_TYPE$1 != Float32Array) {
9708
- out[1] = 0;
9709
- out[2] = 0;
9710
- out[3] = 0;
9711
- out[5] = 0;
9712
- out[6] = 0;
9713
- out[7] = 0;
9714
- }
9715
-
9716
- out[0] = 1;
9717
- out[4] = 1;
9718
- out[8] = 1;
9719
- return out;
9720
- }
9721
- /**
9722
- * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
9723
- * @module mat4
9724
- */
9725
-
9726
- /**
9727
- * Creates a new identity mat4
9728
- *
9729
- * @returns {mat4} a new 4x4 matrix
9730
- */
9731
-
9732
-
9733
- function create$1$1() {
9734
- var out = new ARRAY_TYPE$1(16);
9735
-
9736
- if (ARRAY_TYPE$1 != Float32Array) {
9737
- out[1] = 0;
9738
- out[2] = 0;
9739
- out[3] = 0;
9740
- out[4] = 0;
9741
- out[6] = 0;
9742
- out[7] = 0;
9743
- out[8] = 0;
9744
- out[9] = 0;
9745
- out[11] = 0;
9746
- out[12] = 0;
9747
- out[13] = 0;
9748
- out[14] = 0;
9749
- }
9750
-
9751
- out[0] = 1;
9752
- out[5] = 1;
9753
- out[10] = 1;
9754
- out[15] = 1;
9755
- return out;
9756
- }
9757
- /**
9758
- * Creates a new mat4 initialized with values from an existing matrix
9759
- *
9760
- * @param {ReadonlyMat4} a matrix to clone
9761
- * @returns {mat4} a new 4x4 matrix
9762
- */
9763
-
9764
-
9765
- function clone$2(a) {
9766
- var out = new ARRAY_TYPE$1(16);
9767
- out[0] = a[0];
9768
- out[1] = a[1];
9769
- out[2] = a[2];
9770
- out[3] = a[3];
9771
- out[4] = a[4];
9772
- out[5] = a[5];
9773
- out[6] = a[6];
9774
- out[7] = a[7];
9775
- out[8] = a[8];
9776
- out[9] = a[9];
9777
- out[10] = a[10];
9778
- out[11] = a[11];
9779
- out[12] = a[12];
9780
- out[13] = a[13];
9781
- out[14] = a[14];
9782
- out[15] = a[15];
9783
- return out;
9784
- }
9785
- /**
9786
- * Copy the values from one mat4 to another
9787
- *
9788
- * @param {mat4} out the receiving matrix
9789
- * @param {ReadonlyMat4} a the source matrix
9790
- * @returns {mat4} out
9791
- */
9792
-
9793
-
9794
- function copy$5(out, a) {
9795
- out[0] = a[0];
9796
- out[1] = a[1];
9797
- out[2] = a[2];
9798
- out[3] = a[3];
9799
- out[4] = a[4];
9800
- out[5] = a[5];
9801
- out[6] = a[6];
9802
- out[7] = a[7];
9803
- out[8] = a[8];
9804
- out[9] = a[9];
9805
- out[10] = a[10];
9806
- out[11] = a[11];
9807
- out[12] = a[12];
9808
- out[13] = a[13];
9809
- out[14] = a[14];
9810
- out[15] = a[15];
9811
- return out;
9812
- }
9813
- /**
9814
- * Multiplies two mat4s
9815
- *
9816
- * @param {mat4} out the receiving matrix
9817
- * @param {ReadonlyMat4} a the first operand
9818
- * @param {ReadonlyMat4} b the second operand
9819
- * @returns {mat4} out
9820
- */
9821
-
9822
-
9823
- function multiply$3(out, a, b) {
9824
- var a00 = a[0],
9825
- a01 = a[1],
9826
- a02 = a[2],
9827
- a03 = a[3];
9828
- var a10 = a[4],
9829
- a11 = a[5],
9830
- a12 = a[6],
9831
- a13 = a[7];
9832
- var a20 = a[8],
9833
- a21 = a[9],
9834
- a22 = a[10],
9835
- a23 = a[11];
9836
- var a30 = a[12],
9837
- a31 = a[13],
9838
- a32 = a[14],
9839
- a33 = a[15]; // Cache only the current line of the second matrix
9840
-
9841
- var b0 = b[0],
9842
- b1 = b[1],
9843
- b2 = b[2],
9844
- b3 = b[3];
9845
- out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9846
- out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9847
- out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9848
- out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9849
- b0 = b[4];
9850
- b1 = b[5];
9851
- b2 = b[6];
9852
- b3 = b[7];
9853
- out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9854
- out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9855
- out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9856
- out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9857
- b0 = b[8];
9858
- b1 = b[9];
9859
- b2 = b[10];
9860
- b3 = b[11];
9861
- out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9862
- out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9863
- out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9864
- out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9865
- b0 = b[12];
9866
- b1 = b[13];
9867
- b2 = b[14];
9868
- b3 = b[15];
9869
- out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9870
- out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9871
- out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9872
- out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9873
- return out;
9874
- }
9875
- /**
9876
- * Translate a mat4 by the given vector
9877
- *
9878
- * @param {mat4} out the receiving matrix
9879
- * @param {ReadonlyMat4} a the matrix to translate
9880
- * @param {ReadonlyVec3} v vector to translate by
9881
- * @returns {mat4} out
9882
- */
9883
-
9884
-
9885
- function translate$1(out, a, v) {
9886
- var x = v[0],
9887
- y = v[1],
9888
- z = v[2];
9889
- var a00, a01, a02, a03;
9890
- var a10, a11, a12, a13;
9891
- var a20, a21, a22, a23;
9892
-
9893
- if (a === out) {
9894
- out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
9895
- out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
9896
- out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
9897
- out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
9898
- } else {
9899
- a00 = a[0];
9900
- a01 = a[1];
9901
- a02 = a[2];
9902
- a03 = a[3];
9903
- a10 = a[4];
9904
- a11 = a[5];
9905
- a12 = a[6];
9906
- a13 = a[7];
9907
- a20 = a[8];
9908
- a21 = a[9];
9909
- a22 = a[10];
9910
- a23 = a[11];
9911
- out[0] = a00;
9912
- out[1] = a01;
9913
- out[2] = a02;
9914
- out[3] = a03;
9915
- out[4] = a10;
9916
- out[5] = a11;
9917
- out[6] = a12;
9918
- out[7] = a13;
9919
- out[8] = a20;
9920
- out[9] = a21;
9921
- out[10] = a22;
9922
- out[11] = a23;
9923
- out[12] = a00 * x + a10 * y + a20 * z + a[12];
9924
- out[13] = a01 * x + a11 * y + a21 * z + a[13];
9925
- out[14] = a02 * x + a12 * y + a22 * z + a[14];
9926
- out[15] = a03 * x + a13 * y + a23 * z + a[15];
9927
- }
9928
-
9929
- return out;
9930
- }
9931
- /**
9932
- * Calculates a 4x4 matrix from the given quaternion
9933
- *
9934
- * @param {mat4} out mat4 receiving operation result
9935
- * @param {ReadonlyQuat} q Quaternion to create matrix from
9936
- *
9937
- * @returns {mat4} out
9938
- */
9939
-
9940
-
9941
- function fromQuat$1(out, q) {
9942
- var x = q[0],
9943
- y = q[1],
9944
- z = q[2],
9945
- w = q[3];
9946
- var x2 = x + x;
9947
- var y2 = y + y;
9948
- var z2 = z + z;
9949
- var xx = x * x2;
9950
- var yx = y * x2;
9951
- var yy = y * y2;
9952
- var zx = z * x2;
9953
- var zy = z * y2;
9954
- var zz = z * z2;
9955
- var wx = w * x2;
9956
- var wy = w * y2;
9957
- var wz = w * z2;
9958
- out[0] = 1 - yy - zz;
9959
- out[1] = yx + wz;
9960
- out[2] = zx - wy;
9961
- out[3] = 0;
9962
- out[4] = yx - wz;
9963
- out[5] = 1 - xx - zz;
9964
- out[6] = zy + wx;
9965
- out[7] = 0;
9966
- out[8] = zx + wy;
9967
- out[9] = zy - wx;
9968
- out[10] = 1 - xx - yy;
9969
- out[11] = 0;
9970
- out[12] = 0;
9971
- out[13] = 0;
9972
- out[14] = 0;
9973
- out[15] = 1;
9974
- return out;
9975
- }
9976
- /**
9977
- * 3 Dimensional Vector
9978
- * @module vec3
9979
- */
9980
-
9981
- /**
9982
- * Creates a new, empty vec3
9983
- *
9984
- * @returns {vec3} a new 3D vector
9985
- */
9986
-
9987
-
9988
- function create$2$1() {
9989
- var out = new ARRAY_TYPE$1(3);
9990
-
9991
- if (ARRAY_TYPE$1 != Float32Array) {
9992
- out[0] = 0;
9993
- out[1] = 0;
9994
- out[2] = 0;
9995
- }
9996
-
9997
- return out;
9998
- }
9999
- /**
10000
- * Creates a new vec3 initialized with values from an existing vector
10001
- *
10002
- * @param {ReadonlyVec3} a vector to clone
10003
- * @returns {vec3} a new 3D vector
10004
- */
10005
-
10006
-
10007
- function clone$1$1(a) {
10008
- var out = new ARRAY_TYPE$1(3);
10009
- out[0] = a[0];
10010
- out[1] = a[1];
10011
- out[2] = a[2];
10012
- return out;
10013
- }
10014
- /**
10015
- * Calculates the length of a vec3
10016
- *
10017
- * @param {ReadonlyVec3} a vector to calculate length of
10018
- * @returns {Number} length of a
10019
- */
10020
-
10021
-
10022
- function length$1(a) {
10023
- var x = a[0];
10024
- var y = a[1];
10025
- var z = a[2];
10026
- return Math.hypot(x, y, z);
10027
- }
10028
- /**
10029
- * Creates a new vec3 initialized with the given values
10030
- *
10031
- * @param {Number} x X component
10032
- * @param {Number} y Y component
10033
- * @param {Number} z Z component
10034
- * @returns {vec3} a new 3D vector
10035
- */
10036
-
10037
-
10038
- function fromValues$6(x, y, z) {
10039
- var out = new ARRAY_TYPE$1(3);
10040
- out[0] = x;
10041
- out[1] = y;
10042
- out[2] = z;
10043
- return out;
10044
- }
10045
- /**
10046
- * Copy the values from one vec3 to another
10047
- *
10048
- * @param {vec3} out the receiving vector
10049
- * @param {ReadonlyVec3} a the source vector
10050
- * @returns {vec3} out
10051
- */
10052
-
10053
-
10054
- function copy$1$1(out, a) {
10055
- out[0] = a[0];
10056
- out[1] = a[1];
10057
- out[2] = a[2];
10058
- return out;
10059
- }
10060
- /**
10061
- * Adds two vec3's
10062
- *
10063
- * @param {vec3} out the receiving vector
10064
- * @param {ReadonlyVec3} a the first operand
10065
- * @param {ReadonlyVec3} b the second operand
10066
- * @returns {vec3} out
10067
- */
10068
-
10069
-
10070
- function add$2(out, a, b) {
10071
- out[0] = a[0] + b[0];
10072
- out[1] = a[1] + b[1];
10073
- out[2] = a[2] + b[2];
10074
- return out;
10075
- }
10076
- /**
10077
- * Scales a vec3 by a scalar number
10078
- *
10079
- * @param {vec3} out the receiving vector
10080
- * @param {ReadonlyVec3} a the vector to scale
10081
- * @param {Number} b amount to scale the vector by
10082
- * @returns {vec3} out
10083
- */
10084
-
10085
-
10086
- function scale$2(out, a, b) {
10087
- out[0] = a[0] * b;
10088
- out[1] = a[1] * b;
10089
- out[2] = a[2] * b;
10090
- return out;
10091
- }
10092
- /**
10093
- * Calculates the euclidian distance between two vec3's
10094
- *
10095
- * @param {ReadonlyVec3} a the first operand
10096
- * @param {ReadonlyVec3} b the second operand
10097
- * @returns {Number} distance between a and b
10098
- */
10099
-
10100
-
10101
- function distance$1(a, b) {
10102
- var x = b[0] - a[0];
10103
- var y = b[1] - a[1];
10104
- var z = b[2] - a[2];
10105
- return Math.hypot(x, y, z);
10106
- }
10107
- /**
10108
- * Normalize a vec3
10109
- *
10110
- * @param {vec3} out the receiving vector
10111
- * @param {ReadonlyVec3} a vector to normalize
10112
- * @returns {vec3} out
10113
- */
10114
-
10115
-
10116
- function normalize$5(out, a) {
10117
- var x = a[0];
10118
- var y = a[1];
10119
- var z = a[2];
10120
- var len = x * x + y * y + z * z;
10121
-
10122
- if (len > 0) {
10123
- //TODO: evaluate use of glm_invsqrt here?
10124
- len = 1 / Math.sqrt(len);
10125
- }
10126
-
10127
- out[0] = a[0] * len;
10128
- out[1] = a[1] * len;
10129
- out[2] = a[2] * len;
10130
- return out;
10131
- }
10132
- /**
10133
- * Calculates the dot product of two vec3's
10134
- *
10135
- * @param {ReadonlyVec3} a the first operand
10136
- * @param {ReadonlyVec3} b the second operand
10137
- * @returns {Number} dot product of a and b
10138
- */
10139
-
10140
-
10141
- function dot$3(a, b) {
10142
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
10143
- }
10144
- /**
10145
- * Computes the cross product of two vec3's
10146
- *
10147
- * @param {vec3} out the receiving vector
10148
- * @param {ReadonlyVec3} a the first operand
10149
- * @param {ReadonlyVec3} b the second operand
10150
- * @returns {vec3} out
10151
- */
10152
-
10153
-
10154
- function cross$1(out, a, b) {
10155
- var ax = a[0],
10156
- ay = a[1],
10157
- az = a[2];
10158
- var bx = b[0],
10159
- by = b[1],
10160
- bz = b[2];
10161
- out[0] = ay * bz - az * by;
10162
- out[1] = az * bx - ax * bz;
10163
- out[2] = ax * by - ay * bx;
10164
- return out;
10165
- }
10166
- /**
10167
- * Performs a linear interpolation between two vec3's
10168
- *
10169
- * @param {vec3} out the receiving vector
10170
- * @param {ReadonlyVec3} a the first operand
10171
- * @param {ReadonlyVec3} b the second operand
10172
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
10173
- * @returns {vec3} out
10174
- */
10175
-
10176
-
10177
- function lerp$1(out, a, b, t) {
10178
- var ax = a[0];
10179
- var ay = a[1];
10180
- var az = a[2];
10181
- out[0] = ax + t * (b[0] - ax);
10182
- out[1] = ay + t * (b[1] - ay);
10183
- out[2] = az + t * (b[2] - az);
10184
- return out;
10185
- }
10186
- /**
10187
- * Alias for {@link vec3.distance}
10188
- * @function
10189
- */
10190
-
10191
-
10192
- var dist = distance$1;
10193
- /**
10194
- * Alias for {@link vec3.length}
10195
- * @function
10196
- */
10197
-
10198
- var len$1 = length$1;
10199
- /**
10200
- * Perform some operation over an array of vec3s.
10201
- *
10202
- * @param {Array} a the array of vectors to iterate over
10203
- * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
10204
- * @param {Number} offset Number of elements to skip at the beginning of the array
10205
- * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
10206
- * @param {Function} fn Function to call for each vector in the array
10207
- * @param {Object} [arg] additional argument to pass to fn
10208
- * @returns {Array} a
10209
- * @function
10210
- */
10211
-
10212
- var forEach$3 = function () {
10213
- var vec = create$2$1();
10214
- return function (a, stride, offset, count, fn, arg) {
10215
- var i, l;
10216
-
10217
- if (!stride) {
10218
- stride = 3;
10219
- }
10220
-
10221
- if (!offset) {
10222
- offset = 0;
10223
- }
10224
-
10225
- if (count) {
10226
- l = Math.min(count * stride + offset, a.length);
10227
- } else {
10228
- l = a.length;
10229
- }
10230
-
10231
- for (i = offset; i < l; i += stride) {
10232
- vec[0] = a[i];
10233
- vec[1] = a[i + 1];
10234
- vec[2] = a[i + 2];
10235
- fn(vec, vec, arg);
10236
- a[i] = vec[0];
10237
- a[i + 1] = vec[1];
10238
- a[i + 2] = vec[2];
10239
- }
10240
-
10241
- return a;
10242
- };
10243
- }();
10244
- /**
10245
- * 4 Dimensional Vector
10246
- * @module vec4
10247
- */
10248
-
10249
- /**
10250
- * Creates a new, empty vec4
10251
- *
10252
- * @returns {vec4} a new 4D vector
10253
- */
10254
-
10255
-
10256
- function create$3$1() {
10257
- var out = new ARRAY_TYPE$1(4);
10258
-
10259
- if (ARRAY_TYPE$1 != Float32Array) {
10260
- out[0] = 0;
10261
- out[1] = 0;
10262
- out[2] = 0;
10263
- out[3] = 0;
10264
- }
10265
-
10266
- return out;
10267
- }
10268
- /**
10269
- * Normalize a vec4
10270
- *
10271
- * @param {vec4} out the receiving vector
10272
- * @param {ReadonlyVec4} a vector to normalize
10273
- * @returns {vec4} out
10274
- */
10275
-
10276
-
10277
- function normalize$1$1(out, a) {
10278
- var x = a[0];
10279
- var y = a[1];
10280
- var z = a[2];
10281
- var w = a[3];
10282
- var len = x * x + y * y + z * z + w * w;
10283
-
10284
- if (len > 0) {
10285
- len = 1 / Math.sqrt(len);
10286
- }
10287
-
10288
- out[0] = x * len;
10289
- out[1] = y * len;
10290
- out[2] = z * len;
10291
- out[3] = w * len;
10292
- return out;
10293
- }
10294
- /**
10295
- * Perform some operation over an array of vec4s.
10296
- *
10297
- * @param {Array} a the array of vectors to iterate over
10298
- * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
10299
- * @param {Number} offset Number of elements to skip at the beginning of the array
10300
- * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
10301
- * @param {Function} fn Function to call for each vector in the array
10302
- * @param {Object} [arg] additional argument to pass to fn
10303
- * @returns {Array} a
10304
- * @function
10305
- */
10306
-
10307
-
10308
- var forEach$1$1 = function () {
10309
- var vec = create$3$1();
10310
- return function (a, stride, offset, count, fn, arg) {
10311
- var i, l;
10312
-
10313
- if (!stride) {
10314
- stride = 4;
10315
- }
10316
-
10317
- if (!offset) {
10318
- offset = 0;
10319
- }
10320
-
10321
- if (count) {
10322
- l = Math.min(count * stride + offset, a.length);
10323
- } else {
10324
- l = a.length;
10325
- }
10326
-
10327
- for (i = offset; i < l; i += stride) {
10328
- vec[0] = a[i];
10329
- vec[1] = a[i + 1];
10330
- vec[2] = a[i + 2];
10331
- vec[3] = a[i + 3];
10332
- fn(vec, vec, arg);
10333
- a[i] = vec[0];
10334
- a[i + 1] = vec[1];
10335
- a[i + 2] = vec[2];
10336
- a[i + 3] = vec[3];
10337
- }
10338
-
10339
- return a;
10340
- };
10341
- }();
10342
- /**
10343
- * Quaternion
10344
- * @module quat
10345
- */
10346
-
10347
- /**
10348
- * Creates a new identity quat
10349
- *
10350
- * @returns {quat} a new quaternion
10351
- */
10352
-
10353
-
10354
- function create$4$1() {
10355
- var out = new ARRAY_TYPE$1(4);
10356
-
10357
- if (ARRAY_TYPE$1 != Float32Array) {
10358
- out[0] = 0;
10359
- out[1] = 0;
10360
- out[2] = 0;
10361
- }
10362
-
10363
- out[3] = 1;
10364
- return out;
10365
- }
10366
- /**
10367
- * Sets a quat from the given angle and rotation axis,
10368
- * then returns it.
10369
- *
10370
- * @param {quat} out the receiving quaternion
10371
- * @param {ReadonlyVec3} axis the axis around which to rotate
10372
- * @param {Number} rad the angle in radians
10373
- * @returns {quat} out
10374
- **/
10375
-
10376
-
10377
- function setAxisAngle$1(out, axis, rad) {
10378
- rad = rad * 0.5;
10379
- var s = Math.sin(rad);
10380
- out[0] = s * axis[0];
10381
- out[1] = s * axis[1];
10382
- out[2] = s * axis[2];
10383
- out[3] = Math.cos(rad);
10384
- return out;
10385
- }
10386
- /**
10387
- * Multiplies two quat's
10388
- *
10389
- * @param {quat} out the receiving quaternion
10390
- * @param {ReadonlyQuat} a the first operand
10391
- * @param {ReadonlyQuat} b the second operand
10392
- * @returns {quat} out
10393
- */
10394
-
10395
-
10396
- function multiply$1$1(out, a, b) {
10397
- var ax = a[0],
10398
- ay = a[1],
10399
- az = a[2],
10400
- aw = a[3];
10401
- var bx = b[0],
10402
- by = b[1],
10403
- bz = b[2],
10404
- bw = b[3];
10405
- out[0] = ax * bw + aw * bx + ay * bz - az * by;
10406
- out[1] = ay * bw + aw * by + az * bx - ax * bz;
10407
- out[2] = az * bw + aw * bz + ax * by - ay * bx;
10408
- out[3] = aw * bw - ax * bx - ay * by - az * bz;
10409
- return out;
10410
- }
10411
- /**
10412
- * Performs a spherical linear interpolation between two quat
10413
- *
10414
- * @param {quat} out the receiving quaternion
10415
- * @param {ReadonlyQuat} a the first operand
10416
- * @param {ReadonlyQuat} b the second operand
10417
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
10418
- * @returns {quat} out
10419
- */
10420
-
10421
-
10422
- function slerp$1(out, a, b, t) {
10423
- // benchmarks:
10424
- // http://jsperf.com/quaternion-slerp-implementations
10425
- var ax = a[0],
10426
- ay = a[1],
10427
- az = a[2],
10428
- aw = a[3];
10429
- var bx = b[0],
10430
- by = b[1],
10431
- bz = b[2],
10432
- bw = b[3];
10433
- var omega, cosom, sinom, scale0, scale1; // calc cosine
10434
-
10435
- cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)
10436
-
10437
- if (cosom < 0.0) {
10438
- cosom = -cosom;
10439
- bx = -bx;
10440
- by = -by;
10441
- bz = -bz;
10442
- bw = -bw;
10443
- } // calculate coefficients
10444
-
10445
-
10446
- if (1.0 - cosom > EPSILON$2) {
10447
- // standard case (slerp)
10448
- omega = Math.acos(cosom);
10449
- sinom = Math.sin(omega);
10450
- scale0 = Math.sin((1.0 - t) * omega) / sinom;
10451
- scale1 = Math.sin(t * omega) / sinom;
10452
- } else {
10453
- // "from" and "to" quaternions are very close
10454
- // ... so we can do a linear interpolation
10455
- scale0 = 1.0 - t;
10456
- scale1 = t;
10457
- } // calculate final values
10458
-
10459
-
10460
- out[0] = scale0 * ax + scale1 * bx;
10461
- out[1] = scale0 * ay + scale1 * by;
10462
- out[2] = scale0 * az + scale1 * bz;
10463
- out[3] = scale0 * aw + scale1 * bw;
10464
- return out;
10465
- }
10466
- /**
10467
- * Creates a quaternion from the given 3x3 rotation matrix.
10468
- *
10469
- * NOTE: The resultant quaternion is not normalized, so you should be sure
10470
- * to renormalize the quaternion yourself where necessary.
10471
- *
10472
- * @param {quat} out the receiving quaternion
10473
- * @param {ReadonlyMat3} m rotation matrix
10474
- * @returns {quat} out
10475
- * @function
10476
- */
10477
-
10478
-
10479
- function fromMat3$1(out, m) {
10480
- // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
10481
- // article "Quaternion Calculus and Fast Animation".
10482
- var fTrace = m[0] + m[4] + m[8];
10483
- var fRoot;
10484
-
10485
- if (fTrace > 0.0) {
10486
- // |w| > 1/2, may as well choose w > 1/2
10487
- fRoot = Math.sqrt(fTrace + 1.0); // 2w
10488
-
10489
- out[3] = 0.5 * fRoot;
10490
- fRoot = 0.5 / fRoot; // 1/(4w)
10491
-
10492
- out[0] = (m[5] - m[7]) * fRoot;
10493
- out[1] = (m[6] - m[2]) * fRoot;
10494
- out[2] = (m[1] - m[3]) * fRoot;
10495
- } else {
10496
- // |w| <= 1/2
10497
- var i = 0;
10498
- if (m[4] > m[0]) i = 1;
10499
- if (m[8] > m[i * 3 + i]) i = 2;
10500
- var j = (i + 1) % 3;
10501
- var k = (i + 2) % 3;
10502
- fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
10503
- out[i] = 0.5 * fRoot;
10504
- fRoot = 0.5 / fRoot;
10505
- out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
10506
- out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
10507
- out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
10508
- }
10509
-
10510
- return out;
10511
- }
10512
- /**
10513
- * Normalize a quat
10514
- *
10515
- * @param {quat} out the receiving quaternion
10516
- * @param {ReadonlyQuat} a quaternion to normalize
10517
- * @returns {quat} out
10518
- * @function
10519
- */
10520
-
10521
-
10522
- var normalize$2$1 = normalize$1$1;
10523
- /**
10524
- * Sets a quaternion to represent the shortest rotation from one
10525
- * vector to another.
10526
- *
10527
- * Both vectors are assumed to be unit length.
10528
- *
10529
- * @param {quat} out the receiving quaternion.
10530
- * @param {ReadonlyVec3} a the initial vector
10531
- * @param {ReadonlyVec3} b the destination vector
10532
- * @returns {quat} out
10533
- */
10534
-
10535
- var rotationTo$1 = function () {
10536
- var tmpvec3 = create$2$1();
10537
- var xUnitVec3 = fromValues$6(1, 0, 0);
10538
- var yUnitVec3 = fromValues$6(0, 1, 0);
10539
- return function (out, a, b) {
10540
- var dot$1 = dot$3(a, b);
10541
-
10542
- if (dot$1 < -0.999999) {
10543
- cross$1(tmpvec3, xUnitVec3, a);
10544
- if (len$1(tmpvec3) < 0.000001) cross$1(tmpvec3, yUnitVec3, a);
10545
- normalize$5(tmpvec3, tmpvec3);
10546
- setAxisAngle$1(out, tmpvec3, Math.PI);
10547
- return out;
10548
- } else if (dot$1 > 0.999999) {
10549
- out[0] = 0;
10550
- out[1] = 0;
10551
- out[2] = 0;
10552
- out[3] = 1;
10553
- return out;
10554
- } else {
10555
- cross$1(tmpvec3, a, b);
10556
- out[0] = tmpvec3[0];
10557
- out[1] = tmpvec3[1];
10558
- out[2] = tmpvec3[2];
10559
- out[3] = 1 + dot$1;
10560
- return normalize$2$1(out, out);
10561
- }
10562
- };
10563
- }();
10564
- /**
10565
- * Performs a spherical linear interpolation with two control points
10566
- *
10567
- * @param {quat} out the receiving quaternion
10568
- * @param {ReadonlyQuat} a the first operand
10569
- * @param {ReadonlyQuat} b the second operand
10570
- * @param {ReadonlyQuat} c the third operand
10571
- * @param {ReadonlyQuat} d the fourth operand
10572
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
10573
- * @returns {quat} out
10574
- */
10575
-
10576
-
10577
- var sqlerp$1 = function () {
10578
- var temp1 = create$4$1();
10579
- var temp2 = create$4$1();
10580
- return function (out, a, b, c, d, t) {
10581
- slerp$1(temp1, a, d, t);
10582
- slerp$1(temp2, b, c, t);
10583
- slerp$1(out, temp1, temp2, 2 * t * (1 - t));
10584
- return out;
10585
- };
10586
- }();
10587
- /**
10588
- * Sets the specified quaternion with values corresponding to the given
10589
- * axes. Each axis is a vec3 and is expected to be unit length and
10590
- * perpendicular to all other specified axes.
10591
- *
10592
- * @param {ReadonlyVec3} view the vector representing the viewing direction
10593
- * @param {ReadonlyVec3} right the vector representing the local "right" direction
10594
- * @param {ReadonlyVec3} up the vector representing the local "up" direction
10595
- * @returns {quat} out
10596
- */
10597
-
10598
-
10599
- var setAxes$1 = function () {
10600
- var matr = create$6();
10601
- return function (out, view, right, up) {
10602
- matr[0] = right[0];
10603
- matr[3] = right[1];
10604
- matr[6] = right[2];
10605
- matr[1] = up[0];
10606
- matr[4] = up[1];
10607
- matr[7] = up[2];
10608
- matr[2] = -view[0];
10609
- matr[5] = -view[1];
10610
- matr[8] = -view[2];
10611
- return normalize$2$1(out, fromMat3$1(out, matr));
10612
- };
10613
- }();
10614
9687
  /**
10615
9688
  * Provides camera action & animation.
10616
9689
  */
@@ -10649,15 +9722,15 @@
10649
9722
  this.roll += this.relRoll;
10650
9723
 
10651
9724
  if (this.type === exports.CameraType.EXPLORING) {
10652
- var rotX = setAxisAngle$1(create$4$1(), [1, 0, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relElevation));
10653
- var rotY = setAxisAngle$1(create$4$1(), [0, 1, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relAzimuth));
10654
- var rotZ = setAxisAngle$1(create$4$1(), [0, 0, 1], deg2rad(this.relRoll));
10655
- var rotQ = multiply$1$1(create$4$1(), rotY, rotX);
10656
- rotQ = multiply$1$1(create$4$1(), rotQ, rotZ);
10657
- var rotMatrix = fromQuat$1(create$1$1(), rotQ);
10658
- translate$1(this.matrix, this.matrix, [0, 0, -this.distance]);
10659
- multiply$3(this.matrix, this.matrix, rotMatrix);
10660
- translate$1(this.matrix, this.matrix, [0, 0, this.distance]);
9725
+ var rotX = setAxisAngle(create$4(), [1, 0, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relElevation));
9726
+ var rotY = setAxisAngle(create$4(), [0, 1, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relAzimuth));
9727
+ var rotZ = setAxisAngle(create$4(), [0, 0, 1], deg2rad(this.relRoll));
9728
+ var rotQ = multiply$2(create$4(), rotY, rotX);
9729
+ rotQ = multiply$2(create$4(), rotQ, rotZ);
9730
+ var rotMatrix = fromQuat(create$1(), rotQ);
9731
+ translate(this.matrix, this.matrix, [0, 0, -this.distance]);
9732
+ multiply(this.matrix, this.matrix, rotMatrix);
9733
+ translate(this.matrix, this.matrix, [0, 0, this.distance]);
10661
9734
  } else {
10662
9735
  if (Math.abs(this.elevation) > 90) {
10663
9736
  return this;
@@ -10685,9 +9758,9 @@
10685
9758
 
10686
9759
  _proto.pan = function pan(tx, ty) {
10687
9760
  var coords = createVec3(tx, ty, 0);
10688
- var pos = clone$1$1(this.position);
10689
- add$2(pos, pos, scale$2(create$2$1(), this.right, coords[0]));
10690
- add$2(pos, pos, scale$2(create$2$1(), this.up, coords[1]));
9761
+ var pos = clone$1(this.position);
9762
+ add$1(pos, pos, scale$1(create$2(), this.right, coords[0]));
9763
+ add$1(pos, pos, scale$1(create$2(), this.up, coords[1]));
10691
9764
 
10692
9765
  this._setPosition(pos);
10693
9766
 
@@ -10701,7 +9774,7 @@
10701
9774
 
10702
9775
  _proto.dolly = function dolly(value) {
10703
9776
  var n = this.forward;
10704
- var pos = clone$1$1(this.position);
9777
+ var pos = clone$1(this.position);
10705
9778
  var step = value * this.dollyingStep;
10706
9779
  var updatedDistance = this.distance + value * this.dollyingStep; // 限制视点距离范围
10707
9780
 
@@ -10717,7 +9790,7 @@
10717
9790
  this._getDistance();
10718
9791
  } else if (this.type === exports.CameraType.TRACKING) {
10719
9792
  // 保持视距,移动视点位置
10720
- add$2(this.focalPoint, pos, this.distanceVector);
9793
+ add$1(this.focalPoint, pos, this.distanceVector);
10721
9794
  }
10722
9795
 
10723
9796
  this.triggerUpdate();
@@ -10744,13 +9817,13 @@
10744
9817
  camera.setZoom(zoom || this.zoom);
10745
9818
  var landmark = {
10746
9819
  name: name,
10747
- matrix: clone$2(camera.getWorldTransform()),
10748
- right: clone$1$1(camera.right),
10749
- up: clone$1$1(camera.up),
10750
- forward: clone$1$1(camera.forward),
10751
- position: clone$1$1(camera.getPosition()),
10752
- focalPoint: clone$1$1(camera.getFocalPoint()),
10753
- distanceVector: clone$1$1(camera.getDistanceVector()),
9820
+ matrix: clone(camera.getWorldTransform()),
9821
+ right: clone$1(camera.right),
9822
+ up: clone$1(camera.up),
9823
+ forward: clone$1(camera.forward),
9824
+ position: clone$1(camera.getPosition()),
9825
+ focalPoint: clone$1(camera.getFocalPoint()),
9826
+ distanceVector: clone$1(camera.getDistanceVector()),
10754
9827
  distance: camera.getDistance(),
10755
9828
  dollyingStep: camera.getDollyingStep(),
10756
9829
  azimuth: camera.getAzimuth(),
@@ -10772,12 +9845,12 @@
10772
9845
  options = {};
10773
9846
  }
10774
9847
 
10775
- var landmark = isString$1(name) ? this.landmarks.find(function (l) {
9848
+ var landmark = isString(name) ? this.landmarks.find(function (l) {
10776
9849
  return l.name === name;
10777
9850
  }) : name;
10778
9851
 
10779
9852
  if (landmark) {
10780
- var _ref = isNumber$1(options) ? {
9853
+ var _ref = isNumber(options) ? {
10781
9854
  duration: options
10782
9855
  } : options,
10783
9856
  _ref$easing = _ref.easing,
@@ -10845,12 +9918,12 @@
10845
9918
 
10846
9919
 
10847
9920
  var t = easingFunc(elapsed / duration);
10848
- var interFocalPoint = create$2$1();
10849
- var interPosition = create$2$1();
9921
+ var interFocalPoint = create$2();
9922
+ var interPosition = create$2();
10850
9923
  var interZoom = 1;
10851
9924
  var interRoll = 0;
10852
- lerp$1(interFocalPoint, _this2.focalPoint, destFocalPoint, t);
10853
- lerp$1(interPosition, _this2.position, destPosition, t);
9925
+ lerp(interFocalPoint, _this2.focalPoint, destFocalPoint, t);
9926
+ lerp(interPosition, _this2.position, destPosition, t);
10854
9927
  interRoll = _this2.roll * (1 - t) + destRoll * t;
10855
9928
  interZoom = _this2.zoom * (1 - t) + destZoom * t;
10856
9929
 
@@ -10883,13 +9956,13 @@
10883
9956
  };
10884
9957
 
10885
9958
  _proto.syncFromLandmark = function syncFromLandmark(landmark) {
10886
- this.matrix = copy$5(this.matrix, landmark.matrix);
10887
- this.right = copy$1$1(this.right, landmark.right);
10888
- this.up = copy$1$1(this.up, landmark.up);
10889
- this.forward = copy$1$1(this.forward, landmark.forward);
10890
- this.position = copy$1$1(this.position, landmark.position);
10891
- this.focalPoint = copy$1$1(this.focalPoint, landmark.focalPoint);
10892
- this.distanceVector = copy$1$1(this.distanceVector, landmark.distanceVector);
9959
+ this.matrix = copy(this.matrix, landmark.matrix);
9960
+ this.right = copy$1(this.right, landmark.right);
9961
+ this.up = copy$1(this.up, landmark.up);
9962
+ this.forward = copy$1(this.forward, landmark.forward);
9963
+ this.position = copy$1(this.position, landmark.position);
9964
+ this.focalPoint = copy$1(this.focalPoint, landmark.focalPoint);
9965
+ this.distanceVector = copy$1(this.distanceVector, landmark.distanceVector);
10893
9966
  this.azimuth = landmark.azimuth;
10894
9967
  this.elevation = landmark.elevation;
10895
9968
  this.roll = landmark.roll;
@@ -13486,8 +12559,8 @@
13486
12559
  amplitude = _params$ === void 0 ? 1 : _params$,
13487
12560
  _params$2 = _params[1],
13488
12561
  period = _params$2 === void 0 ? 0.5 : _params$2;
13489
- var a = clamp$1(Number(amplitude), 1, 10);
13490
- var p = clamp$1(Number(period), 0.1, 2);
12562
+ var a = clamp(Number(amplitude), 1, 10);
12563
+ var p = clamp(Number(period), 0.1, 2);
13491
12564
  if (t === 0 || t === 1) return t;
13492
12565
  return -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p);
13493
12566
  };
@@ -13506,10 +12579,10 @@
13506
12579
  damping = _params2$3 === void 0 ? 10 : _params2$3,
13507
12580
  _params2$4 = _params2[3],
13508
12581
  velocity = _params2$4 === void 0 ? 0 : _params2$4;
13509
- mass = clamp$1(mass, 0.1, 1000);
13510
- stiffness = clamp$1(stiffness, 0.1, 1000);
13511
- damping = clamp$1(damping, 0.1, 1000);
13512
- velocity = clamp$1(velocity, 0.1, 1000);
12582
+ mass = clamp(mass, 0.1, 1000);
12583
+ stiffness = clamp(stiffness, 0.1, 1000);
12584
+ damping = clamp(damping, 0.1, 1000);
12585
+ velocity = clamp(velocity, 0.1, 1000);
13513
12586
  var w0 = Math.sqrt(stiffness / mass);
13514
12587
  var zeta = damping / (2 * Math.sqrt(stiffness * mass));
13515
12588
  var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
@@ -13594,7 +12667,7 @@
13594
12667
  steps = _params3$ === void 0 ? 10 : _params3$,
13595
12668
  type = _params3[1];
13596
12669
  var trunc = type == 'start' ? Math.ceil : Math.floor;
13597
- return trunc(clamp$1(t, 0, 1) * steps) / steps;
12670
+ return trunc(clamp(t, 0, 1) * steps) / steps;
13598
12671
  }; // @ts-ignore
13599
12672
 
13600
12673
 
@@ -14303,7 +13376,7 @@
14303
13376
  for (var i = 0; i < keyframes.length; i++) {
14304
13377
  var offset = keyframes[i].offset;
14305
13378
 
14306
- if (!isNil$1(offset)) {
13379
+ if (!isNil(offset)) {
14307
13380
  if (offset < previousOffset) {
14308
13381
  throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
14309
13382
  }
@@ -14336,7 +13409,7 @@
14336
13409
  for (var _i = 1; _i < length; _i++) {
14337
13410
  var _offset = keyframes[_i].computedOffset;
14338
13411
 
14339
- if (!isNil$1(_offset) && !isNil$1(previousOffset)) {
13412
+ if (!isNil(_offset) && !isNil(previousOffset)) {
14340
13413
  for (var j = 1; j < _i - previousIndex; j++) {
14341
13414
  keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
14342
13415
  }