@antv/g 5.13.2 → 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)
@@ -8997,8 +9045,7 @@
8997
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'
8998
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
8999
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
9000
- this.markerMidList.forEach(function(marker){marker.remove();});if(marker&&marker instanceof DisplayObject){// FIXME: should use original path instead of parsed curve
9001
- 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
9002
9049
  }}}/**
9003
9050
  * Returns the total length of the path.
9004
9051
  * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement/getTotalLength
@@ -9594,7 +9641,11 @@
9594
9641
  var canvasConfig=this.context.config;canvasConfig.width=width;canvasConfig.height=height;// resize context
9595
9642
  this.getContextService().resize(width,height);// resize camera
9596
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
9597
- ;_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
9598
9649
  this.inited=false;this.readyPromise=undefined;// FIXME: should re-create here?
9599
9650
  this.context.rBushRoot=new RBush();// reset rendering plugins
9600
9651
  this.context.renderingPlugins=[];this.context.renderingPlugins.push(new EventPlugin(),new PrepareRendererPlugin(),new DirtyCheckPlugin(),new CullingPlugin([new FrustumCullingStrategy()]));//
@@ -9606,11 +9657,12 @@
9606
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
9607
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
9608
9659
  this.destroy(false,true);// destroy all plugins, reverse will mutate origin array
9609
- [].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
9610
- path.reverse().forEach(function(child){// trigger before unmounted
9611
- 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
9612
- 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
9613
- 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);}/**
9614
9666
  * @deprecated
9615
9667
  * @alias client2Viewport
9616
9668
  */;_proto.getPointByClient=function getPointByClient(clientX,clientY){return this.client2Viewport({x:clientX,y:clientY});}/**
@@ -9618,40 +9670,6 @@
9618
9670
  * @alias viewport2Client
9619
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);
9620
9672
 
9621
- var toString$1 = {}.toString;
9622
- var isType$1 = function (value, type) { return toString$1.call(value) === '[object ' + type + ']'; };
9623
-
9624
- // isFinite,
9625
- var isNil$1 = function (value) {
9626
- /**
9627
- * isNil(null) => true
9628
- * isNil() => true
9629
- */
9630
- return value === null || value === undefined;
9631
- };
9632
-
9633
- var isString$1 = (function (str) {
9634
- return isType$1(str, 'String');
9635
- });
9636
-
9637
- var clamp$1 = function (a, min, max) {
9638
- if (a < min) {
9639
- return min;
9640
- }
9641
- else if (a > max) {
9642
- return max;
9643
- }
9644
- return a;
9645
- };
9646
-
9647
- /**
9648
- * 判断是否数字
9649
- * @return {Boolean} 是否数字
9650
- */
9651
- var isNumber$1 = function (value) {
9652
- return isType$1(value, 'Number');
9653
- };
9654
-
9655
9673
  function _inheritsLoose$1(subClass, superClass) {
9656
9674
  subClass.prototype = Object.create(superClass.prototype);
9657
9675
  subClass.prototype.constructor = subClass;
@@ -9666,946 +9684,6 @@
9666
9684
  };
9667
9685
  return _setPrototypeOf$1(o, p);
9668
9686
  }
