@antv/g 5.16.10 → 5.16.12
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 +563 -359
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -7035,7 +7035,7 @@
|
|
|
7035
7035
|
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts
|
|
7036
7036
|
*/PropertySyntax["LIST_OF_POINTS"]="<list-of-points>";PropertySyntax["PATH"]="<path>";/**
|
|
7037
7037
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax
|
|
7038
|
-
*/PropertySyntax["FILTER"]="<filter>";PropertySyntax["Z_INDEX"]="<z-index>";PropertySyntax["OFFSET_DISTANCE"]="<offset-distance>";PropertySyntax["DEFINED_PATH"]="<defined-path>";PropertySyntax["MARKER"]="<marker>";PropertySyntax["TRANSFORM"]="<transform>";PropertySyntax["TRANSFORM_ORIGIN"]="<transform-origin>";PropertySyntax["TEXT"]="<text>";PropertySyntax["TEXT_TRANSFORM"]="<text-transform>";})(exports.PropertySyntax||(exports.PropertySyntax={}));function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value;},$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 defineProperty(generator,"_invoke",{value:makeInvokeMethod(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;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(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);}};}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(undefined===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),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,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),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(val){var object=Object(val),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,_toPropertyKey(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.");}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return (hint==="string"?String:Number)(input);}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}// These units are iterated through, so be careful when adding or changing the
|
|
7038
|
+
*/PropertySyntax["FILTER"]="<filter>";PropertySyntax["Z_INDEX"]="<z-index>";PropertySyntax["OFFSET_DISTANCE"]="<offset-distance>";PropertySyntax["DEFINED_PATH"]="<defined-path>";PropertySyntax["MARKER"]="<marker>";PropertySyntax["TRANSFORM"]="<transform>";PropertySyntax["TRANSFORM_ORIGIN"]="<transform-origin>";PropertySyntax["TEXT"]="<text>";PropertySyntax["TEXT_TRANSFORM"]="<text-transform>";})(exports.PropertySyntax||(exports.PropertySyntax={}));function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value;},$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 defineProperty(generator,"_invoke",{value:makeInvokeMethod(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;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(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);}};}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(undefined===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),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,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),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(val){var object=Object(val),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,_toPropertyKey(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.");}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return (hint==="string"?String:Number)(input);}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}// These units are iterated through, so be careful when adding or changing the
|
|
7039
7039
|
// order.
|
|
7040
7040
|
(function(UnitType){UnitType[UnitType["kUnknown"]=0]="kUnknown";UnitType[UnitType["kNumber"]=1]="kNumber";UnitType[UnitType["kPercentage"]=2]="kPercentage";// Length units
|
|
7041
7041
|
UnitType[UnitType["kEms"]=3]="kEms";// kExs,
|
|
@@ -7585,7 +7585,7 @@
|
|
|
7585
7585
|
// is -1, then negate the matrix and the scaling factors.
|
|
7586
7586
|
cross(pdum3,row[1],row[2]);if(dot(row[0],pdum3)<0){for(var i=0;i<3;i++){scale[i]*=-1;row[i][0]*=-1;row[i][1]*=-1;row[i][2]*=-1;}}// Now, get the rotations out
|
|
7587
7587
|
quaternion[0]=0.5*Math.sqrt(Math.max(1+row[0][0]-row[1][1]-row[2][2],0));quaternion[1]=0.5*Math.sqrt(Math.max(1-row[0][0]+row[1][1]-row[2][2],0));quaternion[2]=0.5*Math.sqrt(Math.max(1-row[0][0]-row[1][1]+row[2][2],0));quaternion[3]=0.5*Math.sqrt(Math.max(1+row[0][0]+row[1][1]+row[2][2],0));if(row[2][1]>row[1][2])quaternion[0]=-quaternion[0];if(row[0][2]>row[2][0])quaternion[1]=-quaternion[1];if(row[1][0]>row[0][1])quaternion[2]=-quaternion[2];return true;}function normalize$4(out,mat){var m44=mat[15];// Cannot normalize.
|
|
7588
|
-
if(m44===0)return false;var scale=1/m44;for(var i=0;i<16;i++)
|
|
7588
|
+
if(m44===0)return false;var scale=1/m44;for(var i=0;i<16;i++)out[i]=mat[i]*scale;return true;}//gets upper-left of a 4x4 matrix into a 3x3 of vectors
|
|
7589
7589
|
function mat3from4(out,mat4x4){out[0][0]=mat4x4[0];out[0][1]=mat4x4[1];out[0][2]=mat4x4[2];out[1][0]=mat4x4[4];out[1][1]=mat4x4[5];out[1][2]=mat4x4[6];out[2][0]=mat4x4[8];out[2][1]=mat4x4[9];out[2][2]=mat4x4[10];}function combine(out,a,b,scale1,scale2){out[0]=a[0]*scale1+b[0]*scale2;out[1]=a[1]*scale1+b[1]*scale2;out[2]=a[2]*scale1+b[2]*scale2;}var tmpMat4=create$1();function parsedTransformToMat4(transform,object){if(transform&&transform.length){var defX=0;var defY=0;if(object){defX=object.parsedStyle.defX||0;defY=object.parsedStyle.defY||0;// reset transform
|
|
7590
7590
|
object.resetLocalTransform();object.setLocalPosition(defX,defY);}else {object=new DisplayObject({});}transform.forEach(function(parsed){var t=parsed.t,d=parsed.d;if(t==='scale'){// scale(1) scale(1, 1)
|
|
7591
7591
|
var newScale=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1,1];object.scaleLocal(newScale[0],newScale[1],1);}else if(t==='scalex'){var _newScale=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(_newScale[0],1,1);}else if(t==='scaley'){var _newScale2=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(1,_newScale2[0],1);}else if(t==='scalez'){var _newScale3=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(1,1,_newScale3[0]);}else if(t==='scale3d'){var _newScale4=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1,1,1];object.scaleLocal(_newScale4[0],_newScale4[1],_newScale4[2]);}else if(t==='translate'){var newTranslation=d||[Opx,Opx];object.translateLocal(newTranslation[0].value,newTranslation[1].value,0);}else if(t==='translatex'){var _newTranslation=d||[Opx];object.translateLocal(_newTranslation[0].value,0,0);}else if(t==='translatey'){var _newTranslation2=d||[Opx];object.translateLocal(0,_newTranslation2[0].value,0);}else if(t==='translatez'){var _newTranslation3=d||[Opx];object.translateLocal(0,0,_newTranslation3[0].value);}else if(t==='translate3d'){var _newTranslation4=d||[Opx,Opx,Opx];object.translateLocal(_newTranslation4[0].value,_newTranslation4[1].value,_newTranslation4[2].value);}else if(t==='rotate'){var newAngles=d||[Odeg];object.rotateLocal(0,0,convertAngleUnit(newAngles[0]));}else if(t==='rotatex'){var _newAngles=d||[Odeg];object.rotateLocal(convertAngleUnit(_newAngles[0]),0,0);}else if(t==='rotatey'){var _newAngles2=d||[Odeg];object.rotateLocal(0,convertAngleUnit(_newAngles2[0]),0);}else if(t==='rotatez'){var _newAngles3=d||[Odeg];object.rotateLocal(0,0,convertAngleUnit(_newAngles3[0]));}else if(t==='rotate3d');else if(t==='skew'){var newSkew=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[0,0];object.setLocalSkew(deg2rad(newSkew[0]),deg2rad(newSkew[1]));}else if(t==='skewx'){var _newSkew=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[0];object.setLocalSkew(deg2rad(_newSkew[0]),object.getLocalSkew()[1]);}else if(t==='skewy'){var _newSkew2=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[0];object.setLocalSkew(object.getLocalSkew()[0],deg2rad(_newSkew2[0]));}else if(t==='matrix'){var _d$map=d.map(function(s){return s.value;}),a=_d$map[0],b=_d$map[1],c=_d$map[2],dd=_d$map[3],tx=_d$map[4],ty=_d$map[5];object.setLocalTransform(set(tmpMat4,a,b,0,0,c,dd,0,0,0,0,1,0,tx+defX,ty+defY,0,1));}else if(t==='matrix3d'){// @ts-ignore
|
|
@@ -7739,7 +7739,7 @@
|
|
|
7739
7739
|
// @ts-nocheck
|
|
7740
7740
|
var HookCodeFactory=/*#__PURE__*/function(){function HookCodeFactory(config){this.config=config;this.options=undefined;this._args=undefined;}var _proto=HookCodeFactory.prototype;_proto.create=function create(options){this.init(options);var fn;switch(this.options.type){case'sync':fn=new Function(this.args(),'"use strict";\n'+this.header()+this.contentWithInterceptors({onError:function onError(err){return "throw "+err+";\n";},onResult:function onResult(result){return "return "+result+";\n";},resultReturns:true,onDone:function onDone(){return '';},rethrowIfPossible:true}));break;case'async':fn=new Function(this.args({after:'_callback'}),'"use strict";\n'+this.header()+this.contentWithInterceptors({onError:function onError(err){return "_callback("+err+");\n";},onResult:function onResult(result){return "_callback(null, "+result+");\n";},onDone:function onDone(){return '_callback();\n';}}));break;case'promise':var errorHelperUsed=false;var content=this.contentWithInterceptors({onError:function onError(err){errorHelperUsed=true;return "_error("+err+");\n";},onResult:function onResult(result){return "_resolve("+result+");\n";},onDone:function onDone(){return '_resolve();\n';}});var code='';code+='"use strict";\n';code+=this.header();code+='return new Promise((function(_resolve, _reject) {\n';if(errorHelperUsed){code+='var _sync = true;\n';code+='function _error(_err) {\n';code+='if(_sync)\n';code+='_resolve(Promise.resolve().then((function() { throw _err; })));\n';code+='else\n';code+='_reject(_err);\n';code+='};\n';}code+=content;if(errorHelperUsed){code+='_sync = false;\n';}code+='}));\n';fn=new Function(this.args(),code);break;}this.deinit();return fn;};_proto.setup=function setup(instance,options){instance._x=options.taps.map(function(t){return t.fn;});}/**
|
|
7741
7741
|
* @param {{ type: "sync" | "promise" | "async", taps: Array<Tap>, interceptors: Array<Interceptor> }} options
|
|
7742
|
-
*/;_proto.init=function init(options){this.options=options;this._args=options.args.slice();};_proto.deinit=function deinit(){this.options=undefined;this._args=undefined;};_proto.contentWithInterceptors=function contentWithInterceptors(options){var _this=this;if(this.options.interceptors.length>0){var onError=options.onError;var onResult=options.onResult;var onDone=options.onDone;var code='';for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.call){code+=this.getInterceptor(i)+".call("+this.args({before:interceptor.context?'_context':undefined})+");\n";}}code+=this.content(Object.assign(options,{onError:onError&&function(err){var code='';for(var _i=0;_i<_this.options.interceptors.length;_i++){var _interceptor=_this.options.interceptors[_i];if(_interceptor.error){code+=_this.getInterceptor(_i)+".error("+err+");\n";}}code+=onError(err);return code;},onResult:onResult&&function(result){var code='';for(var _i2=0;_i2<_this.options.interceptors.length;_i2++){var _interceptor2=_this.options.interceptors[_i2];if(_interceptor2.result){code+=_this.getInterceptor(_i2)+".result("+result+");\n";}}code+=onResult(result);return code;},onDone:onDone&&function(){var code='';for(var _i3=0;_i3<_this.options.interceptors.length;_i3++){var _interceptor3=_this.options.interceptors[_i3];if(_interceptor3.done){code+=_this.getInterceptor(_i3)+".done();\n";}}code+=onDone();return code;}}));return code;}else {return this.content(options);}};_proto.header=function header(){var code='';if(this.needContext()){code+='var _context = {};\n';}else {code+='var _context;\n';}code+='var _x = this._x;\n';if(this.options.interceptors.length>0){code+='var _taps = this.taps;\n';code+='var _interceptors = this.interceptors;\n';}return code;};_proto.needContext=function needContext(){for(var _iterator=_createForOfIteratorHelperLoose(this.options.taps),_step;!(_step=_iterator()).done;){var tap=_step.value;if(tap.context)return true;}return false;};_proto.callTap=function callTap(tapIndex,_ref){var onError=_ref.onError,onResult=_ref.onResult,onDone=_ref.onDone,rethrowIfPossible=_ref.rethrowIfPossible;var code='';var hasTapCached=false;for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.tap){if(!hasTapCached){code+="var _tap"+tapIndex+" = "+this.getTap(tapIndex)+";\n";hasTapCached=true;}code+=this.getInterceptor(i)+".tap("+(interceptor.context?'_context, ':'')+"_tap"+tapIndex+");\n";}}code+="var _fn"+tapIndex+" = "+this.getTapFn(tapIndex)+";\n";var tap=this.options.taps[tapIndex];switch(tap.type){case'sync':if(!rethrowIfPossible){code+="var _hasError"+tapIndex+" = false;\n";code+='try {\n';}if(onResult){code+="var _result"+tapIndex+" = _fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";}else {code+="_fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";}if(!rethrowIfPossible){code+='} catch(_err) {\n';code+="_hasError"+tapIndex+" = true;\n";code+=onError('_err');code+='}\n';code+="if(!_hasError"+tapIndex+") {\n";}if(onResult){code+=onResult("_result"+tapIndex);}if(onDone){code+=onDone();}if(!rethrowIfPossible){code+='}\n';}break;case'async':var cbCode='';if(onResult)cbCode+="(function(_err"+tapIndex+", _result"+tapIndex+") {\n";else cbCode+="(function(_err"+tapIndex+") {\n";cbCode+="if(_err"+tapIndex+") {\n";cbCode+=onError("_err"+tapIndex);cbCode+='} else {\n';if(onResult){cbCode+=onResult("_result"+tapIndex);}if(onDone){cbCode+=onDone();}cbCode+='}\n';cbCode+='})';code+="_fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined,after:cbCode})+");\n";break;case'promise':code+="var _hasResult"+tapIndex+" = false;\n";code+="var _promise"+tapIndex+" = _fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";code+="if (!_promise"+tapIndex+" || !_promise"+tapIndex+".then)\n";code+=" throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise"+tapIndex+" + ')');\n";code+="_promise"+tapIndex+".then((function(_result"+tapIndex+") {\n";code+="_hasResult"+tapIndex+" = true;\n";if(onResult){code+=onResult("_result"+tapIndex);}if(onDone){code+=onDone();}code+="}), function(_err"+tapIndex+") {\n";code+="if(_hasResult"+tapIndex+") throw _err"+tapIndex+";\n";code+=onError("_err"+tapIndex);code+='});\n';break;}return code;};_proto.callTapsSeries=function callTapsSeries(_ref2){var _this2=this;var _onError=_ref2.onError,onResult=_ref2.onResult,resultReturns=_ref2.resultReturns,onDone=_ref2.onDone,doneReturns=_ref2.doneReturns,rethrowIfPossible=_ref2.rethrowIfPossible;if(this.options.taps.length===0)return onDone();var firstAsync=this.options.taps.findIndex(function(t){return t.type!=='sync';});var somethingReturns=resultReturns||doneReturns;var code='';var current=onDone;var unrollCounter=0;var _loop=function _loop(
|
|
7742
|
+
*/;_proto.init=function init(options){this.options=options;this._args=options.args.slice();};_proto.deinit=function deinit(){this.options=undefined;this._args=undefined;};_proto.contentWithInterceptors=function contentWithInterceptors(options){var _this=this;if(this.options.interceptors.length>0){var onError=options.onError;var onResult=options.onResult;var onDone=options.onDone;var code='';for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.call){code+=this.getInterceptor(i)+".call("+this.args({before:interceptor.context?'_context':undefined})+");\n";}}code+=this.content(Object.assign(options,{onError:onError&&function(err){var code='';for(var _i=0;_i<_this.options.interceptors.length;_i++){var _interceptor=_this.options.interceptors[_i];if(_interceptor.error){code+=_this.getInterceptor(_i)+".error("+err+");\n";}}code+=onError(err);return code;},onResult:onResult&&function(result){var code='';for(var _i2=0;_i2<_this.options.interceptors.length;_i2++){var _interceptor2=_this.options.interceptors[_i2];if(_interceptor2.result){code+=_this.getInterceptor(_i2)+".result("+result+");\n";}}code+=onResult(result);return code;},onDone:onDone&&function(){var code='';for(var _i3=0;_i3<_this.options.interceptors.length;_i3++){var _interceptor3=_this.options.interceptors[_i3];if(_interceptor3.done){code+=_this.getInterceptor(_i3)+".done();\n";}}code+=onDone();return code;}}));return code;}else {return this.content(options);}};_proto.header=function header(){var code='';if(this.needContext()){code+='var _context = {};\n';}else {code+='var _context;\n';}code+='var _x = this._x;\n';if(this.options.interceptors.length>0){code+='var _taps = this.taps;\n';code+='var _interceptors = this.interceptors;\n';}return code;};_proto.needContext=function needContext(){for(var _iterator=_createForOfIteratorHelperLoose(this.options.taps),_step;!(_step=_iterator()).done;){var tap=_step.value;if(tap.context)return true;}return false;};_proto.callTap=function callTap(tapIndex,_ref){var onError=_ref.onError,onResult=_ref.onResult,onDone=_ref.onDone,rethrowIfPossible=_ref.rethrowIfPossible;var code='';var hasTapCached=false;for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.tap){if(!hasTapCached){code+="var _tap"+tapIndex+" = "+this.getTap(tapIndex)+";\n";hasTapCached=true;}code+=this.getInterceptor(i)+".tap("+(interceptor.context?'_context, ':'')+"_tap"+tapIndex+");\n";}}code+="var _fn"+tapIndex+" = "+this.getTapFn(tapIndex)+";\n";var tap=this.options.taps[tapIndex];switch(tap.type){case'sync':if(!rethrowIfPossible){code+="var _hasError"+tapIndex+" = false;\n";code+='try {\n';}if(onResult){code+="var _result"+tapIndex+" = _fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";}else {code+="_fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";}if(!rethrowIfPossible){code+='} catch(_err) {\n';code+="_hasError"+tapIndex+" = true;\n";code+=onError('_err');code+='}\n';code+="if(!_hasError"+tapIndex+") {\n";}if(onResult){code+=onResult("_result"+tapIndex);}if(onDone){code+=onDone();}if(!rethrowIfPossible){code+='}\n';}break;case'async':var cbCode='';if(onResult)cbCode+="(function(_err"+tapIndex+", _result"+tapIndex+") {\n";else cbCode+="(function(_err"+tapIndex+") {\n";cbCode+="if(_err"+tapIndex+") {\n";cbCode+=onError("_err"+tapIndex);cbCode+='} else {\n';if(onResult){cbCode+=onResult("_result"+tapIndex);}if(onDone){cbCode+=onDone();}cbCode+='}\n';cbCode+='})';code+="_fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined,after:cbCode})+");\n";break;case'promise':code+="var _hasResult"+tapIndex+" = false;\n";code+="var _promise"+tapIndex+" = _fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";code+="if (!_promise"+tapIndex+" || !_promise"+tapIndex+".then)\n";code+=" throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise"+tapIndex+" + ')');\n";code+="_promise"+tapIndex+".then((function(_result"+tapIndex+") {\n";code+="_hasResult"+tapIndex+" = true;\n";if(onResult){code+=onResult("_result"+tapIndex);}if(onDone){code+=onDone();}code+="}), function(_err"+tapIndex+") {\n";code+="if(_hasResult"+tapIndex+") throw _err"+tapIndex+";\n";code+=onError("_err"+tapIndex);code+='});\n';break;}return code;};_proto.callTapsSeries=function callTapsSeries(_ref2){var _this2=this;var _onError=_ref2.onError,onResult=_ref2.onResult,resultReturns=_ref2.resultReturns,onDone=_ref2.onDone,doneReturns=_ref2.doneReturns,rethrowIfPossible=_ref2.rethrowIfPossible;if(this.options.taps.length===0)return onDone();var firstAsync=this.options.taps.findIndex(function(t){return t.type!=='sync';});var somethingReturns=resultReturns||doneReturns;var code='';var current=onDone;var unrollCounter=0;var _loop=function _loop(){var i=j;var unroll=current!==onDone&&(_this2.options.taps[i].type!=='sync'||unrollCounter++>20);if(unroll){unrollCounter=0;code+="function _next"+i+"() {\n";code+=current();code+="}\n";current=function current(){return (somethingReturns?'return ':'')+"_next"+i+"();\n";};}var done=current;var doneBreak=function doneBreak(skipDone){if(skipDone)return '';return onDone();};var content=_this2.callTap(i,{onError:function onError(error){return _onError(i,error,done,doneBreak);},onResult:onResult&&function(result){return onResult(i,result,done,doneBreak);},onDone:!onResult&&done,rethrowIfPossible:rethrowIfPossible&&(firstAsync<0||i<firstAsync)});current=function current(){return content;};};for(var j=this.options.taps.length-1;j>=0;j--){_loop();}code+=current();return code;};_proto.callTapsLooping=function callTapsLooping(_ref3){var onError=_ref3.onError,onDone=_ref3.onDone,rethrowIfPossible=_ref3.rethrowIfPossible;if(this.options.taps.length===0)return onDone();var syncOnly=this.options.taps.every(function(t){return t.type==='sync';});var code='';if(!syncOnly){code+='var _looper = (function() {\n';code+='var _loopAsync = false;\n';}code+='var _loop;\n';code+='do {\n';code+='_loop = false;\n';for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.loop){code+=this.getInterceptor(i)+".loop("+this.args({before:interceptor.context?'_context':undefined})+");\n";}}code+=this.callTapsSeries({onError:onError,onResult:function onResult(i,result,next,doneBreak){var code='';code+="if("+result+" !== undefined) {\n";code+='_loop = true;\n';if(!syncOnly)code+='if(_loopAsync) _looper();\n';code+=doneBreak(true);code+="} else {\n";code+=next();code+="}\n";return code;},onDone:onDone&&function(){var code='';code+='if(!_loop) {\n';code+=onDone();code+='}\n';return code;},rethrowIfPossible:rethrowIfPossible&&syncOnly});code+='} while(_loop);\n';if(!syncOnly){code+='_loopAsync = true;\n';code+='});\n';code+='_looper();\n';}return code;};_proto.callTapsParallel=function callTapsParallel(_ref4){var _this3=this;var _onError2=_ref4.onError,onResult=_ref4.onResult,onDone=_ref4.onDone,rethrowIfPossible=_ref4.rethrowIfPossible,_ref4$onTap=_ref4.onTap,onTap=_ref4$onTap===void 0?function(i,run){return run();}:_ref4$onTap;if(this.options.taps.length<=1){return this.callTapsSeries({onError:_onError2,onResult:onResult,onDone:onDone,rethrowIfPossible:rethrowIfPossible});}var code='';code+='do {\n';code+="var _counter = "+this.options.taps.length+";\n";if(onDone){code+='var _done = (function() {\n';code+=onDone();code+='});\n';}var _loop2=function _loop2(i){var done=function done(){if(onDone)return 'if(--_counter === 0) _done();\n';else return '--_counter;';};var doneBreak=function doneBreak(skipDone){if(skipDone||!onDone)return '_counter = 0;\n';else return '_counter = 0;\n_done();\n';};code+='if(_counter <= 0) break;\n';code+=onTap(i,function(){return _this3.callTap(i,{onError:function onError(error){var code='';code+='if(_counter > 0) {\n';code+=_onError2(i,error,done,doneBreak);code+='}\n';return code;},onResult:onResult&&function(result){var code='';code+='if(_counter > 0) {\n';code+=onResult(i,result,done,doneBreak);code+='}\n';return code;},onDone:!onResult&&function(){return done();},rethrowIfPossible:rethrowIfPossible});},done,doneBreak);};for(var i=0;i<this.options.taps.length;i++){_loop2(i);}code+='} while(false);\n';return code;};_proto.args=function args(_temp){var _ref5=_temp===void 0?{}:_temp,before=_ref5.before,after=_ref5.after;var allArgs=this._args;if(before)allArgs=[before].concat(allArgs);if(after)allArgs=allArgs.concat(after);if(allArgs.length===0){return '';}else {return allArgs.join(', ');}};_proto.getTapFn=function getTapFn(idx){return "_x["+idx+"]";};_proto.getTap=function getTap(idx){return "_taps["+idx+"]";};_proto.getInterceptor=function getInterceptor(idx){return "_interceptors["+idx+"]";};return HookCodeFactory;}();var AsyncParallelHookCodeFactory=/*#__PURE__*/function(_HookCodeFactory){_inheritsLoose(AsyncParallelHookCodeFactory,_HookCodeFactory);function AsyncParallelHookCodeFactory(){return _HookCodeFactory.apply(this,arguments)||this;}var _proto=AsyncParallelHookCodeFactory.prototype;_proto.content=function content(_ref){var _onError=_ref.onError,onDone=_ref.onDone;return this.callTapsParallel({onError:function onError(i,err,done,doneBreak){return _onError(err)+doneBreak(true);},onDone:onDone});};return AsyncParallelHookCodeFactory;}(HookCodeFactory);var factory=new AsyncParallelHookCodeFactory();var COMPILE=function COMPILE(options){factory.setup(this,options);return factory.create(options);};var AsyncParallelHook=/*#__PURE__*/function(_Hook){_inheritsLoose(AsyncParallelHook,_Hook);function AsyncParallelHook(args,name){var _this;if(args===void 0){args=[];}if(name===void 0){name=undefined;}_this=_Hook.call(this,args,name)||this;_this.compile=COMPILE;_this._call=undefined;_this.call=undefined;return _this;}return AsyncParallelHook;}(Hook);// export function AsyncParallelHook(args = [], name = undefined) {
|
|
7743
7743
|
// const hook = new Hook(args, name);
|
|
7744
7744
|
// hook.constructor = AsyncParallelHook;
|
|
7745
7745
|
// hook.compile = COMPILE;
|
|
@@ -7798,7 +7798,7 @@
|
|
|
7798
7798
|
return Date.now()-nowOffset;};var reservedCBs={};var lastTime=Date.now();var polyfillRaf=function polyfillRaf(callback){if(typeof callback!=='function'){throw new TypeError(callback+' is not a function');}var currentTime=Date.now();var gap=currentTime-lastTime;var delay=gap>16?0:16-gap;var id=uniqueId();reservedCBs[id]=callback;// keys(reservedCBs).length > 1 의미는 이미 setTimeout 이 걸려있는 경우.
|
|
7799
7799
|
// 함께 callback 이 실행될 수 있게 reservedCBs 에만 추가해주고 return
|
|
7800
7800
|
if(Object.keys(reservedCBs).length>1)return id;setTimeout(function(){lastTime=currentTime;var copied=reservedCBs;reservedCBs={};Object.keys(copied).forEach(function(key){return copied[key](pnow());});},delay);return id;};var polyfillCaf=function polyfillCaf(id){delete reservedCBs[id];};var vendorPrefixes=['','webkit','moz','ms','o'];var getRequestAnimationFrame=function getRequestAnimationFrame(vp){if(typeof vp!=='string')return polyfillRaf;if(vp==='')return root['requestAnimationFrame'];return root[vp+'RequestAnimationFrame'];};var getCancelAnimationFrame=function getCancelAnimationFrame(vp){if(typeof vp!=='string')return polyfillCaf;if(vp==='')return root['cancelAnimationFrame'];return root[vp+'CancelAnimationFrame']||root[vp+'CancelRequestAnimationFrame'];};var find=function find(arr,predicate){var i=0;while(arr[i]!==void 0){if(predicate(arr[i]))return arr[i];i=i+1;}};var vp=find(vendorPrefixes,function(vp){return !!getRequestAnimationFrame(vp);});var raf=getRequestAnimationFrame(vp);var caf=getCancelAnimationFrame(vp);root.requestAnimationFrame=raf;root.cancelAnimationFrame=caf;var regexLG=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;var regexRG=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;var regexPR=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;var regexColorStop=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function spaceColorStops(colorStops){var _colorStops$length;var length=colorStops.length;colorStops[length-1].length=(_colorStops$length=colorStops[length-1].length)!==null&&_colorStops$length!==void 0?_colorStops$length:{type:'%',value:'100'};if(length>1){var _colorStops$0$length;colorStops[0].length=(_colorStops$0$length=colorStops[0].length)!==null&&_colorStops$0$length!==void 0?_colorStops$0$length:{type:'%',value:'0'};}var previousIndex=0;var previousOffset=Number(colorStops[0].length.value);for(var i=1;i<length;i++){var _colorStops$i$length;// support '%' & 'px'
|
|
7801
|
-
var offset=(_colorStops$i$length=colorStops[i].length)===null||_colorStops$i$length===void 0?void 0:_colorStops$i$length.value;if(!isNil(offset)&&!isNil(previousOffset)){for(var j=1;j<i-previousIndex;j++)
|
|
7801
|
+
var offset=(_colorStops$i$length=colorStops[i].length)===null||_colorStops$i$length===void 0?void 0:_colorStops$i$length.value;if(!isNil(offset)&&!isNil(previousOffset)){for(var j=1;j<i-previousIndex;j++)colorStops[previousIndex+j].length={type:'%',value:""+(previousOffset+(Number(offset)-previousOffset)*j/(i-previousIndex))};previousIndex=i;previousOffset=Number(offset);}}}// The position of the gradient line's starting point.
|
|
7802
7802
|
// different from CSS side(to top) @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#values
|
|
7803
7803
|
var SideOrCornerToDegMap={left:270-90,top:0-90,bottom:180-90,right:90-90,'left top':315-90,'top left':315-90,'left bottom':225-90,'bottom left':225-90,'right top':45-90,'top right':45-90,'right bottom':135-90,'bottom right':135-90};var angleToDeg=memoize(function(orientation){var angle;if(orientation.type==='angular'){angle=Number(orientation.value);}else {angle=SideOrCornerToDegMap[orientation.value]||0;}return getOrCreateUnitValue(angle,'deg');});var positonToCSSUnitValue=memoize(function(position){var cx=50;var cy=50;var unitX='%';var unitY='%';if((position===null||position===void 0?void 0:position.type)==='position'){var _position$value=position.value,x=_position$value.x,y=_position$value.y;if((x===null||x===void 0?void 0:x.type)==='position-keyword'){if(x.value==='left'){cx=0;}else if(x.value==='center'){cx=50;}else if(x.value==='right'){cx=100;}else if(x.value==='top'){cy=0;}else if(x.value==='bottom'){cy=100;}}if((y===null||y===void 0?void 0:y.type)==='position-keyword'){if(y.value==='left'){cx=0;}else if(y.value==='center'){cy=50;}else if(y.value==='right'){cx=100;}else if(y.value==='top'){cy=0;}else if(y.value==='bottom'){cy=100;}}if((x===null||x===void 0?void 0:x.type)==='px'||(x===null||x===void 0?void 0:x.type)==='%'||(x===null||x===void 0?void 0:x.type)==='em'){unitX=x===null||x===void 0?void 0:x.type;cx=Number(x.value);}if((y===null||y===void 0?void 0:y.type)==='px'||(y===null||y===void 0?void 0:y.type)==='%'||(y===null||y===void 0?void 0:y.type)==='em'){unitY=y===null||y===void 0?void 0:y.type;cy=Number(y.value);}}return {cx:getOrCreateUnitValue(cx,unitX),cy:getOrCreateUnitValue(cy,unitY)};});var parseGradient$1=memoize(function(colorStr){if(colorStr.indexOf('linear')>-1||colorStr.indexOf('radial')>-1){var ast=parseGradient(colorStr);return ast.map(function(_ref){var type=_ref.type,orientation=_ref.orientation,colorStops=_ref.colorStops;spaceColorStops(colorStops);var steps=colorStops.map(function(colorStop){// TODO: only support % for now, should calc percentage of axis length when using px/em
|
|
7804
7804
|
return {offset:getOrCreateUnitValue(Number(colorStop.length.value),'%'),color:colorStopToString(colorStop)};});if(type==='linear-gradient'){return new CSSGradientValue(exports.GradientType.LinearGradient,{angle:orientation?angleToDeg(orientation):Odeg,steps:steps});}else if(type==='radial-gradient'){if(!orientation){orientation=[{type:'shape',value:'circle'}];}if(orientation[0].type==='shape'&&orientation[0].value==='circle'){var _positonToCSSUnitValu=positonToCSSUnitValue(orientation[0].at),cx=_positonToCSSUnitValu.cx,cy=_positonToCSSUnitValu.cy;var size;if(orientation[0].style){var _orientation$0$style=orientation[0].style,_type=_orientation$0$style.type,value=_orientation$0$style.value;if(_type==='extent-keyword'){size=getOrCreateKeyword(value);}else {size=getOrCreateUnitValue(value,_type);}}return new CSSGradientValue(exports.GradientType.RadialGradient,{cx:cx,cy:cy,size:size,steps:steps});}// TODO: support ellipse shape
|
|
@@ -7815,7 +7815,7 @@
|
|
|
7815
7815
|
var g=parseGradient$1(colorStr);if(g){return g;}// constants
|
|
7816
7816
|
var color$1=color(colorStr);var rgba=[0,0,0,0];if(color$1!==null){rgba[0]=color$1.r||0;rgba[1]=color$1.g||0;rgba[2]=color$1.b||0;rgba[3]=color$1.opacity;}// return new CSSRGB(...rgba);
|
|
7817
7817
|
return getOrCreateRGBA.apply(void 0,rgba);});function mergeColors(left,right){// only support constant value, exclude gradient & pattern
|
|
7818
|
-
if(!isCSSRGB(left)||!isCSSRGB(right)){return;}return [[Number(left.r),Number(left.g),Number(left.b),Number(left.alpha)],[Number(right.r),Number(right.g),Number(right.b),Number(right.alpha)],function(color){var rgba=color.slice();if(rgba[3]){for(var i=0;i<3;i++)
|
|
7818
|
+
if(!isCSSRGB(left)||!isCSSRGB(right)){return;}return [[Number(left.r),Number(left.g),Number(left.b),Number(left.alpha)],[Number(right.r),Number(right.g),Number(right.b),Number(right.alpha)],function(color){var rgba=color.slice();if(rgba[3]){for(var i=0;i<3;i++)rgba[i]=Math.round(clamp(rgba[i],0,255));}rgba[3]=clamp(rgba[3],0,1);return "rgba("+rgba.join(',')+")";}];}function parseDimension(unitRegExp,string){if(isNil(string)){return getOrCreateUnitValue(0,'px');}string=(""+string).trim().toLowerCase();if(isFinite(Number(string))){if('px'.search(unitRegExp)>=0){return getOrCreateUnitValue(Number(string),'px');}else if('deg'.search(unitRegExp)>=0){return getOrCreateUnitValue(Number(string),'deg');}}var matchedUnits=[];string=string.replace(unitRegExp,function(match){matchedUnits.push(match);return 'U'+match;});var taggedUnitRegExp='U('+unitRegExp.source+')';return matchedUnits.map(function(unit){return getOrCreateUnitValue(Number(string.replace(new RegExp('U'+unit,'g'),'').replace(new RegExp(taggedUnitRegExp,'g'),'*0')),unit);})[0];}/**
|
|
7819
7819
|
* <length>
|
|
7820
7820
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
7821
7821
|
* length with only absolute unit, eg. 1px
|
|
@@ -7927,12 +7927,12 @@
|
|
|
7927
7927
|
var q=quat(leftArgs[0][3],rightArgs[0][3],list[5]);var mat=composeMatrix(list[0],list[1],list[2],q,list[4]);var stringifiedArgs=mat.map(numberToLongString).join(',');return stringifiedArgs;}];}function dot$2(v1,v2){var result=0;for(var i=0;i<v1.length;i++){result+=v1[i]*v2[i];}return result;}function quat(fromQ,toQ,f){var product=dot$2(fromQ,toQ);product=clamp(product,-1.0,1.0);var quat=[];if(product===1.0){quat=fromQ;}else {var theta=Math.acos(product);var w=Math.sin(f*theta)*1/Math.sqrt(1-product*product);for(var i=0;i<4;i++){quat.push(fromQ[i]*(Math.cos(f*theta)-product*w)+toQ[i]*w);}}return quat;}// scalex/y/z -> scale
|
|
7928
7928
|
function typeTo2D(type){return type.replace(/[xy]/,'');}// scalex/y/z -> scale3d
|
|
7929
7929
|
function typeTo3D(type){return type.replace(/(x|y|z|3d)?$/,'3d');}var isMatrixOrPerspective=function isMatrixOrPerspective(lt,rt){return lt==='perspective'&&rt==='perspective'||(lt==='matrix'||lt==='matrix3d')&&(rt==='matrix'||rt==='matrix3d');};function mergeTransforms(left,right,target){var flipResults=false;// padding empty transform, eg. merge 'scale(10)' with 'none' -> scale(1)
|
|
7930
|
-
if(!left.length||!right.length){if(!left.length){flipResults=true;left=right;right=[];}var _loop=function _loop(
|
|
7930
|
+
if(!left.length||!right.length){if(!left.length){flipResults=true;left=right;right=[];}var _loop=function _loop(){var _left$i=left[i],type=_left$i.t,args=_left$i.d;// none -> scale(1)/translateX(0)
|
|
7931
7931
|
var defaultValue=type.substring(0,5)==='scale'?1:0;right.push({t:type,d:args.map(function(arg){if(typeof arg==='number'){return getOrCreateUnitValue(defaultValue);}return getOrCreateUnitValue(defaultValue,arg.unit);// {
|
|
7932
7932
|
// unit: arg.unit,
|
|
7933
7933
|
// value: defaultValue,
|
|
7934
7934
|
// };
|
|
7935
|
-
})});};for(var i=0;i<left.length;i++){_loop(
|
|
7935
|
+
})});};for(var i=0;i<left.length;i++){_loop();}}var leftResult=[];var rightResult=[];var types=[];// merge matrix() with matrix3d()
|
|
7936
7936
|
if(left.length!==right.length){var merged=mergeMatrices(left,right);// @ts-ignore
|
|
7937
7937
|
leftResult=[merged[0]];// @ts-ignore
|
|
7938
7938
|
rightResult=[merged[1]];types=[['matrix',[merged[2]]]];}else {for(var _i3=0;_i3<left.length;_i3++){var leftType=left[_i3].t;var rightType=right[_i3].t;var leftArgs=left[_i3].d;var rightArgs=right[_i3].d;var leftFunctionData=transformFunctions[leftType];var rightFunctionData=transformFunctions[rightType];var type=void 0;if(isMatrixOrPerspective(leftType,rightType)){var _merged=mergeMatrices([left[_i3]],[right[_i3]]);// @ts-ignore
|
|
@@ -8073,7 +8073,9 @@
|
|
|
8073
8073
|
set$1(this.planes[2].normal,m3+m1,m7+m5,m11+m9);this.planes[2].distance=m15+m13;// top
|
|
8074
8074
|
set$1(this.planes[3].normal,m3-m1,m7-m5,m11-m9);this.planes[3].distance=m15-m13;// far
|
|
8075
8075
|
set$1(this.planes[4].normal,m3-m2,m7-m6,m11-m10);this.planes[4].distance=m15-m14;// near
|
|
8076
|
-
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;}();var CSSPropertyPath=/*#__PURE__*/function(){function CSSPropertyPath(){
|
|
8076
|
+
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;}();var CSSPropertyPath=/*#__PURE__*/function(){function CSSPropertyPath(){/**
|
|
8077
|
+
* path2Curve
|
|
8078
|
+
*/this.parser=parsePath;this.parserWithCSSDisabled=parsePath;this.mixer=mergePaths;}var _proto=CSSPropertyPath.prototype;_proto.calculator=function calculator(name,oldParsed,parsed){// unset
|
|
8077
8079
|
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;};/**
|
|
8078
8080
|
* update local position
|
|
8079
8081
|
*/_proto.postProcessor=function postProcessor(object,attributes){if(object.nodeName===exports.Shape.PATH&&attributes.indexOf('transform')===-1){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;this.mixer=mergePoints;}var _proto=CSSPropertyPoints.prototype;/**
|
|
@@ -8129,7 +8131,45 @@
|
|
|
8129
8131
|
*/var FederatedEvent=/*#__PURE__*/function(){/**
|
|
8130
8132
|
* The event boundary which manages this event. Propagation can only occur
|
|
8131
8133
|
* within the boundary's jurisdiction.
|
|
8132
|
-
*/function FederatedEvent(manager){
|
|
8134
|
+
*/function FederatedEvent(manager){/**
|
|
8135
|
+
* The type of event, supports the following:
|
|
8136
|
+
* * pointerdown
|
|
8137
|
+
* * touchstart
|
|
8138
|
+
* * mousedown
|
|
8139
|
+
* * rightdown
|
|
8140
|
+
* * ...
|
|
8141
|
+
*/this.type=void 0;/**
|
|
8142
|
+
* The propagation phase.
|
|
8143
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
|
|
8144
|
+
*/this.eventPhase=FederatedEvent.prototype.NONE;/**
|
|
8145
|
+
* can be used to implement event delegation
|
|
8146
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/target
|
|
8147
|
+
*/this.target=void 0;/**
|
|
8148
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/bubbles
|
|
8149
|
+
*/this.bubbles=true;/**
|
|
8150
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/cancelBubble
|
|
8151
|
+
*/this.cancelBubble=true;/**
|
|
8152
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable
|
|
8153
|
+
*/this.cancelable=false;/** the event target when listeners binded */this.currentTarget=void 0;/** Flags whether the default response of the user agent was prevent through this event. */this.defaultPrevented=false;/**
|
|
8154
|
+
* timestamp when the event created
|
|
8155
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/timeStamp
|
|
8156
|
+
*/this.timeStamp=void 0;/**
|
|
8157
|
+
* the original event.
|
|
8158
|
+
*/this.nativeEvent=void 0;/** The original event that caused this event, if any. */this.originalEvent=void 0;/** Flags whether propagation was stopped. */this.propagationStopped=false;/** Flags whether propagation was immediately stopped. */this.propagationImmediatelyStopped=false;this.manager=void 0;/** Event-specific detail */this.detail=void 0;/**
|
|
8159
|
+
* The coordinates of the evnet relative to the nearest DOM layer.
|
|
8160
|
+
* This is a non-standard property.
|
|
8161
|
+
*/this.layer=new Point();/**
|
|
8162
|
+
* The coordinates of the event relative to the DOM document.
|
|
8163
|
+
* This is a non-standard property.
|
|
8164
|
+
* relative to the DOM document.
|
|
8165
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
|
|
8166
|
+
*/this.page=new Point();/**
|
|
8167
|
+
* relative to Canvas, origin is left-top
|
|
8168
|
+
*/this.canvas=new Point();/**
|
|
8169
|
+
* relative to Viewport, account for Camera
|
|
8170
|
+
*/this.viewport=new Point();this.path=void 0;/**
|
|
8171
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
8172
|
+
*/this.view=void 0;this.which=void 0;this.returnValue=void 0;this.srcElement=void 0;this.composed=false;this.isTrusted=void 0;this.NONE=0;this.CAPTURING_PHASE=1;this.AT_TARGET=2;this.BUBBLING_PHASE=3;this.manager=manager;}var _proto=FederatedEvent.prototype;/**
|
|
8133
8173
|
* The propagation path for this event
|
|
8134
8174
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/composedPath
|
|
8135
8175
|
*
|
|
@@ -8143,33 +8183,12 @@
|
|
|
8143
8183
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopImmediatePropagation
|
|
8144
8184
|
*/;_proto.stopImmediatePropagation=function stopImmediatePropagation(){this.propagationImmediatelyStopped=true;}/**
|
|
8145
8185
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopPropagation
|
|
8146
|
-
*/;_proto.stopPropagation=function stopPropagation(){this.propagationStopped=true;}
|
|
8147
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
8148
|
-
*/;/**
|
|
8186
|
+
*/;_proto.stopPropagation=function stopPropagation(){this.propagationStopped=true;};/**
|
|
8149
8187
|
* added for compatibility with DOM Event,
|
|
8150
8188
|
* deprecated props and methods
|
|
8151
8189
|
*/_proto.initEvent=function initEvent(){};_proto.initUIEvent=function initUIEvent(){};_proto.clone=function clone(){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_createClass(FederatedEvent,[{key:"name",get:/**
|
|
8152
|
-
* The type of event, supports the following:
|
|
8153
|
-
* * pointerdown
|
|
8154
|
-
* * touchstart
|
|
8155
|
-
* * mousedown
|
|
8156
|
-
* * rightdown
|
|
8157
|
-
* * ...
|
|
8158
|
-
*/ /**
|
|
8159
8190
|
* @deprecated
|
|
8160
|
-
*/function get(){return this.type;}
|
|
8161
|
-
* The propagation phase.
|
|
8162
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
|
|
8163
|
-
*/},{key:"layerX",get:function get(){return this.layer.x;}},{key:"layerY",get:function get(){return this.layer.y;}/**
|
|
8164
|
-
* The coordinates of the event relative to the DOM document.
|
|
8165
|
-
* This is a non-standard property.
|
|
8166
|
-
* relative to the DOM document.
|
|
8167
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
|
|
8168
|
-
*/},{key:"pageX",get:function get(){return this.page.x;}},{key:"pageY",get:function get(){return this.page.y;}/**
|
|
8169
|
-
* relative to Canvas, origin is left-top
|
|
8170
|
-
*/},{key:"x",get:function get(){return this.canvas.x;}},{key:"y",get:function get(){return this.canvas.y;}},{key:"canvasX",get:function get(){return this.canvas.x;}},{key:"canvasY",get:function get(){return this.canvas.y;}/**
|
|
8171
|
-
* relative to Viewport, account for Camera
|
|
8172
|
-
*/},{key:"viewportX",get:function get(){return this.viewport.x;}},{key:"viewportY",get:function get(){return this.viewport.y;}},{key:"propagationPath",get:function get(){return this.composedPath();}}]);return FederatedEvent;}();/**
|
|
8191
|
+
*/function get(){return this.type;}},{key:"layerX",get:function get(){return this.layer.x;}},{key:"layerY",get:function get(){return this.layer.y;}},{key:"pageX",get:function get(){return this.page.x;}},{key:"pageY",get:function get(){return this.page.y;}},{key:"x",get:function get(){return this.canvas.x;}},{key:"y",get:function get(){return this.canvas.y;}},{key:"canvasX",get:function get(){return this.canvas.x;}},{key:"canvasY",get:function get(){return this.canvas.y;}},{key:"viewportX",get:function get(){return this.viewport.x;}},{key:"viewportY",get:function get(){return this.viewport.y;}},{key:"propagationPath",get:function get(){return this.composedPath();}}]);return FederatedEvent;}();/**
|
|
8173
8192
|
* @see https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events
|
|
8174
8193
|
*
|
|
8175
8194
|
* @example
|
|
@@ -8186,7 +8205,9 @@
|
|
|
8186
8205
|
* Objects that can receive events and may have listeners for them.
|
|
8187
8206
|
* eg. Element, Canvas, DisplayObject
|
|
8188
8207
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
|
|
8189
|
-
*/var EventTarget=/*#__PURE__*/function(){function EventTarget(){
|
|
8208
|
+
*/var EventTarget=/*#__PURE__*/function(){function EventTarget(){/**
|
|
8209
|
+
* event emitter
|
|
8210
|
+
*/this.emitter=new eventemitter3();}var _proto=EventTarget.prototype;/**
|
|
8190
8211
|
* @deprecated
|
|
8191
8212
|
* @alias addEventListener
|
|
8192
8213
|
*/_proto.on=function on(type,listener,options){this.addEventListener(type,listener,options);return this;}/**
|
|
@@ -8212,14 +8233,35 @@
|
|
|
8212
8233
|
}else if(this.defaultView){canvas=this.defaultView;}else {var _this$ownerDocument;canvas=(_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView;}// assign event manager
|
|
8213
8234
|
if(canvas){var _e$manager;e.manager=canvas.getEventService()||null;if(!e.manager){return false;}e.defaultPrevented=false;e.path=[];if(!skipPropagate){e.target=this;}(_e$manager=e.manager)===null||_e$manager===void 0?void 0:_e$manager.dispatchEvent(e,e.type,skipPropagate);}return !e.defaultPrevented;};return EventTarget;}();/**
|
|
8214
8235
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node
|
|
8215
|
-
*/var Node=/*#__PURE__*/function(_EventTarget){_inheritsLoose(Node,_EventTarget);function Node(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_EventTarget.call.apply(_EventTarget,[this].concat(args))||this;_this.shadow=false
|
|
8236
|
+
*/var Node=/*#__PURE__*/function(_EventTarget){_inheritsLoose(Node,_EventTarget);function Node(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_EventTarget.call.apply(_EventTarget,[this].concat(args))||this;_this.shadow=false;/**
|
|
8237
|
+
* points to canvas.document
|
|
8238
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument
|
|
8239
|
+
*/_this.ownerDocument=null;/**
|
|
8240
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isConnected
|
|
8241
|
+
* @example
|
|
8242
|
+
circle.isConnected; // false
|
|
8243
|
+
canvas.appendChild(circle);
|
|
8244
|
+
circle.isConnected; // true
|
|
8245
|
+
*/_this.isConnected=false;/**
|
|
8246
|
+
* Returns node's node document's document base URL.
|
|
8247
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node
|
|
8248
|
+
*/_this.baseURI='';/**
|
|
8249
|
+
* Returns the children.
|
|
8250
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
8251
|
+
*/_this.childNodes=[];/**
|
|
8252
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
|
|
8253
|
+
*/_this.nodeType=0;/**
|
|
8254
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeName
|
|
8255
|
+
*/_this.nodeName='';/**
|
|
8256
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeValue
|
|
8257
|
+
*/_this.nodeValue=null;/**
|
|
8258
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
8259
|
+
*/_this.parentNode=null;return _this;}Node.isNode=function isNode(target){return !!target.childNodes;};var _proto=Node.prototype;/**
|
|
8216
8260
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
|
|
8217
8261
|
*/_proto.getRootNode=function getRootNode(opts){if(opts===void 0){opts={};}if(this.parentNode){return this.parentNode.getRootNode(opts);}if(opts.composed&&this.host){return this.host.getRootNode(opts);}return this;};_proto.hasChildNodes=function hasChildNodes(){return this.childNodes.length>0;};_proto.isDefaultNamespace=function isDefaultNamespace(namespace){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.lookupNamespaceURI=function lookupNamespaceURI(prefix){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.lookupPrefix=function lookupPrefix(namespace){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.normalize=function normalize(){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);}/**
|
|
8218
8262
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isEqualNode
|
|
8219
8263
|
*/;_proto.isEqualNode=function isEqualNode(otherNode){// TODO: compare 2 nodes, not sameness
|
|
8220
|
-
return this===otherNode;};_proto.isSameNode=function isSameNode(otherNode){return this.isEqualNode(otherNode);}
|
|
8221
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
8222
|
-
*/;/**
|
|
8264
|
+
return this===otherNode;};_proto.isSameNode=function isSameNode(otherNode){return this.isEqualNode(otherNode);};/**
|
|
8223
8265
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
8224
8266
|
* @see https://github.com/b-fuze/deno-dom/blob/master/src/dom/node.ts#L338
|
|
8225
8267
|
*/_proto.compareDocumentPosition=function compareDocumentPosition(other){if(other===this){// same node
|
|
@@ -8251,11 +8293,32 @@
|
|
|
8251
8293
|
this.style.text=""+content;}}},{key:"parent",get:/**
|
|
8252
8294
|
* @deprecated
|
|
8253
8295
|
* @alias parentNode
|
|
8254
|
-
*/function get(){return this.parentNode;}},{key:"parentElement",get:function get(){return null;}},{key:"nextSibling",get:function get(){return null;}},{key:"previousSibling",get:function get(){return null;}},{key:"firstChild",get:function get(){return this.childNodes.length>0?this.childNodes[0]:null;}},{key:"lastChild",get:function get(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null;}}]);return Node;}(EventTarget)
|
|
8296
|
+
*/function get(){return this.parentNode;}},{key:"parentElement",get:function get(){return null;}},{key:"nextSibling",get:function get(){return null;}},{key:"previousSibling",get:function get(){return null;}},{key:"firstChild",get:function get(){return this.childNodes.length>0?this.childNodes[0]:null;}},{key:"lastChild",get:function get(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null;}}]);return Node;}(EventTarget);/**
|
|
8297
|
+
* Both nodes are in different documents or different trees in the same document.
|
|
8298
|
+
*/Node.DOCUMENT_POSITION_DISCONNECTED=1;/**
|
|
8299
|
+
* otherNode precedes the node in either a pre-order depth-first traversal
|
|
8300
|
+
* of a tree containing both (e.g., as an ancestor or previous sibling or a descendant of a previous sibling or previous sibling of an ancestor) or (if they are disconnected) in an arbitrary but consistent ordering.
|
|
8301
|
+
*/Node.DOCUMENT_POSITION_PRECEDING=2;/**
|
|
8302
|
+
* otherNode follows the node in either a pre-order depth-first traversal of a tree containing both (e.g., as a descendant or following sibling or a descendant of a following sibling or following sibling of an ancestor) or (if they are disconnected) in an arbitrary but consistent ordering.
|
|
8303
|
+
*/Node.DOCUMENT_POSITION_FOLLOWING=4;/**
|
|
8304
|
+
* otherNode is an ancestor of the node.
|
|
8305
|
+
*/Node.DOCUMENT_POSITION_CONTAINS=8;/**
|
|
8306
|
+
* otherNode is a descendant of the node.
|
|
8307
|
+
*/Node.DOCUMENT_POSITION_CONTAINED_BY=16;/**
|
|
8308
|
+
* The result relies upon arbitrary and/or implementation-specific behavior and is not guaranteed to be portable.
|
|
8309
|
+
*/Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;/**
|
|
8255
8310
|
* the entry of DOM tree
|
|
8256
8311
|
* Document -> Node -> EventTarget
|
|
8257
8312
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document
|
|
8258
|
-
*/var Document=/*#__PURE__*/function(_Node){_inheritsLoose(Document,_Node);function Document(){var _this;_this=_Node.call(this)||this
|
|
8313
|
+
*/var Document=/*#__PURE__*/function(_Node){_inheritsLoose(Document,_Node);function Document(){var _this;_this=_Node.call(this)||this;/**
|
|
8314
|
+
* only document has defaultView, points to canvas,
|
|
8315
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
|
|
8316
|
+
*/_this.defaultView=null;/**
|
|
8317
|
+
* the root element of document, eg. <html>
|
|
8318
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement
|
|
8319
|
+
*/_this.documentElement=void 0;/**
|
|
8320
|
+
* document.timeline in WAAPI
|
|
8321
|
+
*/_this.timeline=void 0;_this.ownerDocument=null;_this.nodeName='document';// create timeline
|
|
8259
8322
|
try{_this.timeline=new runtime.AnimationTimeline(_assertThisInitialized(_this));}catch(e){}/**
|
|
8260
8323
|
* for inherited properties, the initial value is used on the root element only,
|
|
8261
8324
|
* as long as no specified value is supplied.
|
|
@@ -8275,21 +8338,18 @@
|
|
|
8275
8338
|
* Do picking with API instead of triggering interactive events.
|
|
8276
8339
|
*
|
|
8277
8340
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementFromPoint
|
|
8278
|
-
*/;_proto.elementFromPoint=/*#__PURE__*/function(){var _elementFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(x,y){var _this$defaultView$can2,viewportX,viewportY,_this$defaultView$get3,width,height,_this$defaultView$vie2,clientX,clientY,_yield$this$defaultVi,picked;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)
|
|
8279
|
-
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context.next=4;break;}return _context.abrupt("return",null);case 4:_this$defaultView$vie2=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie2.x,clientY=_this$defaultView$vie2.y;_context.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:true,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi=_context.sent;picked=_yield$this$defaultVi.picked;return _context.abrupt("return",picked&&picked[0]||this.documentElement);case 10:case"end":return _context.stop();}}
|
|
8341
|
+
*/;_proto.elementFromPoint=/*#__PURE__*/function(){var _elementFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(x,y){var _this$defaultView$can2,viewportX,viewportY,_this$defaultView$get3,width,height,_this$defaultView$vie2,clientX,clientY,_yield$this$defaultVi,picked;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_this$defaultView$can2=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can2.x,viewportY=_this$defaultView$can2.y;_this$defaultView$get3=this.defaultView.getConfig(),width=_this$defaultView$get3.width,height=_this$defaultView$get3.height;// outside canvas' viewport
|
|
8342
|
+
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context.next=4;break;}return _context.abrupt("return",null);case 4:_this$defaultView$vie2=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie2.x,clientY=_this$defaultView$vie2.y;_context.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:true,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi=_context.sent;picked=_yield$this$defaultVi.picked;return _context.abrupt("return",picked&&picked[0]||this.documentElement);case 10:case"end":return _context.stop();}},_callee,this);}));function elementFromPoint(_x,_x2){return _elementFromPoint.apply(this,arguments);}return elementFromPoint;}();_proto.elementsFromPointSync=function elementsFromPointSync(x,y){var _this$defaultView$can3=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can3.x,viewportY=_this$defaultView$can3.y;var _this$defaultView$get4=this.defaultView.getConfig(),width=_this$defaultView$get4.width,height=_this$defaultView$get4.height;// outside canvas' viewport
|
|
8280
8343
|
if(viewportX<0||viewportY<0||viewportX>width||viewportY>height){return [];}var _this$defaultView$vie3=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie3.x,clientY=_this$defaultView$vie3.y;var _this$defaultView$get5=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:false,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]}),picked=_this$defaultView$get5.picked;if(picked[picked.length-1]!==this.documentElement){picked.push(this.documentElement);}return picked;}/**
|
|
8281
8344
|
* Do picking with API instead of triggering interactive events.
|
|
8282
8345
|
*
|
|
8283
8346
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementsFromPoint
|
|
8284
|
-
*/;_proto.elementsFromPoint=/*#__PURE__*/function(){var _elementsFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x,y){var _this$defaultView$can4,viewportX,viewportY,_this$defaultView$get6,width,height,_this$defaultView$vie4,clientX,clientY,_yield$this$defaultVi2,picked;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)
|
|
8285
|
-
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context2.next=4;break;}return _context2.abrupt("return",[]);case 4:_this$defaultView$vie4=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie4.x,clientY=_this$defaultView$vie4.y;_context2.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:false,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi2=_context2.sent;picked=_yield$this$defaultVi2.picked;if(picked[picked.length-1]!==this.documentElement){picked.push(this.documentElement);}return _context2.abrupt("return",picked);case 11:case"end":return _context2.stop();}}
|
|
8347
|
+
*/;_proto.elementsFromPoint=/*#__PURE__*/function(){var _elementsFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x,y){var _this$defaultView$can4,viewportX,viewportY,_this$defaultView$get6,width,height,_this$defaultView$vie4,clientX,clientY,_yield$this$defaultVi2,picked;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_this$defaultView$can4=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can4.x,viewportY=_this$defaultView$can4.y;_this$defaultView$get6=this.defaultView.getConfig(),width=_this$defaultView$get6.width,height=_this$defaultView$get6.height;// outside canvas' viewport
|
|
8348
|
+
if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context2.next=4;break;}return _context2.abrupt("return",[]);case 4:_this$defaultView$vie4=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie4.x,clientY=_this$defaultView$vie4.y;_context2.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:false,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi2=_context2.sent;picked=_yield$this$defaultVi2.picked;if(picked[picked.length-1]!==this.documentElement){picked.push(this.documentElement);}return _context2.abrupt("return",picked);case 11:case"end":return _context2.stop();}},_callee2,this);}));function elementsFromPoint(_x3,_x4){return _elementsFromPoint.apply(this,arguments);}return elementsFromPoint;}()/**
|
|
8286
8349
|
* eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
|
|
8287
8350
|
*/;_proto.appendChild=function appendChild(newChild,index){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.insertBefore=function insertBefore(newChild,refChild){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.removeChild=function removeChild(oldChild,destroy){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.replaceChild=function replaceChild(newChild,oldChild,destroy){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.append=function append(){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.prepend=function prepend(){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}/**
|
|
8288
8351
|
* Execute query on documentElement.
|
|
8289
|
-
*/;_proto.getElementById=function getElementById(id){return this.documentElement.getElementById(id);};_proto.getElementsByName=function getElementsByName(name){return this.documentElement.getElementsByName(name);};_proto.getElementsByTagName=function getElementsByTagName(tagName){return this.documentElement.getElementsByTagName(tagName);};_proto.getElementsByClassName=function getElementsByClassName(className){return this.documentElement.getElementsByClassName(className);};_proto.querySelector=function querySelector(selectors){return this.documentElement.querySelector(selectors);};_proto.querySelectorAll=function querySelectorAll(selectors){return this.documentElement.querySelectorAll(selectors);};_proto.find=function find(filter){return this.documentElement.find(filter);};_proto.findAll=function findAll(filter){return this.documentElement.findAll(filter);};_createClass(Document,[{key:"children",get:function get(){return this.childNodes;}},{key:"childElementCount",get:function get(){return this.childNodes.length;}},{key:"firstElementChild",get:function get(){return this.firstChild;}},{key:"lastElementChild",get:function get(){return this.lastChild;}
|
|
8290
|
-
* only document has defaultView, points to canvas,
|
|
8291
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
|
|
8292
|
-
*/}]);return Document;}(Node);/**
|
|
8352
|
+
*/;_proto.getElementById=function getElementById(id){return this.documentElement.getElementById(id);};_proto.getElementsByName=function getElementsByName(name){return this.documentElement.getElementsByName(name);};_proto.getElementsByTagName=function getElementsByTagName(tagName){return this.documentElement.getElementsByTagName(tagName);};_proto.getElementsByClassName=function getElementsByClassName(className){return this.documentElement.getElementsByClassName(className);};_proto.querySelector=function querySelector(selectors){return this.documentElement.querySelector(selectors);};_proto.querySelectorAll=function querySelectorAll(selectors){return this.documentElement.querySelectorAll(selectors);};_proto.find=function find(filter){return this.documentElement.find(filter);};_proto.findAll=function findAll(filter){return this.documentElement.findAll(filter);};_createClass(Document,[{key:"children",get:function get(){return this.childNodes;}},{key:"childElementCount",get:function get(){return this.childNodes.length;}},{key:"firstElementChild",get:function get(){return this.firstChild;}},{key:"lastElementChild",get:function get(){return this.lastChild;}}]);return Document;}(Node);/**
|
|
8293
8353
|
* @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
|
|
8294
8354
|
*/(function(Strategy){Strategy[Strategy["Standard"]=0]="Standard";})(exports.Strategy||(exports.Strategy={}));/**
|
|
8295
8355
|
* built-in events for element
|
|
@@ -8317,7 +8377,9 @@
|
|
|
8317
8377
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
8318
8378
|
* * Query eg. querySelector getElementById...
|
|
8319
8379
|
* * Animation
|
|
8320
|
-
*/var Element=/*#__PURE__*/function(_Node){_inheritsLoose(Element,_Node);function Element(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_Node.call.apply(_Node,[this].concat(args))||this
|
|
8380
|
+
*/var Element=/*#__PURE__*/function(_Node){_inheritsLoose(Element,_Node);function Element(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_Node.call.apply(_Node,[this].concat(args))||this;/**
|
|
8381
|
+
* Unique id.
|
|
8382
|
+
*/_this.entity=entityCounter++;_this.renderable={bounds:undefined,boundsDirty:true,renderBounds:undefined,renderBoundsDirty:true,dirtyRenderBounds:undefined,dirty:false,proxyNodeName:undefined};_this.cullable={strategy:exports.Strategy.Standard,visibilityPlaneMask:-1,visible:true,enable:true};_this.transformable={dirtyFlag:false,localDirtyFlag:false,frozen:false,// localPosition: vec3.fromValues(0, 0, 0),
|
|
8321
8383
|
// localRotation: quat.fromValues(0, 0, 0, 1),
|
|
8322
8384
|
// localScale: vec3.fromValues(1, 1, 1),
|
|
8323
8385
|
// localTransform: mat4.create(),
|
|
@@ -8327,7 +8389,25 @@
|
|
|
8327
8389
|
// scaling: vec3.fromValues(1, 1, 1),
|
|
8328
8390
|
// worldTransform: mat4.create(),
|
|
8329
8391
|
// origin: vec3.fromValues(0, 0, 0),
|
|
8330
|
-
localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]};_this.sortable={dirty:false,sorted:undefined,lastSortedIndex:undefined,renderOrder:0};_this.geometry={contentBounds:undefined,renderBounds:undefined};_this.rBushNode={aabb:undefined}
|
|
8392
|
+
localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]};_this.sortable={dirty:false,sorted:undefined,lastSortedIndex:undefined,renderOrder:0};_this.geometry={contentBounds:undefined,renderBounds:undefined};_this.rBushNode={aabb:undefined};/**
|
|
8393
|
+
* used with `getElementById()`
|
|
8394
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
|
|
8395
|
+
*/_this.id=void 0;/**
|
|
8396
|
+
* used in `getElementsByName`
|
|
8397
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
8398
|
+
*/_this.name=void 0;/**
|
|
8399
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/API/Element/namespaceURI
|
|
8400
|
+
*/_this.namespaceURI='g';_this.scrollLeft=0;_this.scrollTop=0;/**
|
|
8401
|
+
* We don't support border now
|
|
8402
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop
|
|
8403
|
+
*/_this.clientTop=0;_this.clientLeft=0;/**
|
|
8404
|
+
* is destroyed or not
|
|
8405
|
+
*/_this.destroyed=false;/**
|
|
8406
|
+
* compatible with `style`
|
|
8407
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
8408
|
+
*/_this.style={};_this.computedStyle=runtime.enableCSSParsing?{anchor:unsetKeywordValue,opacity:unsetKeywordValue,fillOpacity:unsetKeywordValue,strokeOpacity:unsetKeywordValue,fill:unsetKeywordValue,stroke:unsetKeywordValue,transform:unsetKeywordValue,transformOrigin:unsetKeywordValue,visibility:unsetKeywordValue,pointerEvents:unsetKeywordValue,lineWidth:unsetKeywordValue,lineCap:unsetKeywordValue,lineJoin:unsetKeywordValue,increasedLineWidthForHitTesting:unsetKeywordValue,fontSize:unsetKeywordValue,fontFamily:unsetKeywordValue,fontStyle:unsetKeywordValue,fontWeight:unsetKeywordValue,fontVariant:unsetKeywordValue,textAlign:unsetKeywordValue,textBaseline:unsetKeywordValue,textTransform:unsetKeywordValue,zIndex:unsetKeywordValue,filter:unsetKeywordValue,shadowType:unsetKeywordValue}:null;/**
|
|
8409
|
+
* Renderers will use these used values.
|
|
8410
|
+
*/_this.parsedStyle={// opacity: '',
|
|
8331
8411
|
// fillOpacity: '',
|
|
8332
8412
|
// strokeOpacity: '',
|
|
8333
8413
|
// transformOrigin: '',
|
|
@@ -8345,9 +8425,9 @@
|
|
|
8345
8425
|
// textAlign: '',
|
|
8346
8426
|
// textBaseline: '',
|
|
8347
8427
|
// textTransform: '',
|
|
8348
|
-
}
|
|
8349
|
-
|
|
8350
|
-
|
|
8428
|
+
};/**
|
|
8429
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
8430
|
+
*/_this.attributes={};return _this;}Element.isElement=function isElement(target){return !!target.getAttribute;};var _proto=Element.prototype;_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
|
|
8351
8431
|
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
|
|
8352
8432
|
runtime.sceneGraphService.detach(child);return child;}/**
|
|
8353
8433
|
* Remove all children which can be appended to its original parent later again.
|
|
@@ -8376,9 +8456,7 @@
|
|
|
8376
8456
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceChildren
|
|
8377
8457
|
*/;_proto.replaceChildren=function replaceChildren(){while(this.childNodes.length&&this.firstChild){this.removeChild(this.firstChild);}this.append.apply(this,arguments);}/**
|
|
8378
8458
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/remove
|
|
8379
|
-
*/;_proto.remove=function remove(){if(this.parentNode){return this.parentNode.removeChild(this);}return this;}
|
|
8380
|
-
* is destroyed or not
|
|
8381
|
-
*/;_proto.destroy=function destroy(){// destroy itself before remove
|
|
8459
|
+
*/;_proto.remove=function remove(){if(this.parentNode){return this.parentNode.removeChild(this);}return this;};_proto.destroy=function destroy(){// destroy itself before remove
|
|
8382
8460
|
this.dispatchEvent(destroyEvent);// remove from scenegraph first
|
|
8383
8461
|
this.remove();// remove event listeners
|
|
8384
8462
|
this.emitter.removeAllListeners();this.destroyed=true;};_proto.getGeometryBounds=function getGeometryBounds(){return runtime.sceneGraphService.getGeometryBounds(this);};_proto.getRenderBounds=function getRenderBounds(){return runtime.sceneGraphService.getBounds(this,true);}/**
|
|
@@ -8391,15 +8469,10 @@
|
|
|
8391
8469
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
|
|
8392
8470
|
*/;_proto.getBoundingClientRect=function getBoundingClientRect(){return runtime.sceneGraphService.getBoundingClientRect(this);}/**
|
|
8393
8471
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getClientRects
|
|
8394
|
-
*/;_proto.getClientRects=function getClientRects(){return [this.getBoundingClientRect()];}
|
|
8395
|
-
* compatible with `style`
|
|
8396
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
8397
|
-
*/;/**
|
|
8472
|
+
*/;_proto.getClientRects=function getClientRects(){return [this.getBoundingClientRect()];};/**
|
|
8398
8473
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap
|
|
8399
8474
|
* eg. circle.computedStyleMap().get('fill');
|
|
8400
|
-
*/_proto.computedStyleMap=function computedStyleMap(){return new Map(Object.entries(this.computedStyle));}
|
|
8401
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
8402
|
-
*/;/**
|
|
8475
|
+
*/_proto.computedStyleMap=function computedStyleMap(){return new Map(Object.entries(this.computedStyle));};/**
|
|
8403
8476
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
|
|
8404
8477
|
*/_proto.getAttributeNames=function getAttributeNames(){return Object.keys(this.attributes);}/**
|
|
8405
8478
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
@@ -8418,21 +8491,64 @@
|
|
|
8418
8491
|
* used in `getElementsByClassName`
|
|
8419
8492
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
|
|
8420
8493
|
*/function get(){// @ts-ignore
|
|
8421
|
-
return this.getAttribute('class')||'';},set:function set(className){this.setAttribute('class',className);}
|
|
8422
|
-
* used in `getElementsByName`
|
|
8423
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
8424
|
-
*/},{key:"classList",get:/**
|
|
8494
|
+
return this.getAttribute('class')||'';},set:function set(className){this.setAttribute('class',className);}},{key:"classList",get:/**
|
|
8425
8495
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
|
|
8426
|
-
*/function get(){return this.className.split(' ').filter(function(c){return c!=='';});}},{key:"tagName",get:function get(){return this.nodeName;}},{key:"children",get:function get(){return this.childNodes;}},{key:"childElementCount",get:function get(){return this.childNodes.length;}},{key:"firstElementChild",get:function get(){return this.firstChild;}},{key:"lastElementChild",get:function get(){return this.lastChild;}},{key:"parentElement",get:function get(){return this.parentNode;}},{key:"nextSibling",get:function get(){if(this.parentNode){var index=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[index+1]||null;}return null;}},{key:"previousSibling",get:function get(){if(this.parentNode){var index=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[index-1]||null;}return null;}}]);return Element;}(Node);var FederatedMouseEvent=/*#__PURE__*/function(_FederatedEvent){_inheritsLoose(FederatedMouseEvent,_FederatedEvent);function FederatedMouseEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedEvent.call.apply(_FederatedEvent,[this].concat(args))||this
|
|
8496
|
+
*/function get(){return this.className.split(' ').filter(function(c){return c!=='';});}},{key:"tagName",get:function get(){return this.nodeName;}},{key:"children",get:function get(){return this.childNodes;}},{key:"childElementCount",get:function get(){return this.childNodes.length;}},{key:"firstElementChild",get:function get(){return this.firstChild;}},{key:"lastElementChild",get:function get(){return this.lastChild;}},{key:"parentElement",get:function get(){return this.parentNode;}},{key:"nextSibling",get:function get(){if(this.parentNode){var index=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[index+1]||null;}return null;}},{key:"previousSibling",get:function get(){if(this.parentNode){var index=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[index-1]||null;}return null;}}]);return Element;}(Node);var FederatedMouseEvent=/*#__PURE__*/function(_FederatedEvent){_inheritsLoose(FederatedMouseEvent,_FederatedEvent);function FederatedMouseEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedEvent.call.apply(_FederatedEvent,[this].concat(args))||this;/** Whether the "alt" key was pressed when this mouse event occurred. */_this.altKey=void 0;/** The specific button that was pressed in this mouse event. */_this.button=void 0;/** The button depressed when this event occurred. */_this.buttons=void 0;/** Whether the "control" key was pressed when this mouse event occurred. */_this.ctrlKey=void 0;/** Whether the "meta" key was pressed when this mouse event occurred. */_this.metaKey=void 0;/** This is currently not implemented in the Federated Events API. */_this.relatedTarget=void 0;/** Whether the "shift" key was pressed when this mouse event occurred. */_this.shiftKey=void 0;/**
|
|
8497
|
+
* The coordinates of the mouse event relative to the canvas.
|
|
8498
|
+
*/_this.client=new Point();/**
|
|
8427
8499
|
* The movement in this pointer relative to the last `mousemove` event.
|
|
8428
|
-
*/
|
|
8500
|
+
*/_this.movement=new Point();/**
|
|
8429
8501
|
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
|
|
8430
8502
|
* not supported at the moment.
|
|
8431
|
-
*/
|
|
8503
|
+
*/_this.offset=new Point();/**
|
|
8432
8504
|
* The pointer coordinates in world space.
|
|
8433
|
-
*/
|
|
8505
|
+
*/_this.global=new Point();/**
|
|
8434
8506
|
* The pointer coordinates in sceen space.
|
|
8435
|
-
*/},{key:"screenX",get:function get(){return this.screen.x;}},{key:"screenY",get:function get(){return this.screen.y;}}]);return FederatedMouseEvent;}(FederatedEvent);var FederatedPointerEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedPointerEvent,_FederatedMouseEvent);function FederatedPointerEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this
|
|
8507
|
+
*/_this.screen=new Point();return _this;}var _proto=FederatedMouseEvent.prototype;_proto.getModifierState=function getModifierState(key){return 'getModifierState'in this.nativeEvent&&this.nativeEvent.getModifierState(key);};_proto.initMouseEvent=function initMouseEvent(){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_createClass(FederatedMouseEvent,[{key:"clientX",get:function get(){return this.client.x;}},{key:"clientY",get:function get(){return this.client.y;}},{key:"movementX",get:function get(){return this.movement.x;}},{key:"movementY",get:function get(){return this.movement.y;}},{key:"offsetX",get:function get(){return this.offset.x;}},{key:"offsetY",get:function get(){return this.offset.y;}},{key:"globalX",get:function get(){return this.global.x;}},{key:"globalY",get:function get(){return this.global.y;}},{key:"screenX",get:function get(){return this.screen.x;}},{key:"screenY",get:function get(){return this.screen.y;}}]);return FederatedMouseEvent;}(FederatedEvent);var FederatedPointerEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedPointerEvent,_FederatedMouseEvent);function FederatedPointerEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this;/**
|
|
8508
|
+
* The unique identifier of the pointer.
|
|
8509
|
+
*
|
|
8510
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
|
|
8511
|
+
*/_this.pointerId=void 0;/**
|
|
8512
|
+
* The width of the pointer's contact along the x-axis, measured in CSS pixels.
|
|
8513
|
+
* radiusX of TouchEvents will be represented by this value.
|
|
8514
|
+
*
|
|
8515
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width
|
|
8516
|
+
*/_this.width=0;/**
|
|
8517
|
+
* The height of the pointer's contact along the y-axis, measured in CSS pixels.
|
|
8518
|
+
* radiusY of TouchEvents will be represented by this value.
|
|
8519
|
+
*
|
|
8520
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height
|
|
8521
|
+
*/_this.height=0;/**
|
|
8522
|
+
* Indicates whether or not the pointer device that created the event is the primary pointer.
|
|
8523
|
+
*
|
|
8524
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
|
|
8525
|
+
*/_this.isPrimary=false;/**
|
|
8526
|
+
* The type of pointer that triggered the event.
|
|
8527
|
+
*
|
|
8528
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
8529
|
+
*/_this.pointerType=void 0;/**
|
|
8530
|
+
* Pressure applied by the pointing device during the event.
|
|
8531
|
+
*s
|
|
8532
|
+
* A Touch's force property will be represented by this value.
|
|
8533
|
+
*
|
|
8534
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
|
|
8535
|
+
*/_this.pressure=void 0;/**
|
|
8536
|
+
* Barrel pressure on a stylus pointer.
|
|
8537
|
+
*
|
|
8538
|
+
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
8539
|
+
*/_this.tangentialPressure=void 0;/**
|
|
8540
|
+
* The angle, in degrees, between the pointer device and the screen.
|
|
8541
|
+
*
|
|
8542
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX
|
|
8543
|
+
*/_this.tiltX=void 0;/**
|
|
8544
|
+
* The angle, in degrees, between the pointer device and the screen.
|
|
8545
|
+
*
|
|
8546
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY
|
|
8547
|
+
*/_this.tiltY=void 0;/**
|
|
8548
|
+
* Twist of a stylus pointer.
|
|
8549
|
+
*
|
|
8550
|
+
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
8551
|
+
*/_this.twist=void 0;return _this;}var _proto=FederatedPointerEvent.prototype;/**
|
|
8436
8552
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/getCoalescedEvents
|
|
8437
8553
|
*/_proto.getCoalescedEvents=function getCoalescedEvents(){if(this.type==='pointermove'||this.type==='mousemove'||this.type==='touchmove'){return [this];}return [];}/**
|
|
8438
8554
|
* @see https://chromestatus.com/feature/5765569655603200
|
|
@@ -8446,7 +8562,10 @@
|
|
|
8446
8562
|
* which can lead to unintended consequences if an attempt is made to cache the entire event object.
|
|
8447
8563
|
*
|
|
8448
8564
|
* Therefore, while keeping the above performance considerations in mind, it is possible to provide a clone method that creates a new object when the user really wants to cache it, e.g.
|
|
8449
|
-
*/;_proto.clone=function clone(){return this.manager.clonePointerEvent(this);};return FederatedPointerEvent;}(FederatedMouseEvent);var FederatedWheelEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedWheelEvent,_FederatedMouseEvent);function FederatedWheelEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this
|
|
8565
|
+
*/;_proto.clone=function clone(){return this.manager.clonePointerEvent(this);};return FederatedPointerEvent;}(FederatedMouseEvent);var FederatedWheelEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedWheelEvent,_FederatedMouseEvent);function FederatedWheelEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this;/**
|
|
8566
|
+
* The units of `deltaX`, `deltaY`, and `deltaZ`. This is one of `DOM_DELTA_LINE`,
|
|
8567
|
+
* `DOM_DELTA_PAGE`, `DOM_DELTA_PIXEL`.
|
|
8568
|
+
*/_this.deltaMode=void 0;/** Horizontal scroll amount */_this.deltaX=void 0;/** Vertical scroll amount */_this.deltaY=void 0;/** z-axis scroll amount. */_this.deltaZ=void 0;/** Units specified in lines. */_this.DOM_DELTA_LINE=0;/** Units specified in pages. */_this.DOM_DELTA_PAGE=1;/** Units specified in pixels. */_this.DOM_DELTA_PIXEL=2;return _this;}var _proto=FederatedWheelEvent.prototype;_proto.clone=function clone(){return this.manager.cloneWheelEvent(this);};return FederatedWheelEvent;}(FederatedMouseEvent);function isDisplayObject(value){return !!(value===null||value===void 0?void 0:value.nodeName);}var mutationEvent=new MutationEvent(exports.ElementEvent.ATTR_MODIFIED,null,null,null,null,MutationEvent.MODIFICATION,null,null);var DEFAULT_STYLE_PROPS={anchor:'',opacity:'',fillOpacity:'',strokeOpacity:'',fill:'',stroke:'',transform:'',transformOrigin:'',visibility:'',pointerEvents:'',lineWidth:'',lineCap:'',lineJoin:'',increasedLineWidthForHitTesting:'',fontSize:'',fontFamily:'',fontStyle:'',fontWeight:'',fontVariant:'',textAlign:'',textBaseline:'',textTransform:'',zIndex:'',filter:'',shadowType:''};var DEFAULT_PARSED_STYLE_PROPS={anchor:[0,0],fill:noneColor,stroke:noneColor,transform:[],zIndex:0,filter:[],shadowType:'outer',miterLimit:10};var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED=_extends({},DEFAULT_PARSED_STYLE_PROPS,{opacity:1,fillOpacity:1,strokeOpacity:1,visibility:'visible',pointerEvents:'auto',lineWidth:1,lineCap:'butt',lineJoin:'miter',increasedLineWidthForHitTesting:0,fillRule:'nonzero'// TODO: transformOrigin
|
|
8450
8569
|
});var INHERITABLE_BASE_STYLE_PROPS=['opacity','fillOpacity','strokeOpacity','transformOrigin','visibility','pointerEvents','lineWidth','lineCap','lineJoin','increasedLineWidthForHitTesting'];var INHERITABLE_STYLE_PROPS=[].concat(INHERITABLE_BASE_STYLE_PROPS,['fontSize','fontFamily','fontStyle','fontWeight','fontVariant','textAlign','textBaseline','textTransform']);var DATASET_PREFIX='data-';/**
|
|
8451
8570
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
8452
8571
|
*
|
|
@@ -8476,7 +8595,10 @@
|
|
|
8476
8595
|
* group.getAttribute('data-prop1'); // 1
|
|
8477
8596
|
*/function DisplayObject(config){var _this$config$capture;var _this;_this=_Element.call(this)||this;// assign name, id to config
|
|
8478
8597
|
// eg. group.get('name')
|
|
8479
|
-
_this.config=void 0;_this.isCustomElement=false;_this.isMutationObserved=false;_this.activeAnimations=[];_this.dataset=void 0
|
|
8598
|
+
_this.config=void 0;_this.isCustomElement=false;_this.isMutationObserved=false;_this.activeAnimations=[];_this.dataset=void 0;/**
|
|
8599
|
+
* Use `this.style.clipPath` instead.
|
|
8600
|
+
* @deprecated
|
|
8601
|
+
*/_this.getClip=function(){return this.style.clipPath||null;};_this.config=config;// compatible with G 3.0
|
|
8480
8602
|
_this.config.interactive=(_this$config$capture=_this.config.capture)!==null&&_this$config$capture!==void 0?_this$config$capture:_this.config.interactive;// init scene graph node
|
|
8481
8603
|
_this.id=_this.config.id||'';_this.name=_this.config.name||'';if(_this.config.className||_this.config.class){_this.className=_this.config.className||_this.config.class;}_this.nodeName=_this.config.type||exports.Shape.GROUP;// compatible with G 3.0
|
|
8482
8604
|
_this.config.style=_this.config.style||_this.config.attrs||{};Object.assign(_this.config.style,_this.config.attrs);// this.config.style = {
|
|
@@ -8619,10 +8741,7 @@
|
|
|
8619
8741
|
*/;_proto.add=function add(child,index){return this.appendChild(child,index);}/**
|
|
8620
8742
|
* Use `this.style.clipPath` instead.
|
|
8621
8743
|
* @deprecated
|
|
8622
|
-
*/;_proto.setClip=function setClip(clipPath){this.style.clipPath=clipPath;}
|
|
8623
|
-
* Use `this.style.clipPath` instead.
|
|
8624
|
-
* @deprecated
|
|
8625
|
-
*/;/**
|
|
8744
|
+
*/;_proto.setClip=function setClip(clipPath){this.style.clipPath=clipPath;};/**
|
|
8626
8745
|
* @deprecated
|
|
8627
8746
|
*/_proto.set=function set(name,value){// @ts-ignore
|
|
8628
8747
|
this.config[name]=value;}/**
|
|
@@ -8999,7 +9118,45 @@
|
|
|
8999
9118
|
* 2. pan 沿 u v 轴移动
|
|
9000
9119
|
* 3. rotate 以方位角旋转
|
|
9001
9120
|
* 4. 移动到 Landmark,具有平滑的动画效果,其间禁止其他用户交互
|
|
9002
|
-
*/var Camera=/*#__PURE__*/function(){function Camera(){this.canvas=void 0;this.eventEmitter=new eventemitter3()
|
|
9121
|
+
*/var Camera=/*#__PURE__*/function(){function Camera(){this.canvas=void 0;this.eventEmitter=new eventemitter3();/**
|
|
9122
|
+
* 相机矩阵
|
|
9123
|
+
*/this.matrix=create$1();/**
|
|
9124
|
+
* u 轴
|
|
9125
|
+
* @see http://learnwebgl.brown37.net/07_cameras/camera_introduction.html#a-camera-definition
|
|
9126
|
+
*/this.right=fromValues$2(1,0,0);/**
|
|
9127
|
+
* v 轴 +Y is down
|
|
9128
|
+
*/this.up=fromValues$2(0,1,0);/**
|
|
9129
|
+
* n 轴 +Z is inside
|
|
9130
|
+
*/this.forward=fromValues$2(0,0,1);/**
|
|
9131
|
+
* 相机位置
|
|
9132
|
+
*/this.position=fromValues$2(0,0,1);/**
|
|
9133
|
+
* 视点位置
|
|
9134
|
+
*/this.focalPoint=fromValues$2(0,0,0);/**
|
|
9135
|
+
* 视点到相机位置的向量
|
|
9136
|
+
* focalPoint - position
|
|
9137
|
+
*/this.distanceVector=fromValues$2(0,0,-1);/**
|
|
9138
|
+
* 相机位置到视点距离
|
|
9139
|
+
* length(focalPoint - position)
|
|
9140
|
+
*/this.distance=1;/**
|
|
9141
|
+
* @see https://en.wikipedia.org/wiki/Azimuth
|
|
9142
|
+
*/this.azimuth=0;this.elevation=0;this.roll=0;this.relAzimuth=0;this.relElevation=0;this.relRoll=0;/**
|
|
9143
|
+
* 沿 n 轴移动时,保证移动速度从快到慢
|
|
9144
|
+
*/this.dollyingStep=0;this.maxDistance=Infinity;this.minDistance=-Infinity;/**
|
|
9145
|
+
* zoom factor of the camera, default is 1
|
|
9146
|
+
* eg. https://threejs.org/docs/#api/en/cameras/OrthographicCamera.zoom
|
|
9147
|
+
*/this.zoom=1;/**
|
|
9148
|
+
* invert the horizontal coordinate system HCS
|
|
9149
|
+
*/this.rotateWorld=false;/**
|
|
9150
|
+
* 投影矩阵参数
|
|
9151
|
+
*/ /**
|
|
9152
|
+
* field of view [0-360]
|
|
9153
|
+
* @see http://en.wikipedia.org/wiki/Angle_of_view
|
|
9154
|
+
*/this.fov=30;this.near=0.1;this.far=1000;this.aspect=1;this.left=void 0;this.rright=void 0;this.top=void 0;this.bottom=void 0;this.projectionMatrix=create$1();this.projectionMatrixInverse=create$1();this.jitteredProjectionMatrix=undefined;this.view=void 0;this.enableUpdate=true;// protected following = undefined;
|
|
9155
|
+
this.type=exports.CameraType.EXPLORING;this.trackingMode=exports.CameraTrackingMode.DEFAULT;this.projectionMode=exports.CameraProjectionMode.PERSPECTIVE;/**
|
|
9156
|
+
* for culling use
|
|
9157
|
+
*/this.frustum=new Frustum();/**
|
|
9158
|
+
* ortho matrix for Canvas2D & SVG
|
|
9159
|
+
*/this.orthoMatrix=create$1();}var _proto=Camera.prototype;// constructor(type = CameraType.EXPLORING, trackingMode = CameraTrackingMode.DEFAULT) {
|
|
9003
9160
|
// this.setType(type, trackingMode);
|
|
9004
9161
|
// }
|
|
9005
9162
|
_proto.isOrtho=function isOrtho(){return this.projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC;};_proto.getProjectionMode=function getProjectionMode(){return this.projectionMode;};_proto.getPerspective=function getPerspective(){// account for TAA
|
|
@@ -9081,41 +9238,51 @@
|
|
|
9081
9238
|
lineYOffset=halfExtents[1];}else if(textBaseline==='top'||textBaseline==='hanging'){lineYOffset=halfExtents[1]*2;}else if(textBaseline==='alphabetic'){// prevent calling getImageData for ascent metrics
|
|
9082
9239
|
lineYOffset=runtime.enableCSSParsing?lineHeight-fontProperties.ascent:0;}else if(textBaseline==='bottom'||textBaseline==='ideographic'){lineYOffset=0;}// TODO: ideographic & bottom
|
|
9083
9240
|
if(dx){lineXOffset+=dx;}if(dy){lineYOffset+=dy;}// update anchor
|
|
9084
|
-
parsedStyle.anchor=[anchor[0],anchor[1],0];return {width:halfExtents[0]*2,height:halfExtents[1]*2,offsetX:lineXOffset,offsetY:lineYOffset};};return TextUpdater;}();var PROPAGATION_LIMIT=2048;var EventService=/*#__PURE__*/function(){function EventService(globalRuntime,context){var _this=this;this.globalRuntime=void 0;this.context=void 0;this.rootTarget=void 0;this.emitter=new eventemitter3();this.cursor='default';this.mappingTable={};this.mappingState={trackingData:{}};this.eventPool=new Map();this.pickHandler=void 0;this.tmpMatrix=create$1();this.tmpVec3=create$2();this.onPointerDown
|
|
9241
|
+
parsedStyle.anchor=[anchor[0],anchor[1],0];return {width:halfExtents[0]*2,height:halfExtents[1]*2,offsetX:lineXOffset,offsetY:lineYOffset};};return TextUpdater;}();var PROPAGATION_LIMIT=2048;var EventService=/*#__PURE__*/function(){function EventService(globalRuntime,context){var _this=this;this.globalRuntime=void 0;this.context=void 0;this.rootTarget=void 0;this.emitter=new eventemitter3();this.cursor='default';this.mappingTable={};this.mappingState={trackingData:{}};this.eventPool=new Map();this.pickHandler=void 0;this.tmpMatrix=create$1();this.tmpVec3=create$2();this.onPointerDown=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9085
9242
|
// return;
|
|
9086
9243
|
// }
|
|
9087
|
-
|
|
9244
|
+
var e=_this.createPointerEvent(from);_this.dispatchEvent(e,'pointerdown');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchstart');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightdown':'mousedown');}var trackingData=_this.trackingData(from.pointerId);trackingData.pressTargetsByButton[from.button]=e.composedPath();_this.freeEvent(e);};this.onPointerUp=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9245
|
+
// return;
|
|
9246
|
+
// }
|
|
9247
|
+
var now=performance.now();var e=_this.createPointerEvent(from);_this.dispatchEvent(e,'pointerup');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchend');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightup':'mouseup');}var trackingData=_this.trackingData(from.pointerId);var pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);var clickTarget=pressTarget;// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
9088
9248
|
// the pointerup location.
|
|
9089
|
-
if(pressTarget&&!e.composedPath().includes(pressTarget)){currentTarget=pressTarget;while(currentTarget&&!e.composedPath().includes(currentTarget)){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch'){_this.notifyTarget(e,'touchendoutside');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){_isRightButton=e.button===2;_this.notifyTarget(e,_isRightButton?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
9249
|
+
if(pressTarget&&!e.composedPath().includes(pressTarget)){var currentTarget=pressTarget;while(currentTarget&&!e.composedPath().includes(currentTarget)){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch'){_this.notifyTarget(e,'touchendoutside');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){var _isRightButton=e.button===2;_this.notifyTarget(e,_isRightButton?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
9090
9250
|
// targets. That is - it's our click target!
|
|
9091
|
-
clickTarget=currentTarget;}if(clickTarget){clickEvent=_this.clonePointerEvent(e,'click');clickEvent.target=clickTarget;clickEvent.path=[];if(!trackingData.clicksByButton[from.button]){trackingData.clicksByButton[from.button]={clickCount:0,target:clickEvent.target,timeStamp:now};}clickHistory=trackingData.clicksByButton[from.button];if(clickHistory.target===clickEvent.target&&now-clickHistory.timeStamp<200){++clickHistory.clickCount;}else {clickHistory.clickCount=1;}clickHistory.target=clickEvent.target;clickHistory.timeStamp=now;clickEvent.detail=clickHistory.clickCount;// @see https://github.com/antvis/G/issues/1091
|
|
9092
|
-
if(!((_e$detail=e.detail)===null||_e$detail===void 0?void 0:_e$detail.preventClick)){if(clickEvent.pointerType==='mouse'||clickEvent.pointerType==='touch'){_this.dispatchEvent(clickEvent,'click');}_this.dispatchEvent(clickEvent,'pointertap');}_this.freeEvent(clickEvent);}_this.freeEvent(e);
|
|
9093
|
-
|
|
9094
|
-
|
|
9251
|
+
clickTarget=currentTarget;}if(clickTarget){var _e$detail;var clickEvent=_this.clonePointerEvent(e,'click');clickEvent.target=clickTarget;clickEvent.path=[];if(!trackingData.clicksByButton[from.button]){trackingData.clicksByButton[from.button]={clickCount:0,target:clickEvent.target,timeStamp:now};}var clickHistory=trackingData.clicksByButton[from.button];if(clickHistory.target===clickEvent.target&&now-clickHistory.timeStamp<200){++clickHistory.clickCount;}else {clickHistory.clickCount=1;}clickHistory.target=clickEvent.target;clickHistory.timeStamp=now;clickEvent.detail=clickHistory.clickCount;// @see https://github.com/antvis/G/issues/1091
|
|
9252
|
+
if(!((_e$detail=e.detail)===null||_e$detail===void 0?void 0:_e$detail.preventClick)){if(!_this.context.config.useNativeClickEvent&&(clickEvent.pointerType==='mouse'||clickEvent.pointerType==='touch')){_this.dispatchEvent(clickEvent,'click');}_this.dispatchEvent(clickEvent,'pointertap');}_this.freeEvent(clickEvent);}_this.freeEvent(e);};this.onPointerMove=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9253
|
+
// return;
|
|
9254
|
+
// }
|
|
9255
|
+
var e=_this.createPointerEvent(from);var isMouse=e.pointerType==='mouse'||e.pointerType==='pen';var trackingData=_this.trackingData(from.pointerId);var outTarget=_this.findMountedTarget(trackingData.overTargets);// First pointerout/pointerleave
|
|
9256
|
+
if(trackingData.overTargets&&outTarget!==e.target){// pointerout always occurs on the overTarget when the pointer hovers over another element.
|
|
9257
|
+
var outType=from.type==='mousemove'?'mouseout':'pointerout';var outEvent=_this.createPointerEvent(from,outType,outTarget||undefined);_this.dispatchEvent(outEvent,'pointerout');if(isMouse)_this.dispatchEvent(outEvent,'mouseout');// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
9095
9258
|
// is dispatched to all ancestors that no longer capture the pointer.
|
|
9096
|
-
if(e.composedPath().includes(outTarget)){
|
|
9097
|
-
|
|
9259
|
+
if(!e.composedPath().includes(outTarget)){var leaveEvent=_this.createPointerEvent(from,'pointerleave',outTarget||undefined);leaveEvent.eventPhase=leaveEvent.AT_TARGET;while(leaveEvent.target&&!e.composedPath().includes(leaveEvent.target)){leaveEvent.currentTarget=leaveEvent.target;_this.notifyTarget(leaveEvent);if(isMouse){_this.notifyTarget(leaveEvent,'mouseleave');}if(Node.isNode(leaveEvent.target)){leaveEvent.target=leaveEvent.target.parentNode;}}_this.freeEvent(leaveEvent);}_this.freeEvent(outEvent);}// Then pointerover
|
|
9260
|
+
if(outTarget!==e.target){// pointerover always occurs on the new overTarget
|
|
9261
|
+
var overType=from.type==='mousemove'?'mouseover':'pointerover';var overEvent=_this.clonePointerEvent(e,overType);// clone faster
|
|
9098
9262
|
_this.dispatchEvent(overEvent,'pointerover');if(isMouse)_this.dispatchEvent(overEvent,'mouseover');// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
9099
|
-
overTargetAncestor=outTarget&&Node.isNode(outTarget)&&outTarget.parentNode;
|
|
9263
|
+
var overTargetAncestor=outTarget&&Node.isNode(outTarget)&&outTarget.parentNode;while(overTargetAncestor&&overTargetAncestor!==(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode)){if(overTargetAncestor===e.target)break;overTargetAncestor=overTargetAncestor.parentNode;}// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
9100
9264
|
// event.
|
|
9101
|
-
didPointerEnter=!overTargetAncestor||overTargetAncestor===(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode);if(didPointerEnter){enterEvent=_this.clonePointerEvent(e,'pointerenter');enterEvent.eventPhase=enterEvent.AT_TARGET;while(enterEvent.target&&enterEvent.target!==outTarget&&enterEvent.target!==(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode)){enterEvent.currentTarget=enterEvent.target;_this.notifyTarget(enterEvent);if(isMouse)_this.notifyTarget(enterEvent,'mouseenter');if(Node.isNode(enterEvent.target)){enterEvent.target=enterEvent.target.parentNode;}}_this.freeEvent(enterEvent);}_this.freeEvent(overEvent);
|
|
9102
|
-
_this.dispatchEvent(e,'pointermove');if(e.pointerType==='touch')_this.dispatchEvent(e,'touchmove');if(isMouse){_this.dispatchEvent(e,'mousemove');_this.cursor=_this.getCursor(e.target);}trackingData.overTargets=e.composedPath();_this.freeEvent(e);
|
|
9265
|
+
var didPointerEnter=!overTargetAncestor||overTargetAncestor===(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode);if(didPointerEnter){var enterEvent=_this.clonePointerEvent(e,'pointerenter');enterEvent.eventPhase=enterEvent.AT_TARGET;while(enterEvent.target&&enterEvent.target!==outTarget&&enterEvent.target!==(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode)){enterEvent.currentTarget=enterEvent.target;_this.notifyTarget(enterEvent);if(isMouse)_this.notifyTarget(enterEvent,'mouseenter');if(Node.isNode(enterEvent.target)){enterEvent.target=enterEvent.target.parentNode;}}_this.freeEvent(enterEvent);}_this.freeEvent(overEvent);}// Then pointermove
|
|
9266
|
+
_this.dispatchEvent(e,'pointermove');if(e.pointerType==='touch')_this.dispatchEvent(e,'touchmove');if(isMouse){_this.dispatchEvent(e,'mousemove');_this.cursor=_this.getCursor(e.target);}trackingData.overTargets=e.composedPath();_this.freeEvent(e);};this.onPointerOut=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9103
9267
|
// return;
|
|
9104
9268
|
// }
|
|
9105
|
-
trackingData=_this.trackingData(from.pointerId);if(
|
|
9106
|
-
|
|
9269
|
+
var trackingData=_this.trackingData(from.pointerId);if(trackingData.overTargets){var isMouse=from.pointerType==='mouse'||from.pointerType==='pen';var outTarget=_this.findMountedTarget(trackingData.overTargets);// pointerout first
|
|
9270
|
+
var outEvent=_this.createPointerEvent(from,'pointerout',outTarget||undefined);_this.dispatchEvent(outEvent);if(isMouse)_this.dispatchEvent(outEvent,'mouseout');// pointerleave(s) are also dispatched b/c the pointer must've left rootTarget and its descendants to
|
|
9107
9271
|
// get an upstream pointerout event (upstream events do not know rootTarget has descendants).
|
|
9108
|
-
|
|
9272
|
+
var leaveEvent=_this.createPointerEvent(from,'pointerleave',outTarget||undefined);leaveEvent.eventPhase=leaveEvent.AT_TARGET;while(leaveEvent.target&&leaveEvent.target!==(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode)){leaveEvent.currentTarget=leaveEvent.target;_this.notifyTarget(leaveEvent);if(isMouse){_this.notifyTarget(leaveEvent,'mouseleave');}if(Node.isNode(leaveEvent.target)){leaveEvent.target=leaveEvent.target.parentNode;}}trackingData.overTargets=null;_this.freeEvent(outEvent);_this.freeEvent(leaveEvent);}_this.cursor=null;};this.onPointerOver=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9109
9273
|
// return;
|
|
9110
9274
|
// }
|
|
9111
|
-
trackingData=_this.trackingData(from.pointerId);
|
|
9112
|
-
enterEvent=_this.clonePointerEvent(e,'pointerenter');enterEvent.eventPhase=enterEvent.AT_TARGET;while(enterEvent.target&&enterEvent.target!==(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode)){enterEvent.currentTarget=enterEvent.target;_this.notifyTarget(enterEvent);if(isMouse){// mouseenter should not bubble
|
|
9275
|
+
var trackingData=_this.trackingData(from.pointerId);var e=_this.createPointerEvent(from);var isMouse=e.pointerType==='mouse'||e.pointerType==='pen';_this.dispatchEvent(e,'pointerover');if(isMouse)_this.dispatchEvent(e,'mouseover');if(e.pointerType==='mouse')_this.cursor=_this.getCursor(e.target);// pointerenter events must be fired since the pointer entered from upstream.
|
|
9276
|
+
var enterEvent=_this.clonePointerEvent(e,'pointerenter');enterEvent.eventPhase=enterEvent.AT_TARGET;while(enterEvent.target&&enterEvent.target!==(Node.isNode(_this.rootTarget)&&_this.rootTarget.parentNode)){enterEvent.currentTarget=enterEvent.target;_this.notifyTarget(enterEvent);if(isMouse){// mouseenter should not bubble
|
|
9113
9277
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event#usage_notes
|
|
9114
|
-
_this.notifyTarget(enterEvent,'mouseenter');}if(Node.isNode(enterEvent.target)){enterEvent.target=enterEvent.target.parentNode;}}trackingData.overTargets=e.composedPath();_this.freeEvent(e);_this.freeEvent(enterEvent);
|
|
9278
|
+
_this.notifyTarget(enterEvent,'mouseenter');}if(Node.isNode(enterEvent.target)){enterEvent.target=enterEvent.target.parentNode;}}trackingData.overTargets=e.composedPath();_this.freeEvent(e);_this.freeEvent(enterEvent);};this.onPointerUpOutside=function(from){// if (!(from instanceof FederatedPointerEvent)) {
|
|
9279
|
+
// return;
|
|
9280
|
+
// }
|
|
9281
|
+
var trackingData=_this.trackingData(from.pointerId);var pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);var e=_this.createPointerEvent(from);if(pressTarget){var currentTarget=pressTarget;while(currentTarget){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch');else if(e.pointerType==='mouse'||e.pointerType==='pen'){_this.notifyTarget(e,e.button===2?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];}_this.freeEvent(e);};this.onWheel=function(from){// if (!(from instanceof FederatedWheelEvent)) {
|
|
9115
9282
|
// return;
|
|
9116
9283
|
// }
|
|
9117
|
-
|
|
9118
|
-
this.addEventMapping('pointerdown',this.onPointerDown);this.addEventMapping('pointerup',this.onPointerUp);this.addEventMapping('pointermove',this.onPointerMove);this.addEventMapping('pointerout',this.onPointerOut);this.addEventMapping('pointerleave',this.onPointerOut);this.addEventMapping('pointerover',this.onPointerOver);this.addEventMapping('pointerupoutside',this.onPointerUpOutside);this.addEventMapping('wheel',this.onWheel);};_proto.destroy=function destroy(){this.emitter.removeAllListeners();this.mappingTable={};this.mappingState={};this.eventPool.clear();};_proto.client2Viewport=function client2Viewport(client){var bbox=this.context.contextService.getBoundingClientRect();return new Point(client.x-((bbox===null||bbox===void 0?void 0:bbox.left)||0),client.y-((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Client=function viewport2Client(canvas){var bbox=this.context.contextService.getBoundingClientRect();return new Point(canvas.x+((bbox===null||bbox===void 0?void 0:bbox.left)||0),canvas.y+((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Canvas=function viewport2Canvas(
|
|
9284
|
+
var wheelEvent=_this.createWheelEvent(from);_this.dispatchEvent(wheelEvent);_this.freeEvent(wheelEvent);};this.onClick=function(from){if(_this.context.config.useNativeClickEvent){var e=_this.createPointerEvent(from);_this.dispatchEvent(e);_this.freeEvent(e);}};this.onPointerCancel=function(from){var e=_this.createPointerEvent(from);_this.dispatchEvent(e);_this.freeEvent(e);};this.globalRuntime=globalRuntime;this.context=context;}var _proto=EventService.prototype;_proto.init=function init(){this.rootTarget=this.context.renderingContext.root.parentNode;// document
|
|
9285
|
+
this.addEventMapping('pointerdown',this.onPointerDown);this.addEventMapping('pointerup',this.onPointerUp);this.addEventMapping('pointermove',this.onPointerMove);this.addEventMapping('pointerout',this.onPointerOut);this.addEventMapping('pointerleave',this.onPointerOut);this.addEventMapping('pointercancel',this.onPointerCancel);this.addEventMapping('pointerover',this.onPointerOver);this.addEventMapping('pointerupoutside',this.onPointerUpOutside);this.addEventMapping('wheel',this.onWheel);this.addEventMapping('click',this.onClick);};_proto.destroy=function destroy(){this.emitter.removeAllListeners();this.mappingTable={};this.mappingState={};this.eventPool.clear();};_proto.client2Viewport=function client2Viewport(client){var bbox=this.context.contextService.getBoundingClientRect();return new Point(client.x-((bbox===null||bbox===void 0?void 0:bbox.left)||0),client.y-((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Client=function viewport2Client(canvas){var bbox=this.context.contextService.getBoundingClientRect();return new Point(canvas.x+((bbox===null||bbox===void 0?void 0:bbox.left)||0),canvas.y+((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Canvas=function viewport2Canvas(_ref){var x=_ref.x,y=_ref.y;var canvas=this.rootTarget.defaultView;var camera=canvas.getCamera();var _this$context$config=this.context.config,width=_this$context$config.width,height=_this$context$config.height;var projectionMatrixInverse=camera.getPerspectiveInverse();var worldMatrix=camera.getWorldTransform();var vpMatrix=multiply(this.tmpMatrix,worldMatrix,projectionMatrixInverse);var viewport=set$1(this.tmpVec3,x/width*2-1,(1-y/height)*2-1,0);transformMat4(viewport,viewport,vpMatrix);return new Point(viewport[0],viewport[1]);};_proto.canvas2Viewport=function canvas2Viewport(canvasP){var canvas=this.rootTarget.defaultView;var camera=canvas.getCamera();// World -> Clip
|
|
9119
9286
|
var projectionMatrix=camera.getPerspective();var viewMatrix=camera.getViewTransform();var vpMatrix=multiply(this.tmpMatrix,projectionMatrix,viewMatrix);var clip=set$1(this.tmpVec3,canvasP.x,canvasP.y,0);transformMat4(this.tmpVec3,this.tmpVec3,vpMatrix);// Clip -> NDC -> Viewport, flip Y
|
|
9120
9287
|
var _this$context$config2=this.context.config,width=_this$context$config2.width,height=_this$context$config2.height;return new Point((clip[0]+1)/2*width,(1-(clip[1]+1)/2)*height);};_proto.setPickHandler=function setPickHandler(pickHandler){this.pickHandler=pickHandler;};_proto.addEventMapping=function addEventMapping(type,fn){if(!this.mappingTable[type]){this.mappingTable[type]=[];}this.mappingTable[type].push({fn:fn,priority:0});this.mappingTable[type].sort(function(a,b){return a.priority-b.priority;});};_proto.mapEvent=function mapEvent(e){if(!this.rootTarget){return;}var mappers=this.mappingTable[e.type];if(mappers){for(var i=0,j=mappers.length;i<j;i++){mappers[i].fn(e);}}else {console.warn("[EventService]: Event mapping not defined for "+e.type);}};_proto.dispatchEvent=function dispatchEvent(e,type,skipPropagate){// Canvas should skip
|
|
9121
9288
|
if(!skipPropagate){e.propagationStopped=false;e.propagationImmediatelyStopped=false;this.propagate(e,type);}else {// target phase
|
|
@@ -9130,15 +9297,15 @@
|
|
|
9130
9297
|
// }
|
|
9131
9298
|
if(Node.isNode(target)&&target.parentNode){// [target, parent, parent, root]
|
|
9132
9299
|
propagationPath.push(target.parentNode);target=target.parentNode;}}if(canvas){// @ts-ignore
|
|
9133
|
-
propagationPath.push(canvas);}return propagationPath;};_proto.hitTest
|
|
9134
|
-
if(
|
|
9135
|
-
null;
|
|
9300
|
+
propagationPath.push(canvas);}return propagationPath;};_proto.hitTest=function hitTest(position){var viewportX=position.viewportX,viewportY=position.viewportY;var _this$context$config3=this.context.config,width=_this$context$config3.width,height=_this$context$config3.height;// outside canvas
|
|
9301
|
+
if(viewportX<0||viewportY<0||viewportX>width||viewportY>height){return null;}return this.pickHandler(position)||this.rootTarget||// return Document
|
|
9302
|
+
null;}/**
|
|
9136
9303
|
* whether the native event trigger came from Canvas,
|
|
9137
9304
|
* should account for HTML shape
|
|
9138
9305
|
*/;_proto.isNativeEventFromCanvas=function isNativeEventFromCanvas(event){var _event$nativeEvent;var $el=this.context.contextService.getDomElement();var target=(_event$nativeEvent=event.nativeEvent)===null||_event$nativeEvent===void 0?void 0:_event$nativeEvent.target;if(target){// from <canvas>
|
|
9139
9306
|
if(target===$el){return true;}// from <svg>
|
|
9140
9307
|
if($el&&$el.contains){return $el.contains(target);}}if(event.nativeEvent.composedPath){return event.nativeEvent.composedPath().indexOf($el)>-1;}// account for Touch
|
|
9141
|
-
return false;};_proto.getExistedHTML=function getExistedHTML(event){if(event.nativeEvent.composedPath){var htmls=this.globalRuntime.displayObjectPool.getHTMLs();for(var _iterator=_createForOfIteratorHelperLoose(htmls),_step;!(_step=_iterator()).done;){var html=_step.value;if(event.nativeEvent.composedPath().indexOf(html)>-1){return html;}}}return null;};_proto.pickTarget
|
|
9308
|
+
return false;};_proto.getExistedHTML=function getExistedHTML(event){if(event.nativeEvent.composedPath){var htmls=this.globalRuntime.displayObjectPool.getHTMLs();for(var _iterator=_createForOfIteratorHelperLoose(htmls),_step;!(_step=_iterator()).done;){var html=_step.value;if(event.nativeEvent.composedPath().indexOf(html)>-1){return html;}}}return null;};_proto.pickTarget=function pickTarget(event){return this.hitTest({clientX:event.clientX,clientY:event.clientY,viewportX:event.viewportX,viewportY:event.viewportY,x:event.canvasX,y:event.canvasY});};_proto.createPointerEvent=function createPointerEvent(from,type,target){var event=this.allocateEvent(FederatedPointerEvent);this.copyPointerData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.nativeEvent=from.nativeEvent;event.originalEvent=from;var existedHTML=this.getExistedHTML(event);event.target=target!==null&&target!==void 0?target:existedHTML||this.isNativeEventFromCanvas(event)&&this.pickTarget(event);if(typeof type==='string'){event.type=type;}return event;};_proto.createWheelEvent=function createWheelEvent(from){var event=this.allocateEvent(FederatedWheelEvent);this.copyWheelData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.nativeEvent=from.nativeEvent;event.originalEvent=from;var existedHTML=this.getExistedHTML(event);event.target=existedHTML||this.isNativeEventFromCanvas(event)&&this.pickTarget(event);return event;};_proto.trackingData=function trackingData(id){if(!this.mappingState.trackingData[id]){this.mappingState.trackingData[id]={pressTargetsByButton:{},clicksByButton:{},overTarget:null};}return this.mappingState.trackingData[id];};_proto.cloneWheelEvent=function cloneWheelEvent(from){var event=this.allocateEvent(FederatedWheelEvent);event.nativeEvent=from.nativeEvent;event.originalEvent=from.originalEvent;this.copyWheelData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.target=from.target;event.path=from.composedPath().slice();event.type=from.type;return event;};_proto.clonePointerEvent=function clonePointerEvent(from,type){var event=this.allocateEvent(FederatedPointerEvent);event.nativeEvent=from.nativeEvent;event.originalEvent=from.originalEvent;this.copyPointerData(from,event);this.copyMouseData(from,event);this.copyData(from,event);event.target=from.target;event.path=from.composedPath().slice();event.type=type!==null&&type!==void 0?type:event.type;return event;};_proto.copyPointerData=function copyPointerData(from,to){// if (
|
|
9142
9309
|
// !(
|
|
9143
9310
|
// from instanceof FederatedPointerEvent &&
|
|
9144
9311
|
// to instanceof FederatedPointerEvent
|
|
@@ -9183,7 +9350,9 @@
|
|
|
9183
9350
|
* total display objects in scenegraph
|
|
9184
9351
|
*/total:0,/**
|
|
9185
9352
|
* number of display objects need to render in current frame
|
|
9186
|
-
*/rendered:0};this.zIndexCounter=0
|
|
9353
|
+
*/rendered:0};this.zIndexCounter=0;/**
|
|
9354
|
+
* avoid re-creating too many custom events
|
|
9355
|
+
*/this.renderOrderChangedEvent=new CustomEvent(exports.ElementEvent.RENDER_ORDER_CHANGED);this.hooks={/**
|
|
9187
9356
|
* called before any frame rendered
|
|
9188
9357
|
*/init:new AsyncParallelHook(),/**
|
|
9189
9358
|
* only dirty object which has sth changed will be rendered
|
|
@@ -9203,9 +9372,9 @@
|
|
|
9203
9372
|
* Unsafe but sync version of pick.
|
|
9204
9373
|
*/pickSync:new SyncWaterfallHook(['result']),/**
|
|
9205
9374
|
* used in event system
|
|
9206
|
-
*/pointerDown:new SyncHook(['event']),pointerUp:new SyncHook(['event']),pointerMove:new SyncHook(['event']),pointerOut:new SyncHook(['event']),pointerOver:new SyncHook(['event']),pointerWheel:new SyncHook(['event']),pointerCancel:new SyncHook(['event'])};this.globalRuntime=globalRuntime;this.context=context;}var _proto=RenderingService.prototype;_proto.init=/*#__PURE__*/function(){var _init=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var context;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)
|
|
9375
|
+
*/pointerDown:new SyncHook(['event']),pointerUp:new SyncHook(['event']),pointerMove:new SyncHook(['event']),pointerOut:new SyncHook(['event']),pointerOver:new SyncHook(['event']),pointerWheel:new SyncHook(['event']),pointerCancel:new SyncHook(['event']),click:new SyncHook(['event'])};this.globalRuntime=globalRuntime;this.context=context;}var _proto=RenderingService.prototype;_proto.init=/*#__PURE__*/function(){var _init=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var context;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:context=_extends({},this.globalRuntime,this.context);// register rendering plugins
|
|
9207
9376
|
this.context.renderingPlugins.forEach(function(plugin){plugin.apply(context,runtime);});// await this.hooks.init.callPromise();
|
|
9208
|
-
_context.next=4;return this.hooks.init.promise();case 4:this.inited=true;case 5:case"end":return _context.stop();}}
|
|
9377
|
+
_context.next=4;return this.hooks.init.promise();case 4:this.inited=true;case 5:case"end":return _context.stop();}},_callee,this);}));function init(){return _init.apply(this,arguments);}return init;}();_proto.getStats=function getStats(){return this.stats;}/**
|
|
9209
9378
|
* Meet the following conditions:
|
|
9210
9379
|
* * disable DirtyRectangleRendering
|
|
9211
9380
|
* * camera changed
|
|
@@ -9239,7 +9408,40 @@
|
|
|
9239
9408
|
* update transform in scene graph
|
|
9240
9409
|
*
|
|
9241
9410
|
* @see https://community.khronos.org/t/scene-graphs/50542/7
|
|
9242
|
-
*/var DefaultSceneGraphService=/*#__PURE__*/function(){function DefaultSceneGraphService(runtime){var _this=this;this.runtime=void 0;this.pendingEvents=[];this.boundsChangedEvent=new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED)
|
|
9411
|
+
*/var DefaultSceneGraphService=/*#__PURE__*/function(){function DefaultSceneGraphService(runtime){var _this=this;this.runtime=void 0;this.pendingEvents=[];this.boundsChangedEvent=new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED);/**
|
|
9412
|
+
* rotate in world space
|
|
9413
|
+
*/this.rotate=function(){var parentInvertRotation=create$4();return function(element,degrees,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof degrees==='number'){degrees=fromValues$2(degrees,y,z);}var transform=element.transformable;if(element.parentNode===null||!element.parentNode.transformable){_this.rotateLocal(element,degrees);}else {var rotation=create$4();fromEuler(rotation,degrees[0],degrees[1],degrees[2]);var rot=_this.getRotation(element);var parentRot=_this.getRotation(element.parentNode);copy$3(parentInvertRotation,parentRot);invert$1(parentInvertRotation,parentInvertRotation);multiply$2(rotation,parentInvertRotation,rotation);multiply$2(transform.localRotation,rotation,rot);normalize$2(transform.localRotation,transform.localRotation);_this.dirtifyLocal(element,transform);}};}();/**
|
|
9414
|
+
* rotate in local space
|
|
9415
|
+
* @see @see https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-xmquaternionrotationrollpitchyaw
|
|
9416
|
+
*/this.rotateLocal=function(){var rotation=create$4();return function(element,degrees,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof degrees==='number'){degrees=fromValues$2(degrees,y,z);}var transform=element.transformable;fromEuler(rotation,degrees[0],degrees[1],degrees[2]);mul$1(transform.localRotation,transform.localRotation,rotation);_this.dirtifyLocal(element,transform);};}();/**
|
|
9417
|
+
* set euler angles(degrees) in world space
|
|
9418
|
+
*/this.setEulerAngles=function(){var invParentRot=create$4();return function(element,degrees,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof degrees==='number'){degrees=fromValues$2(degrees,y,z);}var transform=element.transformable;if(element.parentNode===null||!element.parentNode.transformable){_this.setLocalEulerAngles(element,degrees);}else {fromEuler(transform.localRotation,degrees[0],degrees[1],degrees[2]);var parentRotation=_this.getRotation(element.parentNode);copy$3(invParentRot,invert$1(create$4(),parentRotation));mul$1(transform.localRotation,transform.localRotation,invParentRot);_this.dirtifyLocal(element,transform);}};}();/**
|
|
9419
|
+
* translate in local space
|
|
9420
|
+
*
|
|
9421
|
+
* @example
|
|
9422
|
+
* ```
|
|
9423
|
+
* translateLocal(x, y, z)
|
|
9424
|
+
* translateLocal(vec3(x, y, z))
|
|
9425
|
+
* ```
|
|
9426
|
+
*/this.translateLocal=function(){return function(element,translation,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof translation==='number'){translation=fromValues$2(translation,y,z);}var transform=element.transformable;if(equals$1(translation,create$2())){return;}transformQuat(translation,translation,transform.localRotation);add$1(transform.localPosition,transform.localPosition,translation);_this.dirtifyLocal(element,transform);};}();/**
|
|
9427
|
+
* move to position in world space
|
|
9428
|
+
*
|
|
9429
|
+
* 对应 g 原版的 move/moveTo
|
|
9430
|
+
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L684-L689
|
|
9431
|
+
*/this.setPosition=function(){var parentInvertMatrix=create$1();var tmpPosition=create$2();return function(element,position){var transform=element.transformable;tmpPosition[0]=position[0];tmpPosition[1]=position[1];tmpPosition[2]=position[2]||0;if(equals$1(_this.getPosition(element),tmpPosition)){return;}copy$1(transform.position,tmpPosition);if(element.parentNode===null||!element.parentNode.transformable){copy$1(transform.localPosition,tmpPosition);}else {var parentTransform=element.parentNode.transformable;copy(parentInvertMatrix,parentTransform.worldTransform);invert(parentInvertMatrix,parentInvertMatrix);transformMat4(transform.localPosition,tmpPosition,parentInvertMatrix);}_this.dirtifyLocal(element,transform);};}();/**
|
|
9432
|
+
* move to position in local space
|
|
9433
|
+
*/this.setLocalPosition=function(){var tmpPosition=create$2();return function(element,position){var transform=element.transformable;tmpPosition[0]=position[0];tmpPosition[1]=position[1];tmpPosition[2]=position[2]||0;if(equals$1(transform.localPosition,tmpPosition)){return;}copy$1(transform.localPosition,tmpPosition);_this.dirtifyLocal(element,transform);};}();/**
|
|
9434
|
+
* translate in world space
|
|
9435
|
+
*
|
|
9436
|
+
* @example
|
|
9437
|
+
* ```
|
|
9438
|
+
* translate(x, y, z)
|
|
9439
|
+
* translate(vec3(x, y, z))
|
|
9440
|
+
* ```
|
|
9441
|
+
*
|
|
9442
|
+
* 对应 g 原版的 translate 2D
|
|
9443
|
+
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
|
|
9444
|
+
*/this.translate=function(){var zeroVec3=create$2();var tmpVec3=create$2();var tr=create$2();return function(element,translation,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof translation==='number'){translation=set$1(tmpVec3,translation,y,z);}if(equals$1(translation,zeroVec3)){return;}add$1(tr,_this.getPosition(element),translation);_this.setPosition(element,tr);};}();this.setRotation=function(){var parentInvertRotation=create$4();return function(element,rotation,y,z,w){var transform=element.transformable;if(typeof rotation==='number'){rotation=fromValues$4(rotation,y,z,w);}if(element.parentNode===null||!element.parentNode.transformable){_this.setLocalRotation(element,rotation);}else {var parentRot=_this.getRotation(element.parentNode);copy$3(parentInvertRotation,parentRot);invert$1(parentInvertRotation,parentInvertRotation);multiply$2(transform.localRotation,parentInvertRotation,rotation);normalize$2(transform.localRotation,transform.localRotation);_this.dirtifyLocal(element,transform);}};};this.displayObjectDependencyMap=new WeakMap();this.calcLocalTransform=function(){var tmpMat=create$1();var tmpPosition=create$2();var tmpQuat=fromValues$4(0,0,0,1);return function(transform){var hasSkew=transform.localSkew[0]!==0||transform.localSkew[1]!==0;if(hasSkew){fromRotationTranslationScaleOrigin(transform.localTransform,transform.localRotation,transform.localPosition,fromValues$2(1,1,1),transform.origin);// apply skew2D
|
|
9243
9445
|
if(transform.localSkew[0]!==0||transform.localSkew[1]!==0){var tmpMat4=identity(tmpMat);tmpMat4[4]=Math.tan(transform.localSkew[0]);tmpMat4[1]=Math.tan(transform.localSkew[1]);multiply(transform.localTransform,transform.localTransform,tmpMat4);}var scaling=fromRotationTranslationScaleOrigin(tmpMat,tmpQuat,tmpPosition,transform.localScale,transform.origin);multiply(transform.localTransform,transform.localTransform,scaling);}else {// @see https://github.com/mattdesl/css-mat4/blob/master/index.js
|
|
9244
9446
|
fromRotationTranslationScaleOrigin(transform.localTransform,transform.localRotation,transform.localPosition,transform.localScale,transform.origin);}};}();this.runtime=runtime;}var _proto=DefaultSceneGraphService.prototype;_proto.matches=function matches(query,root){return this.runtime.sceneGraphSelector.is(query,root);};_proto.querySelector=function querySelector(query,root){return this.runtime.sceneGraphSelector.selectOne(query,root);};_proto.querySelectorAll=function querySelectorAll(query,root){return this.runtime.sceneGraphSelector.selectAll(query,root);// .filter((node) => !node.shadow);
|
|
9245
9447
|
};_proto.attach=function attach(child,parent,index){var _sortable$sorted,_child$style;var detached=false;if(child.parentNode){detached=child.parentNode!==parent;this.detach(child);}child.parentNode=parent;if(!isNil(index)){child.parentNode.childNodes.splice(index,0,child);}else {child.parentNode.childNodes.push(child);}// parent needs re-sort
|
|
@@ -9262,32 +9464,11 @@
|
|
|
9262
9464
|
*/;_proto.setOrigin=function setOrigin(element,origin,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof origin==='number'){origin=[origin,y,z];}var transform=element.transformable;if(origin[0]===transform.origin[0]&&origin[1]===transform.origin[1]&&origin[2]===transform.origin[2]){return;}var originVec=transform.origin;// const delta = vec3.subtract(vec3.create(), origin, originVec);
|
|
9263
9465
|
// vec3.add(transform.localPosition, transform.localPosition, delta);
|
|
9264
9466
|
// update origin
|
|
9265
|
-
originVec[0]=origin[0];originVec[1]=origin[1];originVec[2]=origin[2]||0;this.dirtifyLocal(element,transform);}
|
|
9266
|
-
* rotate in world space
|
|
9267
|
-
*/;/**
|
|
9467
|
+
originVec[0]=origin[0];originVec[1]=origin[1];originVec[2]=origin[2]||0;this.dirtifyLocal(element,transform);};/**
|
|
9268
9468
|
* set euler angles(degrees) in local space
|
|
9269
|
-
*/_proto.setLocalEulerAngles=function setLocalEulerAngles(element,degrees,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof degrees==='number'){degrees=fromValues$2(degrees,y,z);}var transform=element.transformable;fromEuler(transform.localRotation,degrees[0],degrees[1],degrees[2]);this.dirtifyLocal(element,transform);}
|
|
9270
|
-
* translate in local space
|
|
9271
|
-
*
|
|
9272
|
-
* @example
|
|
9273
|
-
* ```
|
|
9274
|
-
* translateLocal(x, y, z)
|
|
9275
|
-
* translateLocal(vec3(x, y, z))
|
|
9276
|
-
* ```
|
|
9277
|
-
*/;/**
|
|
9469
|
+
*/_proto.setLocalEulerAngles=function setLocalEulerAngles(element,degrees,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(typeof degrees==='number'){degrees=fromValues$2(degrees,y,z);}var transform=element.transformable;fromEuler(transform.localRotation,degrees[0],degrees[1],degrees[2]);this.dirtifyLocal(element,transform);};/**
|
|
9278
9470
|
* scale in local space
|
|
9279
|
-
*/_proto.scaleLocal=function scaleLocal(element,scaling){var transform=element.transformable;multiply$1(transform.localScale,transform.localScale,fromValues$2(scaling[0],scaling[1],scaling[2]||1));this.dirtifyLocal(element,transform);};_proto.setLocalScale=function setLocalScale(element,scaling){var transform=element.transformable;var updatedScaling=fromValues$2(scaling[0],scaling[1],scaling[2]||transform.localScale[2]);if(equals$1(updatedScaling,transform.localScale)){return;}copy$1(transform.localScale,updatedScaling);this.dirtifyLocal(element,transform);}
|
|
9280
|
-
* translate in world space
|
|
9281
|
-
*
|
|
9282
|
-
* @example
|
|
9283
|
-
* ```
|
|
9284
|
-
* translate(x, y, z)
|
|
9285
|
-
* translate(vec3(x, y, z))
|
|
9286
|
-
* ```
|
|
9287
|
-
*
|
|
9288
|
-
* 对应 g 原版的 translate 2D
|
|
9289
|
-
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
|
|
9290
|
-
*/;_proto.setLocalRotation=function setLocalRotation(element,rotation,y,z,w){if(typeof rotation==='number'){rotation=fromValues$4(rotation,y,z,w);}var transform=element.transformable;copy$3(transform.localRotation,rotation);this.dirtifyLocal(element,transform);};_proto.setLocalSkew=function setLocalSkew(element,skew,y){if(typeof skew==='number'){skew=fromValues$5(skew,y);}var transform=element.transformable;copy$4(transform.localSkew,skew);this.dirtifyLocal(element,transform);};_proto.dirtifyLocal=function dirtifyLocal(element,transform){if(!transform.localDirtyFlag){transform.localDirtyFlag=true;if(!transform.dirtyFlag){this.dirtifyWorld(element,transform);}}};_proto.dirtifyWorld=function dirtifyWorld(element,transform){if(!transform.dirtyFlag){this.unfreezeParentToRoot(element);}this.dirtifyWorldInternal(element,transform);this.dirtifyToRoot(element,true);};_proto.triggerPendingEvents=function triggerPendingEvents(){var _this2=this;var set=new Set();var trigger=function trigger(element,detail){if(element.isConnected&&!set.has(element.entity)){_this2.boundsChangedEvent.detail=detail;_this2.boundsChangedEvent.target=element;if(element.isMutationObserved){element.dispatchEvent(_this2.boundsChangedEvent);}else {element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent,true);}set.add(element.entity);}};this.pendingEvents.forEach(function(_ref){var element=_ref[0],detail=_ref[1];if(detail.affectChildren){element.forEach(function(e){trigger(e,detail);});}else {trigger(element,detail);}});this.clearPendingEvents();set.clear();};_proto.clearPendingEvents=function clearPendingEvents(){this.pendingEvents=[];};_proto.dirtifyToRoot=function dirtifyToRoot(element,affectChildren){if(affectChildren===void 0){affectChildren=false;}var p=element;// only need to re-render itself
|
|
9471
|
+
*/_proto.scaleLocal=function scaleLocal(element,scaling){var transform=element.transformable;multiply$1(transform.localScale,transform.localScale,fromValues$2(scaling[0],scaling[1],scaling[2]||1));this.dirtifyLocal(element,transform);};_proto.setLocalScale=function setLocalScale(element,scaling){var transform=element.transformable;var updatedScaling=fromValues$2(scaling[0],scaling[1],scaling[2]||transform.localScale[2]);if(equals$1(updatedScaling,transform.localScale)){return;}copy$1(transform.localScale,updatedScaling);this.dirtifyLocal(element,transform);};_proto.setLocalRotation=function setLocalRotation(element,rotation,y,z,w){if(typeof rotation==='number'){rotation=fromValues$4(rotation,y,z,w);}var transform=element.transformable;copy$3(transform.localRotation,rotation);this.dirtifyLocal(element,transform);};_proto.setLocalSkew=function setLocalSkew(element,skew,y){if(typeof skew==='number'){skew=fromValues$5(skew,y);}var transform=element.transformable;copy$4(transform.localSkew,skew);this.dirtifyLocal(element,transform);};_proto.dirtifyLocal=function dirtifyLocal(element,transform){if(!transform.localDirtyFlag){transform.localDirtyFlag=true;if(!transform.dirtyFlag){this.dirtifyWorld(element,transform);}}};_proto.dirtifyWorld=function dirtifyWorld(element,transform){if(!transform.dirtyFlag){this.unfreezeParentToRoot(element);}this.dirtifyWorldInternal(element,transform);this.dirtifyToRoot(element,true);};_proto.triggerPendingEvents=function triggerPendingEvents(){var _this2=this;var set=new Set();var trigger=function trigger(element,detail){if(element.isConnected&&!set.has(element.entity)){_this2.boundsChangedEvent.detail=detail;_this2.boundsChangedEvent.target=element;if(element.isMutationObserved){element.dispatchEvent(_this2.boundsChangedEvent);}else {element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent,true);}set.add(element.entity);}};this.pendingEvents.forEach(function(_ref){var element=_ref[0],detail=_ref[1];if(detail.affectChildren){element.forEach(function(e){trigger(e,detail);});}else {trigger(element,detail);}});this.clearPendingEvents();set.clear();};_proto.clearPendingEvents=function clearPendingEvents(){this.pendingEvents=[];};_proto.dirtifyToRoot=function dirtifyToRoot(element,affectChildren){if(affectChildren===void 0){affectChildren=false;}var p=element;// only need to re-render itself
|
|
9291
9472
|
if(p.renderable){p.renderable.dirty=true;}while(p){markRenderableDirty(p);p=p.parentNode;}if(affectChildren){element.forEach(function(e){markRenderableDirty(e);});}// inform dependencies
|
|
9292
9473
|
this.informDependentDisplayObjects(element);// reuse the same custom event
|
|
9293
9474
|
this.pendingEvents.push([element,{affectChildren:affectChildren}]);};_proto.updateDisplayObjectDependency=function updateDisplayObjectDependency(name,oldPath,newPath,object){// clear ref to old clip path
|
|
@@ -9313,18 +9494,18 @@
|
|
|
9313
9494
|
// Refer from https://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages
|
|
9314
9495
|
var regexCannotStartZhCn=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/;var regexCannotEndZhCn=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/;var regexCannotStartZhTw=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/;var regexCannotEndZhTw=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/;var regexCannotStartJaJp=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/;var regexCannotEndJaJp=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/;var regexCannotStartKoKr=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/;var regexCannotEndKoKr=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/;var regexCannotStart=new RegExp(regexCannotStartZhCn.source+"|"+regexCannotStartZhTw.source+"|"+regexCannotStartJaJp.source+"|"+regexCannotStartKoKr.source);var regexCannotEnd=new RegExp(regexCannotEndZhCn.source+"|"+regexCannotEndZhTw.source+"|"+regexCannotEndJaJp.source+"|"+regexCannotEndKoKr.source);/**
|
|
9315
9496
|
* Borrow from pixi/packages/text/src/TextMetrics.ts
|
|
9316
|
-
*/var TextService=/*#__PURE__*/function(){function TextService(runtime){var _this=this;this.runtime=void 0
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9497
|
+
*/var TextService=/*#__PURE__*/function(){function TextService(runtime){var _this=this;this.runtime=void 0;/**
|
|
9498
|
+
* font metrics cache
|
|
9499
|
+
*/this.fontMetricsCache={};this.shouldBreakByKinsokuShorui=function(char,nextChar){if(_this.isBreakingSpace(nextChar))return false;if(char){// Line breaking rules in CJK (Kinsoku Shori)
|
|
9500
|
+
if(regexCannotEnd.exec(nextChar)||regexCannotStart.exec(char)){return true;}}return false;};this.trimByKinsokuShorui=function(prev){var next=[].concat(prev);var prevLine=next[next.length-2];if(!prevLine){return prev;}var lastChar=prevLine[prevLine.length-1];next[next.length-2]=prevLine.slice(0,-1);next[next.length-1]=lastChar+next[next.length-1];return next;};this.runtime=runtime;}var _proto=TextService.prototype;/**
|
|
9320
9501
|
* Calculates the ascent, descent and fontSize of a given font-style.
|
|
9321
9502
|
*/_proto.measureFont=function measureFont(font,offscreenCanvas){// as this method is used for preparing assets, don't recalculate things if we don't need to
|
|
9322
9503
|
if(this.fontMetricsCache[font]){return this.fontMetricsCache[font];}var properties={ascent:0,descent:0,fontSize:0};var canvas=this.runtime.offscreenCanvas.getOrCreateCanvas(offscreenCanvas);var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);context.font=font;var metricsString=TEXT_METRICS.MetricsString+TEXT_METRICS.BaselineSymbol;var width=Math.ceil(context.measureText(metricsString).width);var baseline=Math.ceil(context.measureText(TEXT_METRICS.BaselineSymbol).width);var height=TEXT_METRICS.HeightMultiplier*baseline;baseline=baseline*TEXT_METRICS.BaselineMultiplier|0;// @ts-ignore
|
|
9323
9504
|
canvas.width=width;// @ts-ignore
|
|
9324
9505
|
canvas.height=height;context.fillStyle='#f00';context.fillRect(0,0,width,height);context.font=font;context.textBaseline='alphabetic';context.fillStyle='#000';context.fillText(metricsString,0,baseline);var imagedata=context.getImageData(0,0,width||1,height||1).data;var pixels=imagedata.length;var line=width*4;var i=0;var idx=0;var stop=false;// ascent. scan from top to bottom until we find a non red pixel
|
|
9325
9506
|
for(i=0;i<baseline;++i){for(var j=0;j<line;j+=4){if(imagedata[idx+j]!==255){stop=true;break;}}if(!stop){idx+=line;}else {break;}}properties.ascent=baseline-i;idx=pixels-line;stop=false;// descent. scan from bottom to top until we find a non red pixel
|
|
9326
|
-
for(i=height;i>baseline;--i){for(var _j=0;_j<line;_j+=4){if(imagedata[idx+_j]!==255){stop=true;break;}}if(!stop){idx-=line;}else {break;}}properties.descent=i-baseline;properties.fontSize=properties.ascent+properties.descent;this.fontMetricsCache[font]=properties;return properties;};_proto.measureText=function measureText(text,parsedStyle,offscreenCanvas){var fontSize=parsedStyle.fontSize,wordWrap=parsedStyle.wordWrap,strokeHeight=parsedStyle.lineHeight,lineWidth=parsedStyle.lineWidth,textBaseline=parsedStyle.textBaseline,textAlign=parsedStyle.textAlign,letterSpacing=parsedStyle.letterSpacing,textPath=parsedStyle.textPath,textPathSide=parsedStyle.textPathSide,textPathStartOffset=parsedStyle.textPathStartOffset,_parsedStyle$leading=parsedStyle.leading,leading=_parsedStyle$leading===void 0?0:_parsedStyle$leading;var font=toFontString(parsedStyle)
|
|
9327
|
-
fontProperties=this.measureFont(font,offscreenCanvas);// fallback in case UA disallow canvas data extraction
|
|
9507
|
+
for(i=height;i>baseline;--i){for(var _j=0;_j<line;_j+=4){if(imagedata[idx+_j]!==255){stop=true;break;}}if(!stop){idx-=line;}else {break;}}properties.descent=i-baseline;properties.fontSize=properties.ascent+properties.descent;this.fontMetricsCache[font]=properties;return properties;};_proto.measureText=function measureText(text,parsedStyle,offscreenCanvas){var fontSize=parsedStyle.fontSize,wordWrap=parsedStyle.wordWrap,strokeHeight=parsedStyle.lineHeight,lineWidth=parsedStyle.lineWidth,textBaseline=parsedStyle.textBaseline,textAlign=parsedStyle.textAlign,letterSpacing=parsedStyle.letterSpacing,textPath=parsedStyle.textPath,textPathSide=parsedStyle.textPathSide,textPathStartOffset=parsedStyle.textPathStartOffset,_parsedStyle$leading=parsedStyle.leading,leading=_parsedStyle$leading===void 0?0:_parsedStyle$leading;var font=toFontString(parsedStyle);// if (runtime.enableCSSParsing) {
|
|
9508
|
+
var fontProperties=this.measureFont(font,offscreenCanvas);// fallback in case UA disallow canvas data extraction
|
|
9328
9509
|
// (toDataURI, getImageData functions)
|
|
9329
9510
|
if(fontProperties.fontSize===0){fontProperties.fontSize=fontSize;fontProperties.ascent=fontSize;}// } else {
|
|
9330
9511
|
// fontProperties = {
|
|
@@ -9405,11 +9586,11 @@
|
|
|
9405
9586
|
* @see https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/README.md
|
|
9406
9587
|
*
|
|
9407
9588
|
* also provide some extra events such as `drag`
|
|
9408
|
-
*/var EventPlugin=/*#__PURE__*/function(){function EventPlugin(){var _this=this;this.autoPreventDefault=false;this.rootPointerEvent=new FederatedPointerEvent(null);this.rootWheelEvent=new FederatedWheelEvent(null);this.context=void 0;this.onPointerMove=function(nativeEvent){var _this$context$renderi,_this$context$renderi2;var canvas=(_this$context$renderi=_this.context.renderingContext.root)===null||_this$context$renderi===void 0?void 0:(_this$context$renderi2=_this$context$renderi.ownerDocument)===null||_this$context$renderi2===void 0?void 0:_this$context$renderi2.defaultView;if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var normalizedEvents=_this.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator=_createForOfIteratorHelperLoose(normalizedEvents),_step;!(_step=_iterator()).done;){var normalizedEvent=_step.value;var event=_this.bootstrapEvent(_this.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this.context.eventService.mapEvent(event);}_this.setCursor(_this.context.eventService.cursor);};}var _proto=EventPlugin.prototype;_proto.apply=function apply(context){var _this2=this;this.context=context;var renderingService=context.renderingService;var canvas=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(
|
|
9409
|
-
})
|
|
9589
|
+
*/var EventPlugin=/*#__PURE__*/function(){function EventPlugin(){var _this=this;this.autoPreventDefault=false;this.rootPointerEvent=new FederatedPointerEvent(null);this.rootWheelEvent=new FederatedWheelEvent(null);this.context=void 0;this.onPointerMove=function(nativeEvent){var _this$context$renderi,_this$context$renderi2;var canvas=(_this$context$renderi=_this.context.renderingContext.root)===null||_this$context$renderi===void 0?void 0:(_this$context$renderi2=_this$context$renderi.ownerDocument)===null||_this$context$renderi2===void 0?void 0:_this$context$renderi2.defaultView;if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var normalizedEvents=_this.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator=_createForOfIteratorHelperLoose(normalizedEvents),_step;!(_step=_iterator()).done;){var normalizedEvent=_step.value;var event=_this.bootstrapEvent(_this.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this.context.eventService.mapEvent(event);}_this.setCursor(_this.context.eventService.cursor);};}var _proto=EventPlugin.prototype;_proto.apply=function apply(context){var _this2=this;this.context=context;var renderingService=context.renderingService;var canvas=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(position){var _this2$context$render=_this2.context.renderingService.hooks.pickSync.call({position:position,picked:[],topmost:true// we only concern the topmost element
|
|
9590
|
+
}),picked=_this2$context$render.picked;return picked[0]||null;});renderingService.hooks.pointerWheel.tap(EventPlugin.tag,function(nativeEvent){var wheelEvent=_this2.normalizeWheelEvent(nativeEvent);_this2.context.eventService.mapEvent(wheelEvent);});renderingService.hooks.pointerDown.tap(EventPlugin.tag,function(nativeEvent){if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var events=_this2.normalizeToPointerEvent(nativeEvent,canvas);if(_this2.autoPreventDefault&&events[0].isNormalized){var cancelable=nativeEvent.cancelable||!('cancelable'in nativeEvent);if(cancelable){nativeEvent.preventDefault();}}for(var _iterator2=_createForOfIteratorHelperLoose(events),_step2;!(_step2=_iterator2()).done;){var event=_step2.value;var federatedEvent=_this2.bootstrapEvent(_this2.rootPointerEvent,event,canvas,nativeEvent);_this2.context.eventService.mapEvent(federatedEvent);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerUp.tap(EventPlugin.tag,function(nativeEvent){if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;// account for element in SVG
|
|
9410
9591
|
var $element=_this2.context.contextService.getDomElement();var outside='outside';try{outside=$element&&nativeEvent.target&&nativeEvent.target!==$element&&$element.contains&&!$element.contains(nativeEvent.target)?'outside':'';}catch(e){// nativeEvent.target maybe not Node, such as Window
|
|
9411
9592
|
// @see https://github.com/antvis/G/issues/1235
|
|
9412
|
-
}var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator3=_createForOfIteratorHelperLoose(normalizedEvents),_step3;!(_step3=_iterator3()).done;){var normalizedEvent=_step3.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);event.type+=outside;_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerMove.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOver.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOut.tap(EventPlugin.tag,this.onPointerMove);};_proto.getViewportXY=function getViewportXY(nativeEvent){var x;var y;/**
|
|
9593
|
+
}var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator3=_createForOfIteratorHelperLoose(normalizedEvents),_step3;!(_step3=_iterator3()).done;){var normalizedEvent=_step3.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);event.type+=outside;_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerMove.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOver.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOut.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.click.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerCancel.tap(EventPlugin.tag,function(nativeEvent){var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator4=_createForOfIteratorHelperLoose(normalizedEvents),_step4;!(_step4=_iterator4()).done;){var normalizedEvent=_step4.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});};_proto.getViewportXY=function getViewportXY(nativeEvent){var x;var y;/**
|
|
9413
9594
|
* Should account for CSS Transform applied on container.
|
|
9414
9595
|
* @see https://github.com/antvis/G/issues/1161
|
|
9415
9596
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/offsetX
|
|
@@ -9445,11 +9626,13 @@
|
|
|
9445
9626
|
if(isShape2D&&(k===4||k===5)){continue;}// p-vertex n-vertex <-|plane p-vertex n-vertex
|
|
9446
9627
|
// 使用 p-vertex 和 n-vertex 加速,避免进行平面和 aabb 全部顶点的相交检测
|
|
9447
9628
|
var _planes$k=planes[k],normal=_planes$k.normal,distance=_planes$k.distance;if(dot(normal,aabb.getPositiveFarPoint(planes[k]))+distance<0){return exports.Mask.OUTSIDE;}if(dot(normal,aabb.getNegativeFarPoint(planes[k]))+distance<0){// 和当前面相交,对应位置为1,继续检测下一个面
|
|
9448
|
-
mask|=flag;}}return mask;};return FrustumCullingStrategy;}();var PrepareRendererPlugin=/*#__PURE__*/function(){function PrepareRendererPlugin(){this.rBush=void 0
|
|
9629
|
+
mask|=flag;}}return mask;};return FrustumCullingStrategy;}();var PrepareRendererPlugin=/*#__PURE__*/function(){function PrepareRendererPlugin(){this.rBush=void 0;/**
|
|
9630
|
+
* sync to RBush later
|
|
9631
|
+
*/this.toSync=new Set();}var _proto=PrepareRendererPlugin.prototype;// private isFirstTimeRendering = true;
|
|
9449
9632
|
// private syncing = false;
|
|
9450
9633
|
_proto.apply=function apply(context){var _this=this;var renderingService=context.renderingService,renderingContext=context.renderingContext,rBushRoot=context.rBushRoot;var canvas=renderingContext.root.ownerDocument.defaultView;this.rBush=rBushRoot;var handleAttributeChanged=function handleAttributeChanged(e){var object=e.target;object.renderable.dirty=true;renderingService.dirtify();};var handleBoundsChanged=function handleBoundsChanged(e){var affectChildren=e.detail.affectChildren;var object=e.target;if(affectChildren){object.forEach(function(node){_this.toSync.add(node);});}var p=object;while(p){if(p.renderable){_this.toSync.add(p);}p=p.parentElement;}// this.pushToSync(e.composedPath().slice(0, -2) as DisplayObject[]);
|
|
9451
9634
|
renderingService.dirtify();};var handleMounted=function handleMounted(e){var object=e.target;if(runtime.enableCSSParsing){// recalc style values
|
|
9452
|
-
runtime.styleValueRegistry.recalc(object);}runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};var handleUnmounted=function handleUnmounted(e){var object=e.target;var rBushNode=object.rBushNode;if(rBushNode.aabb){_this.rBush.remove(rBushNode.aabb);}_this.toSync.delete(object);runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};renderingService.hooks.init.tapPromise(PrepareRendererPlugin.tag,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)
|
|
9635
|
+
runtime.styleValueRegistry.recalc(object);}runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};var handleUnmounted=function handleUnmounted(e){var object=e.target;var rBushNode=object.rBushNode;if(rBushNode.aabb){_this.rBush.remove(rBushNode.aabb);}_this.toSync.delete(object);runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};renderingService.hooks.init.tapPromise(PrepareRendererPlugin.tag,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:canvas.addEventListener(exports.ElementEvent.MOUNTED,handleMounted);canvas.addEventListener(exports.ElementEvent.UNMOUNTED,handleUnmounted);canvas.addEventListener(exports.ElementEvent.ATTR_MODIFIED,handleAttributeChanged);canvas.addEventListener(exports.ElementEvent.BOUNDS_CHANGED,handleBoundsChanged);case 4:case"end":return _context.stop();}},_callee);})));renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag,function(){canvas.removeEventListener(exports.ElementEvent.MOUNTED,handleMounted);canvas.removeEventListener(exports.ElementEvent.UNMOUNTED,handleUnmounted);canvas.removeEventListener(exports.ElementEvent.ATTR_MODIFIED,handleAttributeChanged);canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED,handleBoundsChanged);_this.toSync.clear();});renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag,function(){// if (this.isFirstTimeRendering) {
|
|
9453
9636
|
// this.isFirstTimeRendering = false;
|
|
9454
9637
|
// this.syncing = true;
|
|
9455
9638
|
// // @see https://github.com/antvis/G/issues/1117
|
|
@@ -9506,7 +9689,7 @@
|
|
|
9506
9689
|
* rAF in auto rendering
|
|
9507
9690
|
*/function Canvas(config){var _this;_this=_EventTarget.call(this)||this;// create document
|
|
9508
9691
|
_this.document=void 0;_this.customElements=void 0;_this.requestAnimationFrame=void 0;_this.cancelAnimationFrame=void 0;_this.devicePixelRatio=void 0;_this.supportsPointerEvents=void 0;_this.supportsTouchEvents=void 0;_this.isTouchEvent=void 0;_this.isMouseEvent=void 0;_this.Element=DisplayObject;_this.frameId=void 0;_this.inited=false;_this.readyPromise=void 0;_this.resolveReadyPromise=void 0;_this.context={};_this.document=new Document();_this.document.defaultView=_assertThisInitialized(_this);// create registry of custom elements
|
|
9509
|
-
_this.customElements=new CustomElementRegistry();var container=config.container,canvas=config.canvas,offscreenCanvas=config.offscreenCanvas,width=config.width,height=config.height,devicePixelRatio=config.devicePixelRatio,renderer=config.renderer,background=config.background,cursor=config.cursor,document=config.document,requestAnimationFrame=config.requestAnimationFrame,cancelAnimationFrame=config.cancelAnimationFrame,createImage=config.createImage,supportsPointerEvents=config.supportsPointerEvents,supportsTouchEvents=config.supportsTouchEvents,supportsCSSTransform=config.supportsCSSTransform,isTouchEvent=config.isTouchEvent,isMouseEvent=config.isMouseEvent;cleanExistedCanvas(container,_assertThisInitialized(_this));var canvasWidth=width;var canvasHeight=height;var dpr=devicePixelRatio;// use user-defined <canvas> or OffscreenCanvas
|
|
9692
|
+
_this.customElements=new CustomElementRegistry();var container=config.container,canvas=config.canvas,offscreenCanvas=config.offscreenCanvas,width=config.width,height=config.height,devicePixelRatio=config.devicePixelRatio,renderer=config.renderer,background=config.background,cursor=config.cursor,document=config.document,requestAnimationFrame=config.requestAnimationFrame,cancelAnimationFrame=config.cancelAnimationFrame,createImage=config.createImage,supportsPointerEvents=config.supportsPointerEvents,supportsTouchEvents=config.supportsTouchEvents,supportsCSSTransform=config.supportsCSSTransform,useNativeClickEvent=config.useNativeClickEvent,isTouchEvent=config.isTouchEvent,isMouseEvent=config.isMouseEvent;cleanExistedCanvas(container,_assertThisInitialized(_this));var canvasWidth=width;var canvasHeight=height;var dpr=devicePixelRatio;// use user-defined <canvas> or OffscreenCanvas
|
|
9510
9693
|
if(canvas){// infer width & height with dpr
|
|
9511
9694
|
dpr=devicePixelRatio||isBrowser&&window.devicePixelRatio||1;dpr=dpr>=1?Math.ceil(dpr):1;canvasWidth=width||getWidth(canvas)||canvas.width/dpr;canvasHeight=height||getHeight(canvas)||canvas.height/dpr;}/**
|
|
9512
9695
|
* implements `Window` interface
|
|
@@ -9514,7 +9697,7 @@
|
|
|
9514
9697
|
* limits query
|
|
9515
9698
|
*/ // the following feature-detect from hammer.js
|
|
9516
9699
|
// @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
|
|
9517
|
-
_this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in runtime.globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!runtime.globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof runtime.globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !runtime.globalThis.MouseEvent||event instanceof runtime.globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof runtime.globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)
|
|
9700
|
+
_this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in runtime.globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!runtime.globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof runtime.globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !runtime.globalThis.MouseEvent||event instanceof runtime.globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof runtime.globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform,useNativeClickEvent:useNativeClickEvent});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){this.context.config=mergedConfig;// bind rendering context, shared by all renderers
|
|
9518
9701
|
this.context.renderingContext={/**
|
|
9519
9702
|
* the root node in scene graph
|
|
9520
9703
|
*/root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set(),force:false,dirty:false};};_proto.initDefaultCamera=function initDefaultCamera(width,height){var _this2=this;// set a default ortho camera
|
|
@@ -9554,7 +9737,7 @@
|
|
|
9554
9737
|
* But the canvas remains running which means display objects can be appended later.
|
|
9555
9738
|
*/;_proto.destroyChildren=function destroyChildren(){this.document.documentElement.destroyChildren();};_proto.render=function render(){var _this3=this;this.dispatchEvent(beforeRenderEvent);var renderingService=this.getRenderingService();renderingService.render(this.getConfig(),function(){// trigger actual rerender event
|
|
9556
9739
|
// @see https://github.com/antvis/G/issues/1268
|
|
9557
|
-
_this3.dispatchEvent(rerenderEvent);});this.dispatchEvent(afterRenderEvent);};_proto.run=function run(){var _this4=this;var tick=function tick(){_this4.render();_this4.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)
|
|
9740
|
+
_this3.dispatchEvent(rerenderEvent);});this.dispatchEvent(afterRenderEvent);};_proto.run=function run(){var _this4=this;var tick=function tick(){_this4.render();_this4.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
|
|
9558
9741
|
this.inited=false;this.readyPromise=undefined;// FIXME: should re-create here?
|
|
9559
9742
|
this.context.rBushRoot=new rbush();// reset rendering plugins
|
|
9560
9743
|
this.context.renderingPlugins=[];this.context.renderingPlugins.push(new EventPlugin(),new PrepareRendererPlugin(),new DirtyCheckPlugin(),new CullingPlugin([new FrustumCullingStrategy()]));//
|
|
@@ -9562,11 +9745,11 @@
|
|
|
9562
9745
|
this.context.contextService=new this.context.ContextService(_extends({},runtime,this.context));// init rendering service
|
|
9563
9746
|
this.context.renderingService=new RenderingService(runtime,this.context);// init event service
|
|
9564
9747
|
this.context.eventService=new EventService(runtime,this.context);this.context.eventService.init();_context2.next=14;return this.context.contextService.init();case 14:_context2.next=16;return this.context.renderingService.init();case 16:this.inited=true;this.getRoot().forEach(function(node){var renderable=node.renderable;if(renderable){renderable.renderBoundsDirty=true;renderable.boundsDirty=true;renderable.dirty=true;}});// keep current scenegraph unchanged, just trigger mounted event
|
|
9565
|
-
this.mountChildren(this.getRoot());if(renderer.getConfig().enableAutoRendering){this.run();}case 20:case"end":return _context2.stop();}}
|
|
9566
|
-
var plugins=renderer.getPlugins();plugins.forEach(function(plugin){plugin.context=_this5.context;plugin.init(runtime);});};_proto.setRenderer=/*#__PURE__*/function(){var _setRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer){var canvasConfig,oldRenderer;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)
|
|
9748
|
+
this.mountChildren(this.getRoot());if(renderer.getConfig().enableAutoRendering){this.run();}case 20:case"end":return _context2.stop();}},_callee2,this);}));function initRenderer(_x){return _initRenderer.apply(this,arguments);}return initRenderer;}();_proto.loadRendererContainerModule=function loadRendererContainerModule(renderer){var _this5=this;// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
9749
|
+
var plugins=renderer.getPlugins();plugins.forEach(function(plugin){plugin.context=_this5.context;plugin.init(runtime);});};_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
|
|
9567
9750
|
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
|
|
9568
9751
|
this.destroy(false,true);// destroy all plugins, reverse will mutate origin array
|
|
9569
|
-
[].concat(oldRenderer===null||oldRenderer===void 0?void 0:oldRenderer.getPlugins()).reverse().forEach(function(plugin){plugin.destroy(runtime);});_context3.next=9;return this.initRenderer(renderer);case 9:case"end":return _context3.stop();}}
|
|
9752
|
+
[].concat(oldRenderer===null||oldRenderer===void 0?void 0:oldRenderer.getPlugins()).reverse().forEach(function(plugin){plugin.destroy(runtime);});_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 _this6=this;// unmountChildren recursively
|
|
9570
9753
|
parent.childNodes.forEach(function(child){_this6.unmountChildren(child);});if(this.inited){if(parent.isMutationObserved){parent.dispatchEvent(unmountedEvent);}else {unmountedEvent.target=parent;this.dispatchEvent(unmountedEvent,true);}// skip document.documentElement
|
|
9571
9754
|
if(parent!==this.document.documentElement){parent.ownerDocument=null;}parent.isConnected=false;}// trigger after unmounted
|
|
9572
9755
|
if(parent.isCustomElement){if(parent.disconnectedCallback){parent.disconnectedCallback();}}};_proto.mountChildren=function mountChildren(parent){var _this7=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
|
|
@@ -9603,6 +9786,9 @@
|
|
|
9603
9786
|
args[_key] = arguments[_key];
|
|
9604
9787
|
}
|
|
9605
9788
|
_this = _Camera.call.apply(_Camera, [this].concat(args)) || this;
|
|
9789
|
+
/**
|
|
9790
|
+
* switch between multiple landmarks
|
|
9791
|
+
*/
|
|
9606
9792
|
_this.landmarks = [];
|
|
9607
9793
|
_this.landmarkAnimationID = void 0;
|
|
9608
9794
|
return _this;
|
|
@@ -10079,9 +10265,7 @@
|
|
|
10079
10265
|
if (!isNaN(iterable.length)) {
|
|
10080
10266
|
var i = -1,
|
|
10081
10267
|
next = function next() {
|
|
10082
|
-
for (; ++i < iterable.length;)
|
|
10083
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
10084
|
-
}
|
|
10268
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
10085
10269
|
return next.value = undefined, next.done = !0, next;
|
|
10086
10270
|
};
|
|
10087
10271
|
return next.next = next;
|
|
@@ -10127,9 +10311,7 @@
|
|
|
10127
10311
|
}), exports.keys = function (val) {
|
|
10128
10312
|
var object = Object(val),
|
|
10129
10313
|
keys = [];
|
|
10130
|
-
for (var key in object)
|
|
10131
|
-
keys.push(key);
|
|
10132
|
-
}
|
|
10314
|
+
for (var key in object) keys.push(key);
|
|
10133
10315
|
return keys.reverse(), function next() {
|
|
10134
10316
|
for (; keys.length;) {
|
|
10135
10317
|
var key = keys.pop();
|
|
@@ -10140,9 +10322,7 @@
|
|
|
10140
10322
|
}, exports.values = values, Context.prototype = {
|
|
10141
10323
|
constructor: Context,
|
|
10142
10324
|
reset: function reset(skipTempReset) {
|
|
10143
|
-
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)
|
|
10144
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
10145
|
-
}
|
|
10325
|
+
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);
|
|
10146
10326
|
},
|
|
10147
10327
|
stop: function stop() {
|
|
10148
10328
|
this.done = !0;
|
|
@@ -10484,18 +10664,16 @@
|
|
|
10484
10664
|
function () {
|
|
10485
10665
|
var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(rootNode, rootPageConstraints) {
|
|
10486
10666
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10487
|
-
while (1) {
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
return _context.stop();
|
|
10498
|
-
}
|
|
10667
|
+
while (1) switch (_context.prev = _context.next) {
|
|
10668
|
+
case 0:
|
|
10669
|
+
_context.next = 2;
|
|
10670
|
+
return this.determineIntrinsicSizes(rootNode, rootNode.children);
|
|
10671
|
+
case 2:
|
|
10672
|
+
_context.next = 4;
|
|
10673
|
+
return this.calculateLayout(rootNode, rootNode.children, rootPageConstraints);
|
|
10674
|
+
case 4:
|
|
10675
|
+
case "end":
|
|
10676
|
+
return _context.stop();
|
|
10499
10677
|
}
|
|
10500
10678
|
}, _callee, this);
|
|
10501
10679
|
}));
|
|
@@ -10513,12 +10691,10 @@
|
|
|
10513
10691
|
function () {
|
|
10514
10692
|
var _determineAllIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2(rootNode) {
|
|
10515
10693
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10516
|
-
while (1) {
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
return _context2.stop();
|
|
10521
|
-
}
|
|
10694
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
10695
|
+
case 0:
|
|
10696
|
+
case "end":
|
|
10697
|
+
return _context2.stop();
|
|
10522
10698
|
}
|
|
10523
10699
|
}, _callee2);
|
|
10524
10700
|
}));
|
|
@@ -10544,16 +10720,14 @@
|
|
|
10544
10720
|
var _determineIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3(node, childNodes) {
|
|
10545
10721
|
var layoutName;
|
|
10546
10722
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
10547
|
-
while (1) {
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
return _context3.stop();
|
|
10556
|
-
}
|
|
10723
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
10724
|
+
case 0:
|
|
10725
|
+
layoutName = this.getLayoutDefinitionName(node);
|
|
10726
|
+
_context3.next = 3;
|
|
10727
|
+
return this.invokeIntrinsicSizesCallback(layoutName, node, childNodes);
|
|
10728
|
+
case 3:
|
|
10729
|
+
case "end":
|
|
10730
|
+
return _context3.stop();
|
|
10557
10731
|
}
|
|
10558
10732
|
}, _callee3, this);
|
|
10559
10733
|
}));
|
|
@@ -10566,39 +10740,37 @@
|
|
|
10566
10740
|
var _invokeIntrinsicSizesCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4(layoutName, node, childNodes) {
|
|
10567
10741
|
var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope, inputProperties, children, edges, styleMap, value, generator, intrinsicSizesValue;
|
|
10568
10742
|
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
10569
|
-
while (1) {
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
node: childNode
|
|
10582
|
-
});
|
|
10583
|
-
children.push(layoutChild);
|
|
10584
|
-
});
|
|
10585
|
-
edges = this.layoutEdgesFactory({
|
|
10586
|
-
node: node
|
|
10743
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
10744
|
+
case 0:
|
|
10745
|
+
LayoutDef = this.layoutRegistry.getLayout(layoutName);
|
|
10746
|
+
layoutInstance = new LayoutDef();
|
|
10747
|
+
context = this.layoutContextFactory({
|
|
10748
|
+
mode: exports.LayoutTaskType.IntrinsicSizes
|
|
10749
|
+
});
|
|
10750
|
+
_LayoutDef$inputPrope = LayoutDef.inputProperties, inputProperties = _LayoutDef$inputPrope === void 0 ? [] : _LayoutDef$inputPrope;
|
|
10751
|
+
children = [];
|
|
10752
|
+
childNodes.forEach(function (childNode) {
|
|
10753
|
+
var layoutChild = context.layoutChildrenFactory({
|
|
10754
|
+
node: childNode
|
|
10587
10755
|
});
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10756
|
+
children.push(layoutChild);
|
|
10757
|
+
});
|
|
10758
|
+
edges = this.layoutEdgesFactory({
|
|
10759
|
+
node: node
|
|
10760
|
+
});
|
|
10761
|
+
styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children edges styleMap )
|
|
10762
|
+
value = layoutInstance.intrinsicSizes(children, edges, styleMap);
|
|
10763
|
+
generator = this.runWorkQueue(value, context.workQueue);
|
|
10764
|
+
generator.next();
|
|
10765
|
+
_context4.next = 13;
|
|
10766
|
+
return delay();
|
|
10767
|
+
case 13:
|
|
10768
|
+
intrinsicSizesValue = generator.next().value;
|
|
10769
|
+
context.clearWorkQueue();
|
|
10770
|
+
node.setIntrisicSizes(intrinsicSizesValue);
|
|
10771
|
+
case 16:
|
|
10772
|
+
case "end":
|
|
10773
|
+
return _context4.stop();
|
|
10602
10774
|
}
|
|
10603
10775
|
}, _callee4, this);
|
|
10604
10776
|
}));
|
|
@@ -10611,16 +10783,14 @@
|
|
|
10611
10783
|
var _calculateLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(node, childNodes, layoutConstraints) {
|
|
10612
10784
|
var layoutName;
|
|
10613
10785
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
10614
|
-
while (1) {
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
return _context5.stop();
|
|
10623
|
-
}
|
|
10786
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
10787
|
+
case 0:
|
|
10788
|
+
layoutName = this.getLayoutDefinitionName(node);
|
|
10789
|
+
_context5.next = 3;
|
|
10790
|
+
return this.invokeLayoutCallback(layoutName, node, childNodes, layoutConstraints);
|
|
10791
|
+
case 3:
|
|
10792
|
+
case "end":
|
|
10793
|
+
return _context5.stop();
|
|
10624
10794
|
}
|
|
10625
10795
|
}, _callee5, this);
|
|
10626
10796
|
}));
|
|
@@ -10633,48 +10803,46 @@
|
|
|
10633
10803
|
var _invokeLayoutCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6(layoutName, node, childNodes, layoutConstraints) {
|
|
10634
10804
|
var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope2, inputProperties, children, edges, styleMap, value, generator, fragmentResultvalue, fragmentResult, layoutFragment;
|
|
10635
10805
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10636
|
-
while (1) {
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
node: childNode
|
|
10649
|
-
});
|
|
10650
|
-
children.push(layoutChild);
|
|
10651
|
-
});
|
|
10652
|
-
edges = this.layoutEdgesFactory({
|
|
10653
|
-
node: node
|
|
10654
|
-
});
|
|
10655
|
-
styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children styleMap layoutConstraints )
|
|
10656
|
-
value = layoutInstance.layout(children, edges, layoutConstraints, styleMap);
|
|
10657
|
-
generator = this.runWorkQueue(value, context.workQueue);
|
|
10658
|
-
generator.next();
|
|
10659
|
-
_context6.next = 13;
|
|
10660
|
-
return delay();
|
|
10661
|
-
case 13:
|
|
10662
|
-
fragmentResultvalue = generator.next().value;
|
|
10663
|
-
context.clearWorkQueue();
|
|
10664
|
-
fragmentResult = fragmentResultvalue instanceof FragmentResult ? fragmentResultvalue : context.fragmentResultFactory(fragmentResultvalue);
|
|
10665
|
-
layoutFragment = context.layoutFragmentFactory({
|
|
10666
|
-
inlineSize: fragmentResult.inlineSize,
|
|
10667
|
-
blockSize: fragmentResult.blockSize,
|
|
10668
|
-
data: fragmentResult.data
|
|
10669
|
-
});
|
|
10670
|
-
node.setComputedLayout(layoutFragment);
|
|
10671
|
-
childNodes.forEach(function (childNode, index) {
|
|
10672
|
-
childNode.setComputedLayout(fragmentResult.childFragments[index]);
|
|
10806
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
10807
|
+
case 0:
|
|
10808
|
+
LayoutDef = this.layoutRegistry.getLayout(layoutName);
|
|
10809
|
+
layoutInstance = new LayoutDef();
|
|
10810
|
+
context = this.layoutContextFactory({
|
|
10811
|
+
mode: exports.LayoutTaskType.Layout
|
|
10812
|
+
});
|
|
10813
|
+
_LayoutDef$inputPrope2 = LayoutDef.inputProperties, inputProperties = _LayoutDef$inputPrope2 === void 0 ? [] : _LayoutDef$inputPrope2;
|
|
10814
|
+
children = [];
|
|
10815
|
+
childNodes.forEach(function (childNode) {
|
|
10816
|
+
var layoutChild = context.layoutChildrenFactory({
|
|
10817
|
+
node: childNode
|
|
10673
10818
|
});
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10819
|
+
children.push(layoutChild);
|
|
10820
|
+
});
|
|
10821
|
+
edges = this.layoutEdgesFactory({
|
|
10822
|
+
node: node
|
|
10823
|
+
});
|
|
10824
|
+
styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children styleMap layoutConstraints )
|
|
10825
|
+
value = layoutInstance.layout(children, edges, layoutConstraints, styleMap);
|
|
10826
|
+
generator = this.runWorkQueue(value, context.workQueue);
|
|
10827
|
+
generator.next();
|
|
10828
|
+
_context6.next = 13;
|
|
10829
|
+
return delay();
|
|
10830
|
+
case 13:
|
|
10831
|
+
fragmentResultvalue = generator.next().value;
|
|
10832
|
+
context.clearWorkQueue();
|
|
10833
|
+
fragmentResult = fragmentResultvalue instanceof FragmentResult ? fragmentResultvalue : context.fragmentResultFactory(fragmentResultvalue);
|
|
10834
|
+
layoutFragment = context.layoutFragmentFactory({
|
|
10835
|
+
inlineSize: fragmentResult.inlineSize,
|
|
10836
|
+
blockSize: fragmentResult.blockSize,
|
|
10837
|
+
data: fragmentResult.data
|
|
10838
|
+
});
|
|
10839
|
+
node.setComputedLayout(layoutFragment);
|
|
10840
|
+
childNodes.forEach(function (childNode, index) {
|
|
10841
|
+
childNode.setComputedLayout(fragmentResult.childFragments[index]);
|
|
10842
|
+
});
|
|
10843
|
+
case 19:
|
|
10844
|
+
case "end":
|
|
10845
|
+
return _context6.stop();
|
|
10678
10846
|
}
|
|
10679
10847
|
}, _callee6, this);
|
|
10680
10848
|
}));
|
|
@@ -10687,44 +10855,42 @@
|
|
|
10687
10855
|
var _this = this;
|
|
10688
10856
|
var querablePromise;
|
|
10689
10857
|
return _regeneratorRuntime$1().wrap(function runWorkQueue$(_context7) {
|
|
10690
|
-
while (1) {
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
return _context7.stop();
|
|
10727
|
-
}
|
|
10858
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
10859
|
+
case 0:
|
|
10860
|
+
querablePromise = makeQuerablePromise(promise);
|
|
10861
|
+
if (workQueue.length > 0 && querablePromise.isPending()) {
|
|
10862
|
+
workQueue.forEach(function (workTask) {
|
|
10863
|
+
if (workTask.taskType === exports.LayoutTaskType.IntrinsicSizes) {
|
|
10864
|
+
var layoutChild = workTask.layoutChild,
|
|
10865
|
+
deferred = workTask.deferred;
|
|
10866
|
+
var node = layoutChild.node;
|
|
10867
|
+
deferred.resolve(_this.getNodeIntrisicSizes(node));
|
|
10868
|
+
}
|
|
10869
|
+
if (workTask.taskType === exports.LayoutTaskType.Layout) {
|
|
10870
|
+
var _layoutChild = workTask.layoutChild,
|
|
10871
|
+
_deferred = workTask.deferred,
|
|
10872
|
+
layoutConstraints = workTask.layoutConstraints;
|
|
10873
|
+
var _node = _layoutChild.node,
|
|
10874
|
+
layoutContext = _layoutChild.layoutContext;
|
|
10875
|
+
var fragment = _this.getNodeFragment(_node, layoutConstraints);
|
|
10876
|
+
_deferred.resolve(layoutContext.layoutFragmentFactory(fragment));
|
|
10877
|
+
}
|
|
10878
|
+
});
|
|
10879
|
+
}
|
|
10880
|
+
// wait promise to resolve
|
|
10881
|
+
_context7.next = 4;
|
|
10882
|
+
return;
|
|
10883
|
+
case 4:
|
|
10884
|
+
if (querablePromise.isFulfilled()) {
|
|
10885
|
+
_context7.next = 6;
|
|
10886
|
+
break;
|
|
10887
|
+
}
|
|
10888
|
+
throw new Error('promise not fullfilled!');
|
|
10889
|
+
case 6:
|
|
10890
|
+
return _context7.abrupt("return", querablePromise.getFullFilledValue());
|
|
10891
|
+
case 7:
|
|
10892
|
+
case "end":
|
|
10893
|
+
return _context7.stop();
|
|
10728
10894
|
}
|
|
10729
10895
|
}, runWorkQueue);
|
|
10730
10896
|
});
|
|
@@ -10873,24 +11039,22 @@
|
|
|
10873
11039
|
var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
10874
11040
|
var size;
|
|
10875
11041
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10876
|
-
while (1) {
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
return _context.stop();
|
|
10893
|
-
}
|
|
11042
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11043
|
+
case 0:
|
|
11044
|
+
size = this.getSize();
|
|
11045
|
+
_context.next = 3;
|
|
11046
|
+
return layoutEngine.computeLayout(this, {
|
|
11047
|
+
availableInlineSize: size.width,
|
|
11048
|
+
availableBlockSize: size.height,
|
|
11049
|
+
fixedInlineSize: size.width,
|
|
11050
|
+
fixedBlockSize: size.height,
|
|
11051
|
+
percentageInlineSize: size.width,
|
|
11052
|
+
percentageBlockSize: size.height,
|
|
11053
|
+
data: undefined
|
|
11054
|
+
});
|
|
11055
|
+
case 3:
|
|
11056
|
+
case "end":
|
|
11057
|
+
return _context.stop();
|
|
10894
11058
|
}
|
|
10895
11059
|
}, _callee, this);
|
|
10896
11060
|
}));
|
|
@@ -10970,6 +11134,8 @@
|
|
|
10970
11134
|
}]);
|
|
10971
11135
|
return DefaultLayoutRegistry;
|
|
10972
11136
|
}();
|
|
11137
|
+
// 系统保留的布局名称,外部用户不能使用
|
|
11138
|
+
// private static reservedLayout = ['relative', 'absolute', 'fixed', 'flex', 'dagre', 'autolayout'];
|
|
10973
11139
|
DefaultLayoutRegistry.reservedLayout = [];
|
|
10974
11140
|
|
|
10975
11141
|
// import { LayoutEdges, LayoutEdgesOptions } from './LayoutEdges';
|
|
@@ -11518,25 +11684,60 @@
|
|
|
11518
11684
|
var Animation = /*#__PURE__*/function () {
|
|
11519
11685
|
function Animation(effect, timeline) {
|
|
11520
11686
|
var _this$effect;
|
|
11687
|
+
/**
|
|
11688
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/effect
|
|
11689
|
+
*/
|
|
11521
11690
|
this.effect = void 0;
|
|
11691
|
+
/**
|
|
11692
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/timeline
|
|
11693
|
+
*/
|
|
11522
11694
|
this.timeline = void 0;
|
|
11695
|
+
/**
|
|
11696
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/id
|
|
11697
|
+
*/
|
|
11523
11698
|
this.id = void 0;
|
|
11524
11699
|
this.currentTimePending = false;
|
|
11700
|
+
/**
|
|
11701
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/playState
|
|
11702
|
+
*/
|
|
11703
|
+
// playState: AnimationPlayState;
|
|
11525
11704
|
this._idle = true;
|
|
11526
11705
|
this._paused = false;
|
|
11527
11706
|
this._finishedFlag = true;
|
|
11707
|
+
/**
|
|
11708
|
+
* record previos state
|
|
11709
|
+
*/
|
|
11528
11710
|
this.oldPlayState = void 0;
|
|
11529
11711
|
this._holdTime = void 0;
|
|
11530
11712
|
this.readyPromise = void 0;
|
|
11531
11713
|
this.finishedPromise = void 0;
|
|
11714
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11532
11715
|
this.resolveReadyPromise = void 0;
|
|
11716
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11533
11717
|
this.rejectReadyPromise = void 0;
|
|
11718
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11534
11719
|
this.resolveFinishedPromise = void 0;
|
|
11720
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11535
11721
|
this.rejectFinishedPromise = void 0;
|
|
11722
|
+
/**
|
|
11723
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish
|
|
11724
|
+
*/
|
|
11536
11725
|
this.onfinish = void 0;
|
|
11726
|
+
/**
|
|
11727
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/oncancel
|
|
11728
|
+
*/
|
|
11537
11729
|
this.oncancel = void 0;
|
|
11730
|
+
/**
|
|
11731
|
+
* get called after each frame when running
|
|
11732
|
+
*/
|
|
11538
11733
|
this.onframe = void 0;
|
|
11734
|
+
/**
|
|
11735
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/currentTime
|
|
11736
|
+
*/
|
|
11539
11737
|
this._currentTime = 0;
|
|
11738
|
+
/**
|
|
11739
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime
|
|
11740
|
+
*/
|
|
11540
11741
|
this._startTime = void 0;
|
|
11541
11742
|
this._playbackRate = 1;
|
|
11542
11743
|
this._totalDuration = void 0;
|
|
@@ -11764,18 +11965,6 @@
|
|
|
11764
11965
|
_createClass$2(Animation, [{
|
|
11765
11966
|
key: "pending",
|
|
11766
11967
|
get:
|
|
11767
|
-
/**
|
|
11768
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/effect
|
|
11769
|
-
*/
|
|
11770
|
-
|
|
11771
|
-
/**
|
|
11772
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/timeline
|
|
11773
|
-
*/
|
|
11774
|
-
|
|
11775
|
-
/**
|
|
11776
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/id
|
|
11777
|
-
*/
|
|
11778
|
-
|
|
11779
11968
|
// animation: InternalAnimation | null;
|
|
11780
11969
|
/**
|
|
11781
11970
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/pending
|
|
@@ -11791,9 +11980,6 @@
|
|
|
11791
11980
|
if (this._paused) return 'paused';
|
|
11792
11981
|
return 'running';
|
|
11793
11982
|
}
|
|
11794
|
-
/**
|
|
11795
|
-
* record previos state
|
|
11796
|
-
*/
|
|
11797
11983
|
}, {
|
|
11798
11984
|
key: "ready",
|
|
11799
11985
|
get:
|
|
@@ -11864,9 +12050,6 @@
|
|
|
11864
12050
|
}
|
|
11865
12051
|
return this.finishedPromise;
|
|
11866
12052
|
}
|
|
11867
|
-
/**
|
|
11868
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish
|
|
11869
|
-
*/
|
|
11870
12053
|
}, {
|
|
11871
12054
|
key: "currentTime",
|
|
11872
12055
|
get: function get() {
|
|
@@ -11892,9 +12075,6 @@
|
|
|
11892
12075
|
this.tickCurrentTime(newTime, true);
|
|
11893
12076
|
this.timeline.applyDirtiedAnimation(this);
|
|
11894
12077
|
}
|
|
11895
|
-
/**
|
|
11896
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime
|
|
11897
|
-
*/
|
|
11898
12078
|
}, {
|
|
11899
12079
|
key: "startTime",
|
|
11900
12080
|
get: function get() {
|
|
@@ -12019,9 +12199,7 @@
|
|
|
12019
12199
|
var intervalStart = 0.0;
|
|
12020
12200
|
var currentSample = 1;
|
|
12021
12201
|
var lastSample = kSplineTableSize - 1;
|
|
12022
|
-
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample)
|
|
12023
|
-
intervalStart += kSampleStepSize;
|
|
12024
|
-
}
|
|
12202
|
+
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) intervalStart += kSampleStepSize;
|
|
12025
12203
|
--currentSample;
|
|
12026
12204
|
// Interpolate to provide an initial guess for t
|
|
12027
12205
|
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
@@ -12492,11 +12670,9 @@
|
|
|
12492
12670
|
// }
|
|
12493
12671
|
});
|
|
12494
12672
|
} else {
|
|
12495
|
-
for (var property in propertySpecificKeyframeGroups) {
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
target.setAttribute(property, null);
|
|
12499
|
-
}
|
|
12673
|
+
for (var property in propertySpecificKeyframeGroups) if (isNotReservedWord(property)) {
|
|
12674
|
+
// clear attribute
|
|
12675
|
+
target.setAttribute(property, null);
|
|
12500
12676
|
}
|
|
12501
12677
|
}
|
|
12502
12678
|
};
|
|
@@ -12643,18 +12819,52 @@
|
|
|
12643
12819
|
*/
|
|
12644
12820
|
var AnimationEffectTiming = /*#__PURE__*/function () {
|
|
12645
12821
|
function AnimationEffectTiming() {
|
|
12822
|
+
/**
|
|
12823
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/delay
|
|
12824
|
+
*/
|
|
12646
12825
|
this.delay = 0;
|
|
12826
|
+
/**
|
|
12827
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/direction
|
|
12828
|
+
*/
|
|
12647
12829
|
this.direction = 'normal';
|
|
12830
|
+
/**
|
|
12831
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/duration
|
|
12832
|
+
*/
|
|
12648
12833
|
this.duration = 'auto';
|
|
12834
|
+
/**
|
|
12835
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/easing
|
|
12836
|
+
*/
|
|
12649
12837
|
this._easing = 'linear';
|
|
12650
12838
|
this.easingFunction = linear;
|
|
12839
|
+
/**
|
|
12840
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/endDelay
|
|
12841
|
+
*/
|
|
12651
12842
|
this.endDelay = 0;
|
|
12843
|
+
/**
|
|
12844
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill
|
|
12845
|
+
*/
|
|
12652
12846
|
this.fill = 'auto';
|
|
12847
|
+
/**
|
|
12848
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/iterationStart
|
|
12849
|
+
*/
|
|
12653
12850
|
this.iterationStart = 0;
|
|
12851
|
+
/**
|
|
12852
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/iterations
|
|
12853
|
+
*/
|
|
12654
12854
|
this.iterations = 1;
|
|
12855
|
+
/**
|
|
12856
|
+
* @deprecated
|
|
12857
|
+
*/
|
|
12655
12858
|
this.playbackRate = void 0;
|
|
12859
|
+
/**
|
|
12860
|
+
* ref to effect
|
|
12861
|
+
*/
|
|
12656
12862
|
this.effect = void 0;
|
|
12657
12863
|
this.composite = void 0;
|
|
12864
|
+
/**
|
|
12865
|
+
* ComputedEffectTiming
|
|
12866
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getComputedTiming
|
|
12867
|
+
*/
|
|
12658
12868
|
this.activeDuration = void 0;
|
|
12659
12869
|
this.endTime = void 0;
|
|
12660
12870
|
this.currentIteration = null;
|
|
@@ -12669,11 +12879,7 @@
|
|
|
12669
12879
|
this.easingFunction = parseEasingFunction(value);
|
|
12670
12880
|
this._easing = value;
|
|
12671
12881
|
}
|
|
12672
|
-
/**
|
|
12673
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/endDelay
|
|
12674
|
-
*/
|
|
12675
12882
|
}]);
|
|
12676
|
-
|
|
12677
12883
|
return AnimationEffectTiming;
|
|
12678
12884
|
}();
|
|
12679
12885
|
|
|
@@ -12804,9 +13010,7 @@
|
|
|
12804
13010
|
for (var _i = 1; _i < length; _i++) {
|
|
12805
13011
|
var _offset = keyframes[_i].computedOffset;
|
|
12806
13012
|
if (!isNil(_offset) && !isNil(previousOffset)) {
|
|
12807
|
-
for (var j = 1; j < _i - previousIndex; j++)
|
|
12808
|
-
keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
|
|
12809
|
-
}
|
|
13013
|
+
for (var j = 1; j < _i - previousIndex; j++) keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
|
|
12810
13014
|
previousIndex = _i;
|
|
12811
13015
|
previousOffset = Number(_offset);
|
|
12812
13016
|
}
|