9669
- /**
9670
- * Common utilities
9671
- * @module glMatrix
9672
- */
9673
- // Configuration Constants
9674
-
9675
-
9676
- var EPSILON$2 = 0.000001;
9677
- var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
9678
- if (!Math.hypot) Math.hypot = function () {
9679
- var y = 0,
9680
- i = arguments.length;
9681
-
9682
- while (i--) {
9683
- y += arguments[i] * arguments[i];
9684
- }
9685
-
9686
- return Math.sqrt(y);
9687
- };
9688
- /**
9689
- * 3x3 Matrix
9690
- * @module mat3
9691
- */
9692
-
9693
- /**
9694
- * Creates a new identity mat3
9695
- *
9696
- * @returns {mat3} a new 3x3 matrix
9697
- */
9698
-
9699
- function create$6() {
9700
- var out = new ARRAY_TYPE$1(9);
9701
-
9702
- if (ARRAY_TYPE$1 != Float32Array) {
9703
- out[1] = 0;
9704
- out[2] = 0;
9705
- out[3] = 0;
9706
- out[5] = 0;
9707
- out[6] = 0;
9708
- out[7] = 0;
9709
- }
9710
-
9711
- out[0] = 1;
9712
- out[4] = 1;
9713
- out[8] = 1;
9714
- return out;
9715
- }
9716
- /**
9717
- * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
9718
- * @module mat4
9719
- */
9720
-
9721
- /**
9722
- * Creates a new identity mat4
9723
- *
9724
- * @returns {mat4} a new 4x4 matrix
9725
- */
9726
-
9727
-
9728
- function create$1$1() {
9729
- var out = new ARRAY_TYPE$1(16);
9730
-
9731
- if (ARRAY_TYPE$1 != Float32Array) {
9732
- out[1] = 0;
9733
- out[2] = 0;
9734
- out[3] = 0;
9735
- out[4] = 0;
9736
- out[6] = 0;
9737
- out[7] = 0;
9738
- out[8] = 0;
9739
- out[9] = 0;
9740
- out[11] = 0;
9741
- out[12] = 0;
9742
- out[13] = 0;
9743
- out[14] = 0;
9744
- }
9745
-
9746
- out[0] = 1;
9747
- out[5] = 1;
9748
- out[10] = 1;
9749
- out[15] = 1;
9750
- return out;
9751
- }
9752
- /**
9753
- * Creates a new mat4 initialized with values from an existing matrix
9754
- *
9755
- * @param {ReadonlyMat4} a matrix to clone
9756
- * @returns {mat4} a new 4x4 matrix
9757
- */
9758
-
9759
-
9760
- function clone$2(a) {
9761
- var out = new ARRAY_TYPE$1(16);
9762
- out[0] = a[0];
9763
- out[1] = a[1];
9764
- out[2] = a[2];
9765
- out[3] = a[3];
9766
- out[4] = a[4];
9767
- out[5] = a[5];
9768
- out[6] = a[6];
9769
- out[7] = a[7];
9770
- out[8] = a[8];
9771
- out[9] = a[9];
9772
- out[10] = a[10];
9773
- out[11] = a[11];
9774
- out[12] = a[12];
9775
- out[13] = a[13];
9776
- out[14] = a[14];
9777
- out[15] = a[15];
9778
- return out;
9779
- }
9780
- /**
9781
- * Copy the values from one mat4 to another
9782
- *
9783
- * @param {mat4} out the receiving matrix
9784
- * @param {ReadonlyMat4} a the source matrix
9785
- * @returns {mat4} out
9786
- */
9787
-
9788
-
9789
- function copy$5(out, a) {
9790
- out[0] = a[0];
9791
- out[1] = a[1];
9792
- out[2] = a[2];
9793
- out[3] = a[3];
9794
- out[4] = a[4];
9795
- out[5] = a[5];
9796
- out[6] = a[6];
9797
- out[7] = a[7];
9798
- out[8] = a[8];
9799
- out[9] = a[9];
9800
- out[10] = a[10];
9801
- out[11] = a[11];
9802
- out[12] = a[12];
9803
- out[13] = a[13];
9804
- out[14] = a[14];
9805
- out[15] = a[15];
9806
- return out;
9807
- }
9808
- /**
9809
- * Multiplies two mat4s
9810
- *
9811
- * @param {mat4} out the receiving matrix
9812
- * @param {ReadonlyMat4} a the first operand
9813
- * @param {ReadonlyMat4} b the second operand
9814
- * @returns {mat4} out
9815
- */
9816
-
9817
-
9818
- function multiply$3(out, a, b) {
9819
- var a00 = a[0],
9820
- a01 = a[1],
9821
- a02 = a[2],
9822
- a03 = a[3];
9823
- var a10 = a[4],
9824
- a11 = a[5],
9825
- a12 = a[6],
9826
- a13 = a[7];
9827
- var a20 = a[8],
9828
- a21 = a[9],
9829
- a22 = a[10],
9830
- a23 = a[11];
9831
- var a30 = a[12],
9832
- a31 = a[13],
9833
- a32 = a[14],
9834
- a33 = a[15]; // Cache only the current line of the second matrix
9835
-
9836
- var b0 = b[0],
9837
- b1 = b[1],
9838
- b2 = b[2],
9839
- b3 = b[3];
9840
- out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9841
- out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9842
- out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9843
- out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9844
- b0 = b[4];
9845
- b1 = b[5];
9846
- b2 = b[6];
9847
- b3 = b[7];
9848
- out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9849
- out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9850
- out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9851
- out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9852
- b0 = b[8];
9853
- b1 = b[9];
9854
- b2 = b[10];
9855
- b3 = b[11];
9856
- out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9857
- out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9858
- out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9859
- out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9860
- b0 = b[12];
9861
- b1 = b[13];
9862
- b2 = b[14];
9863
- b3 = b[15];
9864
- out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
9865
- out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
9866
- out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
9867
- out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
9868
- return out;
9869
- }
9870
- /**
9871
- * Translate a mat4 by the given vector
9872
- *
9873
- * @param {mat4} out the receiving matrix
9874
- * @param {ReadonlyMat4} a the matrix to translate
9875
- * @param {ReadonlyVec3} v vector to translate by
9876
- * @returns {mat4} out
9877
- */
9878
-
9879
-
9880
- function translate$1(out, a, v) {
9881
- var x = v[0],
9882
- y = v[1],
9883
- z = v[2];
9884
- var a00, a01, a02, a03;
9885
- var a10, a11, a12, a13;
9886
- var a20, a21, a22, a23;
9887
-
9888
- if (a === out) {
9889
- out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
9890
- out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
9891
- out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
9892
- out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
9893
- } else {
9894
- a00 = a[0];
9895
- a01 = a[1];
9896
- a02 = a[2];
9897
- a03 = a[3];
9898
- a10 = a[4];
9899
- a11 = a[5];
9900
- a12 = a[6];
9901
- a13 = a[7];
9902
- a20 = a[8];
9903
- a21 = a[9];
9904
- a22 = a[10];
9905
- a23 = a[11];
9906
- out[0] = a00;
9907
- out[1] = a01;
9908
- out[2] = a02;
9909
- out[3] = a03;
9910
- out[4] = a10;
9911
- out[5] = a11;
9912
- out[6] = a12;
9913
- out[7] = a13;
9914
- out[8] = a20;
9915
- out[9] = a21;
9916
- out[10] = a22;
9917
- out[11] = a23;
9918
- out[12] = a00 * x + a10 * y + a20 * z + a[12];
9919
- out[13] = a01 * x + a11 * y + a21 * z + a[13];
9920
- out[14] = a02 * x + a12 * y + a22 * z + a[14];
9921
- out[15] = a03 * x + a13 * y + a23 * z + a[15];
9922
- }
9923
-
9924
- return out;
9925
- }
9926
- /**
9927
- * Calculates a 4x4 matrix from the given quaternion
9928
- *
9929
- * @param {mat4} out mat4 receiving operation result
9930
- * @param {ReadonlyQuat} q Quaternion to create matrix from
9931
- *
9932
- * @returns {mat4} out
9933
- */
9934
-
9935
-
9936
- function fromQuat$1(out, q) {
9937
- var x = q[0],
9938
- y = q[1],
9939
- z = q[2],
9940
- w = q[3];
9941
- var x2 = x + x;
9942
- var y2 = y + y;
9943
- var z2 = z + z;
9944
- var xx = x * x2;
9945
- var yx = y * x2;
9946
- var yy = y * y2;
9947
- var zx = z * x2;
9948
- var zy = z * y2;
9949
- var zz = z * z2;
9950
- var wx = w * x2;
9951
- var wy = w * y2;
9952
- var wz = w * z2;
9953
- out[0] = 1 - yy - zz;
9954
- out[1] = yx + wz;
9955
- out[2] = zx - wy;
9956
- out[3] = 0;
9957
- out[4] = yx - wz;
9958
- out[5] = 1 - xx - zz;
9959
- out[6] = zy + wx;
9960
- out[7] = 0;
9961
- out[8] = zx + wy;
9962
- out[9] = zy - wx;
9963
- out[10] = 1 - xx - yy;
9964
- out[11] = 0;
9965
- out[12] = 0;
9966
- out[13] = 0;
9967
- out[14] = 0;
9968
- out[15] = 1;
9969
- return out;
9970
- }
9971
- /**
9972
- * 3 Dimensional Vector
9973
- * @module vec3
9974
- */
9975
-
9976
- /**
9977
- * Creates a new, empty vec3
9978
- *
9979
- * @returns {vec3} a new 3D vector
9980
- */
9981
-
9982
-
9983
- function create$2$1() {
9984
- var out = new ARRAY_TYPE$1(3);
9985
-
9986
- if (ARRAY_TYPE$1 != Float32Array) {
9987
- out[0] = 0;
9988
- out[1] = 0;
9989
- out[2] = 0;
9990
- }
9991
-
9992
- return out;
9993
- }
9994
- /**
9995
- * Creates a new vec3 initialized with values from an existing vector
9996
- *
9997
- * @param {ReadonlyVec3} a vector to clone
9998
- * @returns {vec3} a new 3D vector
9999
- */
10000
-
10001
-
10002
- function clone$1$1(a) {
10003
- var out = new ARRAY_TYPE$1(3);
10004
- out[0] = a[0];
10005
- out[1] = a[1];
10006
- out[2] = a[2];
10007
- return out;
10008
- }
10009
- /**
10010
- * Calculates the length of a vec3
10011
- *
10012
- * @param {ReadonlyVec3} a vector to calculate length of
10013
- * @returns {Number} length of a
10014
- */
10015
-
10016
-
10017
- function length$1(a) {
10018
- var x = a[0];
10019
- var y = a[1];
10020
- var z = a[2];
10021
- return Math.hypot(x, y, z);
10022
- }
10023
- /**
10024
- * Creates a new vec3 initialized with the given values
10025
- *
10026
- * @param {Number} x X component
10027
- * @param {Number} y Y component
10028
- * @param {Number} z Z component
10029
- * @returns {vec3} a new 3D vector
10030
- */
10031
-
10032
-
10033
- function fromValues$6(x, y, z) {
10034
- var out = new ARRAY_TYPE$1(3);
10035
- out[0] = x;
10036
- out[1] = y;
10037
- out[2] = z;
10038
- return out;
10039
- }
10040
- /**
10041
- * Copy the values from one vec3 to another
10042
- *
10043
- * @param {vec3} out the receiving vector
10044
- * @param {ReadonlyVec3} a the source vector
10045
- * @returns {vec3} out
10046
- */
10047
-
10048
-
10049
- function copy$1$1(out, a) {
10050
- out[0] = a[0];
10051
- out[1] = a[1];
10052
- out[2] = a[2];
10053
- return out;
10054
- }
10055
- /**
10056
- * Adds two vec3's
10057
- *
10058
- * @param {vec3} out the receiving vector
10059
- * @param {ReadonlyVec3} a the first operand
10060
- * @param {ReadonlyVec3} b the second operand
10061
- * @returns {vec3} out
10062
- */
10063
-
10064
-
10065
- function add$2(out, a, b) {
10066
- out[0] = a[0] + b[0];
10067
- out[1] = a[1] + b[1];
10068
- out[2] = a[2] + b[2];
10069
- return out;
10070
- }
10071
- /**
10072
- * Scales a vec3 by a scalar number
10073
- *
10074
- * @param {vec3} out the receiving vector
10075
- * @param {ReadonlyVec3} a the vector to scale
10076
- * @param {Number} b amount to scale the vector by
10077
- * @returns {vec3} out
10078
- */
10079
-
10080
-
10081
- function scale$2(out, a, b) {
10082
- out[0] = a[0] * b;
10083
- out[1] = a[1] * b;
10084
- out[2] = a[2] * b;
10085
- return out;
10086
- }
10087
- /**
10088
- * Calculates the euclidian distance between two vec3's
10089
- *
10090
- * @param {ReadonlyVec3} a the first operand
10091
- * @param {ReadonlyVec3} b the second operand
10092
- * @returns {Number} distance between a and b
10093
- */
10094
-
10095
-
10096
- function distance$1(a, b) {
10097
- var x = b[0] - a[0];
10098
- var y = b[1] - a[1];
10099
- var z = b[2] - a[2];
10100
- return Math.hypot(x, y, z);
10101
- }
10102
- /**
10103
- * Normalize a vec3
10104
- *
10105
- * @param {vec3} out the receiving vector
10106
- * @param {ReadonlyVec3} a vector to normalize
10107
- * @returns {vec3} out
10108
- */
10109
-
10110
-
10111
- function normalize$5(out, a) {
10112
- var x = a[0];
10113
- var y = a[1];
10114
- var z = a[2];
10115
- var len = x * x + y * y + z * z;
10116
-
10117
- if (len > 0) {
10118
- //TODO: evaluate use of glm_invsqrt here?
10119
- len = 1 / Math.sqrt(len);
10120
- }
10121
-
10122
- out[0] = a[0] * len;
10123
- out[1] = a[1] * len;
10124
- out[2] = a[2] * len;
10125
- return out;
10126
- }
10127
- /**
10128
- * Calculates the dot product of two vec3's
10129
- *
10130
- * @param {ReadonlyVec3} a the first operand
10131
- * @param {ReadonlyVec3} b the second operand
10132
- * @returns {Number} dot product of a and b
10133
- */
10134
-
10135
-
10136
- function dot$3(a, b) {
10137
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
10138
- }
10139
- /**
10140
- * Computes the cross product of two vec3's
10141
- *
10142
- * @param {vec3} out the receiving vector
10143
- * @param {ReadonlyVec3} a the first operand
10144
- * @param {ReadonlyVec3} b the second operand
10145
- * @returns {vec3} out
10146
- */
10147
-
10148
-
10149
- function cross$1(out, a, b) {
10150
- var ax = a[0],
10151
- ay = a[1],
10152
- az = a[2];
10153
- var bx = b[0],
10154
- by = b[1],
10155
- bz = b[2];
10156
- out[0] = ay * bz - az * by;
10157
- out[1] = az * bx - ax * bz;
10158
- out[2] = ax * by - ay * bx;
10159
- return out;
10160
- }
10161
- /**
10162
- * Performs a linear interpolation between two vec3's
10163
- *
10164
- * @param {vec3} out the receiving vector
10165
- * @param {ReadonlyVec3} a the first operand
10166
- * @param {ReadonlyVec3} b the second operand
10167
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
10168
- * @returns {vec3} out
10169
- */
10170
-
10171
-
10172
- function lerp$1(out, a, b, t) {
10173
- var ax = a[0];
10174
- var ay = a[1];
10175
- var az = a[2];
10176
- out[0] = ax + t * (b[0] - ax);
10177
- out[1] = ay + t * (b[1] - ay);
10178
- out[2] = az + t * (b[2] - az);
10179
- return out;
10180
- }
10181
- /**
10182
- * Alias for {@link vec3.distance}
10183
- * @function
10184
- */
10185
-
10186
-
10187
- var dist = distance$1;
10188
- /**
10189
- * Alias for {@link vec3.length}
10190
- * @function
10191
- */
10192
-
10193
- var len$1 = length$1;
10194
- /**
10195
- * Perform some operation over an array of vec3s.
10196
- *
10197
- * @param {Array} a the array of vectors to iterate over
10198
- * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
10199
- * @param {Number} offset Number of elements to skip at the beginning of the array
10200
- * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
10201
- * @param {Function} fn Function to call for each vector in the array
10202
- * @param {Object} [arg] additional argument to pass to fn
10203
- * @returns {Array} a
10204
- * @function
10205
- */
10206
-
10207
- var forEach$3 = function () {
10208
- var vec = create$2$1();
10209
- return function (a, stride, offset, count, fn, arg) {
10210
- var i, l;
10211
-
10212
- if (!stride) {
10213
- stride = 3;
10214
- }
10215
-
10216
- if (!offset) {
10217
- offset = 0;
10218
- }
10219
-
10220
- if (count) {
10221
- l = Math.min(count * stride + offset, a.length);
10222
- } else {
10223
- l = a.length;
10224
- }
10225
-
10226
- for (i = offset; i < l; i += stride) {
10227
- vec[0] = a[i];
10228
- vec[1] = a[i + 1];
10229
- vec[2] = a[i + 2];
10230
- fn(vec, vec, arg);
10231
- a[i] = vec[0];
10232
- a[i + 1] = vec[1];
10233
- a[i + 2] = vec[2];
10234
- }
10235
-
10236
- return a;
10237
- };
10238
- }();
10239
- /**
10240
- * 4 Dimensional Vector
10241
- * @module vec4
10242
- */
10243
-
10244
- /**
10245
- * Creates a new, empty vec4
10246
- *
10247
- * @returns {vec4} a new 4D vector
10248
- */
10249
-
10250
-
10251
- function create$3$1() {
10252
- var out = new ARRAY_TYPE$1(4);
10253
-
10254
- if (ARRAY_TYPE$1 != Float32Array) {
10255
- out[0] = 0;
10256
- out[1] = 0;
10257
- out[2] = 0;
10258
- out[3] = 0;
10259
- }
10260
-
10261
- return out;
10262
- }
10263
- /**
10264
- * Normalize a vec4
10265
- *
10266
- * @param {vec4} out the receiving vector
10267
- * @param {ReadonlyVec4} a vector to normalize
10268
- * @returns {vec4} out
10269
- */
10270
-
10271
-
10272
- function normalize$1$1(out, a) {
10273
- var x = a[0];
10274
- var y = a[1];
10275
- var z = a[2];
10276
- var w = a[3];
10277
- var len = x * x + y * y + z * z + w * w;
10278
-
10279
- if (len > 0) {
10280
- len = 1 / Math.sqrt(len);
10281
- }
10282
-
10283
- out[0] = x * len;
10284
- out[1] = y * len;
10285
- out[2] = z * len;
10286
- out[3] = w * len;
10287
- return out;
10288
- }
10289
- /**
10290
- * Perform some operation over an array of vec4s.
10291
- *
10292
- * @param {Array} a the array of vectors to iterate over
10293
- * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
10294
- * @param {Number} offset Number of elements to skip at the beginning of the array
10295
- * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
10296
- * @param {Function} fn Function to call for each vector in the array
10297
- * @param {Object} [arg] additional argument to pass to fn
10298
- * @returns {Array} a
10299
- * @function
10300
- */
10301
-
10302
-
10303
- var forEach$1$1 = function () {
10304
- var vec = create$3$1();
10305
- return function (a, stride, offset, count, fn, arg) {
10306
- var i, l;
10307
-
10308
- if (!stride) {
10309
- stride = 4;
10310
- }
10311
-
10312
- if (!offset) {
10313
- offset = 0;
10314
- }
10315
-
10316
- if (count) {
10317
- l = Math.min(count * stride + offset, a.length);
10318
- } else {
10319
- l = a.length;
10320
- }
10321
-
10322
- for (i = offset; i < l; i += stride) {
10323
- vec[0] = a[i];
10324
- vec[1] = a[i + 1];
10325
- vec[2] = a[i + 2];
10326
- vec[3] = a[i + 3];
10327
- fn(vec, vec, arg);
10328
- a[i] = vec[0];
10329
- a[i + 1] = vec[1];
10330
- a[i + 2] = vec[2];
10331
- a[i + 3] = vec[3];
10332
- }
10333
-
10334
- return a;
10335
- };
10336
- }();
10337
- /**
10338
- * Quaternion
10339
- * @module quat
10340
- */
10341
-
10342
- /**
10343
- * Creates a new identity quat
10344
- *
10345
- * @returns {quat} a new quaternion
10346
- */
10347
-
10348
-
10349
- function create$4$1() {
10350
- var out = new ARRAY_TYPE$1(4);
10351
-
10352
- if (ARRAY_TYPE$1 != Float32Array) {
10353
- out[0] = 0;
10354
- out[1] = 0;
10355
- out[2] = 0;
10356
- }
10357
-
10358
- out[3] = 1;
10359
- return out;
10360
- }
10361
- /**
10362
- * Sets a quat from the given angle and rotation axis,
10363
- * then returns it.
10364
- *
10365
- * @param {quat} out the receiving quaternion
10366
- * @param {ReadonlyVec3} axis the axis around which to rotate
10367
- * @param {Number} rad the angle in radians
10368
- * @returns {quat} out
10369
- **/
10370
-
10371
-
10372
- function setAxisAngle$1(out, axis, rad) {
10373
- rad = rad * 0.5;
10374
- var s = Math.sin(rad);
10375
- out[0] = s * axis[0];
10376
- out[1] = s * axis[1];
10377
- out[2] = s * axis[2];
10378
- out[3] = Math.cos(rad);
10379
- return out;
10380
- }
10381
- /**
10382
- * Multiplies two quat's
10383
- *
10384
- * @param {quat} out the receiving quaternion
10385
- * @param {ReadonlyQuat} a the first operand
10386
- * @param {ReadonlyQuat} b the second operand
10387
- * @returns {quat} out
10388
- */
10389
-
10390
-
10391
- function multiply$1$1(out, a, b) {
10392
- var ax = a[0],
10393
- ay = a[1],
10394
- az = a[2],
10395
- aw = a[3];
10396
- var bx = b[0],
10397
- by = b[1],
10398
- bz = b[2],
10399
- bw = b[3];
10400
- out[0] = ax * bw + aw * bx + ay * bz - az * by;
10401
- out[1] = ay * bw + aw * by + az * bx - ax * bz;
10402
- out[2] = az * bw + aw * bz + ax * by - ay * bx;
10403
- out[3] = aw * bw - ax * bx - ay * by - az * bz;
10404
- return out;
10405
- }
10406
- /**
10407
- * Performs a spherical linear interpolation between two quat
10408
- *
10409
- * @param {quat} out the receiving quaternion
10410
- * @param {ReadonlyQuat} a the first operand
10411
- * @param {ReadonlyQuat} b the second operand
10412
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
10413
- * @returns {quat} out
10414
- */
10415
-
10416
-
10417
- function slerp$1(out, a, b, t) {
10418
- // benchmarks:
10419
- // http://jsperf.com/quaternion-slerp-implementations
10420
- var ax = a[0],
10421
- ay = a[1],
10422
- az = a[2],
10423
- aw = a[3];
10424
- var bx = b[0],
10425
- by = b[1],
10426
- bz = b[2],
10427
- bw = b[3];
10428
- var omega, cosom, sinom, scale0, scale1; // calc cosine
10429
-
10430
- cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)
10431
-
10432
- if (cosom < 0.0) {
10433
- cosom = -cosom;
10434
- bx = -bx;
10435
- by = -by;
10436
- bz = -bz;
10437
- bw = -bw;
10438
- } // calculate coefficients
10439
-
10440
-
10441
- if (1.0 - cosom > EPSILON$2) {
10442
- // standard case (slerp)
10443
- omega = Math.acos(cosom);
10444
- sinom = Math.sin(omega);
10445
- scale0 = Math.sin((1.0 - t) * omega) / sinom;
10446
- scale1 = Math.sin(t * omega) / sinom;
10447
- } else {
10448
- // "from" and "to" quaternions are very close
10449
- // ... so we can do a linear interpolation
10450
- scale0 = 1.0 - t;
10451
- scale1 = t;
10452
- } // calculate final values
10453
-
10454
-
10455
- out[0] = scale0 * ax + scale1 * bx;
10456
- out[1] = scale0 * ay + scale1 * by;
10457
- out[2] = scale0 * az + scale1 * bz;
10458
- out[3] = scale0 * aw + scale1 * bw;
10459
- return out;
10460
- }
10461
- /**
10462
- * Creates a quaternion from the given 3x3 rotation matrix.
10463
- *
10464
- * NOTE: The resultant quaternion is not normalized, so you should be sure
10465
- * to renormalize the quaternion yourself where necessary.
10466
- *
10467
- * @param {quat} out the receiving quaternion
10468
- * @param {ReadonlyMat3} m rotation matrix
10469
- * @returns {quat} out
10470
- * @function
10471
- */
10472
-
10473
-
10474
- function fromMat3$1(out, m) {
10475
- // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
10476
- // article "Quaternion Calculus and Fast Animation".
10477
- var fTrace = m[0] + m[4] + m[8];
10478
- var fRoot;
10479
-
10480
- if (fTrace > 0.0) {
10481
- // |w| > 1/2, may as well choose w > 1/2
10482
- fRoot = Math.sqrt(fTrace + 1.0); // 2w
10483
-
10484
- out[3] = 0.5 * fRoot;
10485
- fRoot = 0.5 / fRoot; // 1/(4w)
10486
-
10487
- out[0] = (m[5] - m[7]) * fRoot;
10488
- out[1] = (m[6] - m[2]) * fRoot;
10489
- out[2] = (m[1] - m[3]) * fRoot;
10490
- } else {
10491
- // |w| <= 1/2
10492
- var i = 0;
10493
- if (m[4] > m[0]) i = 1;
10494
- if (m[8] > m[i * 3 + i]) i = 2;
10495
- var j = (i + 1) % 3;
10496
- var k = (i + 2) % 3;
10497
- fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
10498
- out[i] = 0.5 * fRoot;
10499
- fRoot = 0.5 / fRoot;
10500
- out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
10501
- out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
10502
- out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
10503
- }
10504
-
10505
- return out;
10506
- }
10507
- /**
10508
- * Normalize a quat
10509
- *
10510
- * @param {quat} out the receiving quaternion
10511
- * @param {ReadonlyQuat} a quaternion to normalize
10512
- * @returns {quat} out
10513
- * @function
10514
- */
10515
-
10516
-
10517
- var normalize$2$1 = normalize$1$1;
10518
- /**
10519
- * Sets a quaternion to represent the shortest rotation from one
10520
- * vector to another.
10521
- *
10522
- * Both vectors are assumed to be unit length.
10523
- *
10524
- * @param {quat} out the receiving quaternion.
10525
- * @param {ReadonlyVec3} a the initial vector
10526
- * @param {ReadonlyVec3} b the destination vector
10527
- * @returns {quat} out
10528
- */
10529
-
10530
- var rotationTo$1 = function () {
10531
- var tmpvec3 = create$2$1();
10532
- var xUnitVec3 = fromValues$6(1, 0, 0);
10533
- var yUnitVec3 = fromValues$6(0, 1, 0);
10534
- return function (out, a, b) {
10535
- var dot$1 = dot$3(a, b);
10536
-
10537
- if (dot$1 < -0.999999) {
10538
- cross$1(tmpvec3, xUnitVec3, a);
10539
- if (len$1(tmpvec3) < 0.000001) cross$1(tmpvec3, yUnitVec3, a);
10540
- normalize$5(tmpvec3, tmpvec3);
10541
- setAxisAngle$1(out, tmpvec3, Math.PI);
10542
- return out;
10543
- } else if (dot$1 > 0.999999) {
10544
- out[0] = 0;
10545
- out[1] = 0;
10546
- out[2] = 0;
10547
- out[3] = 1;
10548
- return out;
10549
- } else {
10550
- cross$1(tmpvec3, a, b);
10551
- out[0] = tmpvec3[0];
10552
- out[1] = tmpvec3[1];
10553
- out[2] = tmpvec3[2];
10554
- out[3] = 1 + dot$1;
10555
- return normalize$2$1(out, out);
10556
- }
10557
- };
10558
- }();
10559
- /**
10560
- * Performs a spherical linear interpolation with two control points
10561
- *
10562
- * @param {quat} out the receiving quaternion
10563
- * @param {ReadonlyQuat} a the first operand
10564
- * @param {ReadonlyQuat} b the second operand
10565
- * @param {ReadonlyQuat} c the third operand
10566
- * @param {ReadonlyQuat} d the fourth operand
10567
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
10568
- * @returns {quat} out
10569
- */
10570
-
10571
-
10572
- var sqlerp$1 = function () {
10573
- var temp1 = create$4$1();
10574
- var temp2 = create$4$1();
10575
- return function (out, a, b, c, d, t) {
10576
- slerp$1(temp1, a, d, t);
10577
- slerp$1(temp2, b, c, t);
10578
- slerp$1(out, temp1, temp2, 2 * t * (1 - t));
10579
- return out;
10580
- };
10581
- }();
10582
- /**
10583
- * Sets the specified quaternion with values corresponding to the given
10584
- * axes. Each axis is a vec3 and is expected to be unit length and
10585
- * perpendicular to all other specified axes.
10586
- *
10587
- * @param {ReadonlyVec3} view the vector representing the viewing direction
10588
- * @param {ReadonlyVec3} right the vector representing the local "right" direction
10589
- * @param {ReadonlyVec3} up the vector representing the local "up" direction
10590
- * @returns {quat} out
10591
- */
10592
-
10593
-
10594
- var setAxes$1 = function () {
10595
- var matr = create$6();
10596
- return function (out, view, right, up) {
10597
- matr[0] = right[0];
10598
- matr[3] = right[1];
10599
- matr[6] = right[2];
10600
- matr[1] = up[0];
10601
- matr[4] = up[1];
10602
- matr[7] = up[2];
10603
- matr[2] = -view[0];
10604
- matr[5] = -view[1];
10605
- matr[8] = -view[2];
10606
- return normalize$2$1(out, fromMat3$1(out, matr));
10607
- };
10608
- }();
10609
9687
  /**
10610
9688
  * Provides camera action & animation.
10611
9689
  */
@@ -10644,15 +9722,15 @@
10644
9722
  this.roll += this.relRoll;
10645
9723
 
10646
9724
  if (this.type === exports.CameraType.EXPLORING) {
10647
- var rotX = setAxisAngle$1(create$4$1(), [1, 0, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relElevation));
10648
- var rotY = setAxisAngle$1(create$4$1(), [0, 1, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relAzimuth));
10649
- var rotZ = setAxisAngle$1(create$4$1(), [0, 0, 1], deg2rad(this.relRoll));
10650
- var rotQ = multiply$1$1(create$4$1(), rotY, rotX);
10651
- rotQ = multiply$1$1(create$4$1(), rotQ, rotZ);
10652
- var rotMatrix = fromQuat$1(create$1$1(), rotQ);
10653
- translate$1(this.matrix, this.matrix, [0, 0, -this.distance]);
10654
- multiply$3(this.matrix, this.matrix, rotMatrix);
10655
- 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]);
10656
9734
  } else {
10657
9735
  if (Math.abs(this.elevation) > 90) {
10658
9736
  return this;
@@ -10680,9 +9758,9 @@
10680
9758
 
10681
9759
  _proto.pan = function pan(tx, ty) {
10682
9760
  var coords = createVec3(tx, ty, 0);
10683
- var pos = clone$1$1(this.position);
10684
- add$2(pos, pos, scale$2(create$2$1(), this.right, coords[0]));
10685
- 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]));
10686
9764
 
10687
9765
  this._setPosition(pos);
10688
9766
 
@@ -10696,7 +9774,7 @@
10696
9774
 
10697
9775
  _proto.dolly = function dolly(value) {
10698
9776
  var n = this.forward;
10699
- var pos = clone$1$1(this.position);
9777
+ var pos = clone$1(this.position);
10700
9778
  var step = value * this.dollyingStep;
10701
9779
  var updatedDistance = this.distance + value * this.dollyingStep; // 限制视点距离范围
10702
9780
 
@@ -10712,7 +9790,7 @@
10712
9790
  this._getDistance();
10713
9791
  } else if (this.type === exports.CameraType.TRACKING) {
10714
9792
  // 保持视距,移动视点位置
10715
- add$2(this.focalPoint, pos, this.distanceVector);
9793
+ add$1(this.focalPoint, pos, this.distanceVector);
10716
9794
  }
10717
9795
 
10718
9796
  this.triggerUpdate();
@@ -10739,13 +9817,13 @@
10739
9817
  camera.setZoom(zoom || this.zoom);
10740
9818
  var landmark = {
10741
9819
  name: name,
10742
- matrix: clone$2(camera.getWorldTransform()),
10743
- right: clone$1$1(camera.right),
10744
- up: clone$1$1(camera.up),
10745
- forward: clone$1$1(camera.forward),
10746
- position: clone$1$1(camera.getPosition()),
10747
- focalPoint: clone$1$1(camera.getFocalPoint()),
10748
- 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()),
10749
9827
  distance: camera.getDistance(),
10750
9828
  dollyingStep: camera.getDollyingStep(),
10751
9829
  azimuth: camera.getAzimuth(),
@@ -10767,12 +9845,12 @@
10767
9845
  options = {};
10768
9846
  }
10769
9847
 
10770
- var landmark = isString$1(name) ? this.landmarks.find(function (l) {
9848
+ var landmark = isString(name) ? this.landmarks.find(function (l) {
10771
9849
  return l.name === name;
10772
9850
  }) : name;
10773
9851
 
10774
9852
  if (landmark) {
10775
- var _ref = isNumber$1(options) ? {
9853
+ var _ref = isNumber(options) ? {
10776
9854
  duration: options
10777
9855
  } : options,
10778
9856
  _ref$easing = _ref.easing,
@@ -10840,12 +9918,12 @@
10840
9918
 
10841
9919
 
10842
9920
  var t = easingFunc(elapsed / duration);
10843
- var interFocalPoint = create$2$1();
10844
- var interPosition = create$2$1();
9921
+ var interFocalPoint = create$2();
9922
+ var interPosition = create$2();
10845
9923
  var interZoom = 1;
10846
9924
  var interRoll = 0;
10847
- lerp$1(interFocalPoint, _this2.focalPoint, destFocalPoint, t);
10848
- lerp$1(interPosition, _this2.position, destPosition, t);
9925
+ lerp(interFocalPoint, _this2.focalPoint, destFocalPoint, t);
9926
+ lerp(interPosition, _this2.position, destPosition, t);
10849
9927
  interRoll = _this2.roll * (1 - t) + destRoll * t;
10850
9928
  interZoom = _this2.zoom * (1 - t) + destZoom * t;
10851
9929
 
@@ -10878,13 +9956,13 @@
10878
9956
  };
10879
9957
 
10880
9958
  _proto.syncFromLandmark = function syncFromLandmark(landmark) {
10881
- this.matrix = copy$5(this.matrix, landmark.matrix);
10882
- this.right = copy$1$1(this.right, landmark.right);
10883
- this.up = copy$1$1(this.up, landmark.up);
10884
- this.forward = copy$1$1(this.forward, landmark.forward);
10885
- this.position = copy$1$1(this.position, landmark.position);
10886
- this.focalPoint = copy$1$1(this.focalPoint, landmark.focalPoint);
10887
- 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);
10888
9966
  this.azimuth = landmark.azimuth;
10889
9967
  this.elevation = landmark.elevation;
10890
9968
  this.roll = landmark.roll;
@@ -13481,8 +12559,8 @@
13481
12559
  amplitude = _params$ === void 0 ? 1 : _params$,
13482
12560
  _params$2 = _params[1],
13483
12561
  period = _params$2 === void 0 ? 0.5 : _params$2;
13484
- var a = clamp$1(Number(amplitude), 1, 10);
13485
- 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);
13486
12564
  if (t === 0 || t === 1) return t;
13487
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);
13488
12566
  };
@@ -13501,10 +12579,10 @@
13501
12579
  damping = _params2$3 === void 0 ? 10 : _params2$3,
13502
12580
  _params2$4 = _params2[3],
13503
12581
  velocity = _params2$4 === void 0 ? 0 : _params2$4;
13504
- mass = clamp$1(mass, 0.1, 1000);
13505
- stiffness = clamp$1(stiffness, 0.1, 1000);
13506
- damping = clamp$1(damping, 0.1, 1000);
13507
- 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);
13508
12586
  var w0 = Math.sqrt(stiffness / mass);
13509
12587
  var zeta = damping / (2 * Math.sqrt(stiffness * mass));
13510
12588
  var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
@@ -13589,7 +12667,7 @@
13589
12667
  steps = _params3$ === void 0 ? 10 : _params3$,
13590
12668
  type = _params3[1];
13591
12669
  var trunc = type == 'start' ? Math.ceil : Math.floor;
13592
- return trunc(clamp$1(t, 0, 1) * steps) / steps;
12670
+ return trunc(clamp(t, 0, 1) * steps) / steps;
13593
12671
  }; // @ts-ignore
13594
12672
 
13595
12673
 
@@ -14298,7 +13376,7 @@
14298
13376
  for (var i = 0; i < keyframes.length; i++) {
14299
13377
  var offset = keyframes[i].offset;
14300
13378
 
14301
- if (!isNil$1(offset)) {
13379
+ if (!isNil(offset)) {
14302
13380
  if (offset < previousOffset) {
14303
13381
  throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
14304
13382
  }
@@ -14331,7 +13409,7 @@
14331
13409
  for (var _i = 1; _i < length; _i++) {
14332
13410
  var _offset = keyframes[_i].computedOffset;
14333
13411
 
14334
- if (!isNil$1(_offset) && !isNil$1(previousOffset)) {
13412
+ if (!isNil(_offset) && !isNil(previousOffset)) {
14335
13413
  for (var j = 1; j < _i - previousIndex; j++) {
14336
13414
  keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
14337
13415
  }