gl-draw 0.1.2 → 0.1.5

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.
@@ -1 +1 @@
1
- import*as z from"three";import*as Y from"idb-keyval";var Q={666:function(h){var s=function(o){"use strict";var _=Object.prototype,u=_.hasOwnProperty,n,r=typeof Symbol=="function"?Symbol:{},i=r.iterator||"@@iterator",c=r.asyncIterator||"@@asyncIterator",d=r.toStringTag||"@@toStringTag";function v(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{v({},"")}catch(e){v=function(t,a,l){return t[a]=l}}function w(e,t,a,l){var f=t&&t.prototype instanceof S?t:S,P=Object.create(f.prototype),C=new R(l||[]);return P._invoke=E(e,a,C),P}o.wrap=w;function L(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(l){return{type:"throw",arg:l}}}var T="suspendedStart",I="suspendedYield",K="executing",G="completed",M={};function S(){}function B(){}function U(){}var X={};v(X,i,function(){return this});var x=Object.getPrototypeOf,k=x&&x(x(V([])));k&&k!==_&&u.call(k,i)&&(X=k);var y=U.prototype=S.prototype=Object.create(X);B.prototype=U,v(y,"constructor",U),v(U,"constructor",B),B.displayName=v(U,d,"GeneratorFunction");function m(e){["next","throw","return"].forEach(function(t){v(e,t,function(a){return this._invoke(t,a)})})}o.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===B||(t.displayName||t.name)==="GeneratorFunction":!1},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,U):(e.__proto__=U,v(e,d,"GeneratorFunction")),e.prototype=Object.create(y),e},o.awrap=function(e){return{__await:e}};function p(e,t){function a(P,C,A,D){var Z=L(e[P],e,C);if(Z.type==="throw")D(Z.arg);else{var F=Z.arg,$=F.value;return $&&typeof $=="object"&&u.call($,"__await")?t.resolve($.__await).then(function(W){a("next",W,A,D)},function(W){a("throw",W,A,D)}):t.resolve($).then(function(W){F.value=W,A(F)},function(W){return a("throw",W,A,D)})}}var l;function f(P,C){function A(){return new t(function(D,Z){a(P,C,D,Z)})}return l=l?l.then(A,A):A()}this._invoke=f}m(p.prototype),v(p.prototype,c,function(){return this}),o.AsyncIterator=p,o.async=function(e,t,a,l,f){f===void 0&&(f=Promise);var P=new p(w(e,t,a,l),f);return o.isGeneratorFunction(t)?P:P.next().then(function(C){return C.done?C.value:P.next()})};function E(e,t,a){var l=T;return function(P,C){if(l===K)throw new Error("Generator is already running");if(l===G){if(P==="throw")throw C;return J()}for(a.method=P,a.arg=C;;){var A=a.delegate;if(A){var D=O(A,a);if(D){if(D===M)continue;return D}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(l===T)throw l=G,a.arg;a.dispatchException(a.arg)}else a.method==="return"&&a.abrupt("return",a.arg);l=K;var Z=L(e,t,a);if(Z.type==="normal"){if(l=a.done?G:I,Z.arg===M)continue;return{value:Z.arg,done:a.done}}else Z.type==="throw"&&(l=G,a.method="throw",a.arg=Z.arg)}}}function O(e,t){var a=e.iterator[t.method];if(a===n){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=n,O(e,t),t.method==="throw"))return M;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return M}var l=L(a,e.iterator,t.arg);if(l.type==="throw")return t.method="throw",t.arg=l.arg,t.delegate=null,M;var f=l.arg;if(!f)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,M;if(f.done)t[e.resultName]=f.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=n);else return f;return t.delegate=null,M}m(y),v(y,d,"Generator"),v(y,i,function(){return this}),v(y,"toString",function(){return"[object Generator]"});function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}o.keys=function(e){var t=[];for(var a in e)t.push(a);return t.reverse(),function l(){for(;t.length;){var f=t.pop();if(f in e)return l.value=f,l.done=!1,l}return l.done=!0,l}};function V(e){if(e){var t=e[i];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var a=-1,l=function f(){for(;++a<e.length;)if(u.call(e,a))return f.value=e[a],f.done=!1,f;return f.value=n,f.done=!0,f};return l.next=l}}return{next:J}}o.values=V;function J(){return{value:n,done:!0}}return R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(b),!e)for(var t in this)t.charAt(0)==="t"&&u.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function a(D,Z){return P.type="throw",P.arg=e,t.next=D,Z&&(t.method="next",t.arg=n),!!Z}for(var l=this.tryEntries.length-1;l>=0;--l){var f=this.tryEntries[l],P=f.completion;if(f.tryLoc==="root")return a("end");if(f.tryLoc<=this.prev){var C=u.call(f,"catchLoc"),A=u.call(f,"finallyLoc");if(C&&A){if(this.prev<f.catchLoc)return a(f.catchLoc,!0);if(this.prev<f.finallyLoc)return a(f.finallyLoc)}else if(C){if(this.prev<f.catchLoc)return a(f.catchLoc,!0)}else if(A){if(this.prev<f.finallyLoc)return a(f.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a];if(l.tryLoc<=this.prev&&u.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var f=l;break}}f&&(e==="break"||e==="continue")&&f.tryLoc<=t&&t<=f.finallyLoc&&(f=null);var P=f?f.completion:{};return P.type=e,P.arg=t,f?(this.method="next",this.next=f.finallyLoc,M):this.complete(P)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),M},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),b(a),M}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var l=a.completion;if(l.type==="throw"){var f=l.arg;b(a)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,a){return this.delegate={iterator:V(e),resultName:t,nextLoc:a},this.method==="next"&&(this.arg=n),M}},o}(h.exports);try{regeneratorRuntime=s}catch(o){typeof globalThis=="object"?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}},182:function(h,s,o){o.d(s,{Z:function(){return _}});function _(u){if(u.geometry&&u.geometry.dispose(),u.material){var n=Array.isArray(u.material)?u.material:[u.material];n.forEach(function(r){var i,c,d,v,w,L,T,I,K,G,M,S,B;(i=r.map)===null||i===void 0||i.dispose(),(c=r.lightMap)===null||c===void 0||c.dispose(),(d=r.bumpMap)===null||d===void 0||d.dispose(),(v=r.normalMap)===null||v===void 0||v.dispose(),(w=r.specularMap)===null||w===void 0||w.dispose(),(L=r.envMap)===null||L===void 0||L.dispose(),(T=r.alphaMap)===null||T===void 0||T.dispose(),(I=r.aoMap)===null||I===void 0||I.dispose(),(K=r.displacementMap)===null||K===void 0||K.dispose(),(G=r.emissiveMap)===null||G===void 0||G.dispose(),(M=r.gradientMap)===null||M===void 0||M.dispose(),(S=r.metalnessMap)===null||S===void 0||S.dispose(),(B=r.roughnessMap)===null||B===void 0||B.dispose(),r.dispose()})}}},794:function(h,s,o){o.d(s,{U:function(){return u},v:function(){return _}});var _=function(n){for(var r=n.offsetLeft,i=n.offsetParent;i!==null;)r+=i.offsetLeft,i=i.offsetParent;var c;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?c=document.body.scrollLeft:c=document.documentElement.scrollLeft,r-c},u=function(n){for(var r=n.offsetTop,i=n.offsetParent;i!==null;)r+=i.offsetTop,i=i.offsetParent;var c;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?c=document.body.scrollTop:c=document.documentElement.scrollTop,r-c}},975:function(h,s,o){o.d(s,{Z:function(){return u}});function _(n){return Object.prototype.toString.call(n)==="[object Object]"}function u(n){if(_(n)===!1)return!1;var r=n.constructor;if(r===void 0)return!0;var i=r.prototype;return!(_(i)===!1||i.hasOwnProperty("isPrototypeOf")===!1)}},653:function(h,s,o){o.d(s,{Z:function(){return u}});var _=o(620);function u(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i={};return i.promise=new Promise(function(c,d){i.resolve=c,i.reject=d}),n&&(i.promise=(0,_.Z)(i.promise,r)),i}},226:function(h,s,o){o.d(s,{Z:function(){return _}});function _(u,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=(90-n)*Math.PI/180,c=(90-u)*Math.PI/180;return[r*Math.sin(i)*Math.cos(c),r*Math.cos(i),r*Math.sin(i)*Math.sin(c)]}},688:function(h,s,o){o.d(s,{Z:function(){return n}});var _=o(438),u=function(){"use strict";function r(c){(0,_.Z)(this,r),this.onTick_=c,this.cancelPending_=null}var i=r.prototype;return i.tickAfter=function(d){var v=this;this.stop();var w=!0,L;this.cancelPending_=function(){clearTimeout(L),w=!1};var T=function(){w&&v.onTick_()};return L=window.setTimeout(T,d),this},i.stop=function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)},r}(),n=function(){"use strict";function r(c){(0,_.Z)(this,r),this.onTick_=c,this.ticker_=null}var i=r.prototype;return i.tickNow=function(){return this.stop(),this.onTick_(),this},i.tickAfter=function(d){var v=this;return this.stop(),this.ticker_=new u(function(){v.onTick_()}).tickAfter(d),this},i.tickEvery=function(d){var v=this;return this.stop(),this.ticker_=new u(function(){var w;(w=v.ticker_)===null||w===void 0||w.tickAfter(d),v.onTick_()}).tickAfter(d),this},i.stop=function(){this.ticker_&&(this.ticker_.stop(),this.ticker_=null)},r}()},620:function(h,s,o){o.d(s,{Z:function(){return u}});var _=o(42);function u(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n.then(function(i){return(0,_.Z)({err:null,res:i},r)}).catch(function(i){return(0,_.Z)({err:i,res:void 0},r)})}},949:function(h,s,o){var _=n=>{var r={};return o.d(r,n),r},u=n=>()=>n;h.exports=_({sRGBEncoding:()=>z.sRGBEncoding})},943:function(h,s,o){o.d(s,{Z:function(){return _}});function _(u,n){(n==null||n>u.length)&&(n=u.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=u[r];return i}},982:function(h,s,o){o.d(s,{Z:function(){return u}});var _=o(943);function u(n){if(Array.isArray(n))return(0,_.Z)(n)}},568:function(h,s,o){o.d(s,{Z:function(){return u}});function _(n,r,i,c,d,v,w){try{var L=n[v](w),T=L.value}catch(I){i(I);return}L.done?r(T):Promise.resolve(T).then(c,d)}function u(n){return function(){var r=this,i=arguments;return new Promise(function(c,d){var v=n.apply(r,i);function w(T){_(v,c,d,w,L,"next",T)}function L(T){_(v,c,d,w,L,"throw",T)}w(void 0)})}}},438:function(h,s,o){o.d(s,{Z:function(){return _}});function _(u,n){if(!(u instanceof n))throw new TypeError("Cannot call a class as a function")}},924:function(h,s,o){o.d(s,{Z:function(){return _}});function _(u,n,r){return n in u?Object.defineProperty(u,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):u[n]=r,u}},375:function(h,s,o){o.d(s,{Z:function(){return _}});function _(u){if(typeof Symbol!="undefined"&&u[Symbol.iterator]!=null||u["@@iterator"]!=null)return Array.from(u)}},270:function(h,s,o){o.d(s,{Z:function(){return _}});function _(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},42:function(h,s,o){o.d(s,{Z:function(){return u}});var _=o(924);function u(n){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{},c=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(c=c.concat(Object.getOwnPropertySymbols(i).filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable}))),c.forEach(function(d){(0,_.Z)(n,d,i[d])})}return n}},342:function(h,s,o){o.d(s,{Z:function(){return i}});var _=o(982),u=o(375),n=o(270),r=o(566);function i(c){return(0,_.Z)(c)||(0,u.Z)(c)||(0,r.Z)(c)||(0,n.Z)()}},566:function(h,s,o){o.d(s,{Z:function(){return u}});var _=o(943);function u(n,r){if(!!n){if(typeof n=="string")return(0,_.Z)(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return(0,_.Z)(n,r)}}}},H={};function g(h){var s=H[h];if(s!==void 0)return s.exports;var o=H[h]={exports:{}};return Q[h](o,o.exports,g),o.exports}(function(){g.n=function(h){var s=h&&h.__esModule?function(){return h.default}:function(){return h};return g.d(s,{a:s}),s}})(),function(){g.d=function(h,s){for(var o in s)g.o(s,o)&&!g.o(h,o)&&Object.defineProperty(h,o,{enumerable:!0,get:s[o]})}}(),function(){g.o=function(h,s){return Object.prototype.hasOwnProperty.call(h,s)}}();var j={};(function(){g.d(j,{qo:function(){return d},B7:function(){return o.Z},eK:function(){return U},LK:function(){return B},ZL:function(){return T},wf:function(){return w.Z},lJ:function(){return X},vP:function(){return x.v},Up:function(){return x.U},PO:function(){return I.Z},Mf:function(){return h.Z},Rl:function(){return v.Z},to:function(){return s.Z}});var h=g(653),s=g(620),o=g(688),_=g(568),u=g(438),n=g(42),r=g(342),i=g(666),c=g.n(i),d=function(){"use strict";function k(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,u.Z)(this,k),this.index=0,this.repeatCount=0,this.repeatNum=0,this.isPlaying=!1,this.chainedList=[],this.children=[],this.options=(0,n.Z)({},{isdev:!1},m)}var y=k.prototype;return y.start=function(){return this.isPlaying?this:(this.index=0,this.isPlaying=!0,this.play())},y.stop1=function(){return this.isPlaying?(this.isPlaying=!1,this.repeatCount=0,this):this},y.stop=function(){return this.traverse(function(p){return p.stop1()}),this},y.dispose=function(){return this.stop(),this.chainedList=[],this.children=[],this},y.play=function(){var p=this;return(0,_.Z)(c().mark(function E(){var O;return c().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(O=p.chainedList[p.index],!(O&&p.isPlaying)){b.next=9;break}return b.next=4,Promise.all(O.map(function(R){return typeof R=="function"?R(p.repeatCount):R.start()}));case 4:return p.index+=1,b.next=7,p.play();case 7:b.next=17;break;case 9:if(!(!O&&p.isPlaying&&p.repeatCount<p.repeatNum)){b.next=16;break}return p.repeatCount+=1,p.index=0,b.next=14,p.play();case 14:b.next=17;break;case 16:!O&&p.isPlaying&&p.repeatCount===p.repeatNum&&p.stop();case 17:case"end":return b.stop()}},E)}))()},y.chain=function(){for(var p=arguments.length,E=new Array(p),O=0;O<p;O++)E[O]=arguments[O];var N=this;return(0,r.Z)(E).forEach(function(b){b instanceof k&&N.children.push(b)}),this.chainedList.push((0,r.Z)(E)),this},y.repeat=function(p){return this.repeatNum=p,this},y.timeout=function(p){return this.chain(function(){return new Promise(function(E){return setTimeout(E,p)})}),this},y.traverse=function(p){p(this),this.children.forEach(function(E){E.traverse(p)})},k}(),v=g(226),w=g(182),L=g(949);function T(k){if(k.material){var y=Array.isArray(k.material)?k.material:[k.material];y.forEach(function(m){var p,E;(p=m.color)===null||p===void 0||p.convertSRGBToLinear(),(E=m.emissive)===null||E===void 0||E.convertSRGBToLinear(),m.map&&(m.map.encoding=L.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=L.sRGBEncoding)})}}var I=g(975),K=g(924),G=k=>{var y={};return g.d(y,k),y},M=k=>()=>k,S=G({clear:()=>Y.clear,del:()=>Y.del,get:()=>Y.get,set:()=>Y.set}),B=S.del,U=S.clear,X=function(){var k=(0,_.Z)(c().mark(function y(m,p){var E,O,N,b,R,V;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return E=p.version,e.next=4,(0,S.get)(m);case 4:if(N=e.sent,!(N&&N[E])){e.next=9;break}O=N[E],e.next=15;break;case 9:return e.next=11,(0,s.Z)(fetch(m).then(function(t){if(t.ok)return t.blob();throw new Error}));case 11:b=e.sent,R=b.res,V=b.err,V||(O=R,(0,S.set)(m,(0,K.Z)({},E,R)));case 15:return e.abrupt("return",O?{url:URL.createObjectURL(O)}:{url:m});case 16:case"end":return e.stop()}},y)}));return function(m,p){return k.apply(this,arguments)}}(),x=g(794)})();var q=j.qo,tt=j.B7,et=j.eK,rt=j.LK,nt=j.ZL,ot=j.wf,it=j.lJ,at=j.vP,ut=j.Up,st=j.PO,ct=j.Mf,ft=j.Rl,_t=j.to;export{q as Chain,tt as Timer,et as clearAllCache,rt as clearCache,nt as colorCorrection,ot as disposeMesh,it as getCache,at as getElementViewLeft,ut as getElementViewTop,st as isPlainObject,ct as makePromiseCreator,ft as polar2Cartesian,_t as to};
1
+ import*as F from"three";import*as Y from"idb-keyval";var Q={666:function(v){var c=function(o){"use strict";var s=Object.prototype,u=s.hasOwnProperty,a,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",f=r.asyncIterator||"@@asyncIterator",_=r.toStringTag||"@@toStringTag";function d(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(t,i,p){return t[i]=p}}function g(e,t,i,p){var l=t&&t.prototype instanceof Z?t:Z,C=Object.create(l.prototype),V=new M(p||[]);return C._invoke=h(e,i,V),C}o.wrap=g;function k(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(p){return{type:"throw",arg:p}}}var L="suspendedStart",B="suspendedYield",D="executing",S="completed",T={};function Z(){}function A(){}function G(){}var K={};d(K,n,function(){return this});var I=Object.getPrototypeOf,j=I&&I(I(W([])));j&&j!==s&&u.call(j,n)&&(K=j);var w=G.prototype=Z.prototype=Object.create(K);A.prototype=G,d(w,"constructor",G),d(G,"constructor",A),A.displayName=d(G,_,"GeneratorFunction");function E(e){["next","throw","return"].forEach(function(t){d(e,t,function(i){return this._invoke(t,i)})})}o.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===A||(t.displayName||t.name)==="GeneratorFunction":!1},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,G):(e.__proto__=G,d(e,_,"GeneratorFunction")),e.prototype=Object.create(w),e},o.awrap=function(e){return{__await:e}};function m(e,t){function i(C,V,U,R){var z=k(e[C],e,V);if(z.type==="throw")R(z.arg);else{var J=z.arg,$=J.value;return $&&typeof $=="object"&&u.call($,"__await")?t.resolve($.__await).then(function(N){i("next",N,U,R)},function(N){i("throw",N,U,R)}):t.resolve($).then(function(N){J.value=N,U(J)},function(N){return i("throw",N,U,R)})}}var p;function l(C,V){function U(){return new t(function(R,z){i(C,V,R,z)})}return p=p?p.then(U,U):U()}this._invoke=l}E(m.prototype),d(m.prototype,f,function(){return this}),o.AsyncIterator=m,o.async=function(e,t,i,p,l){l===void 0&&(l=Promise);var C=new m(g(e,t,i,p),l);return o.isGeneratorFunction(t)?C:C.next().then(function(V){return V.done?V.value:C.next()})};function h(e,t,i){var p=L;return function(C,V){if(p===D)throw new Error("Generator is already running");if(p===S){if(C==="throw")throw V;return X()}for(i.method=C,i.arg=V;;){var U=i.delegate;if(U){var R=O(U,i);if(R){if(R===T)continue;return R}}if(i.method==="next")i.sent=i._sent=i.arg;else if(i.method==="throw"){if(p===L)throw p=S,i.arg;i.dispatchException(i.arg)}else i.method==="return"&&i.abrupt("return",i.arg);p=D;var z=k(e,t,i);if(z.type==="normal"){if(p=i.done?S:B,z.arg===T)continue;return{value:z.arg,done:i.done}}else z.type==="throw"&&(p=S,i.method="throw",i.arg=z.arg)}}}function O(e,t){var i=e.iterator[t.method];if(i===a){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=a,O(e,t),t.method==="throw"))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var p=k(i,e.iterator,t.arg);if(p.type==="throw")return t.method="throw",t.arg=p.arg,t.delegate=null,T;var l=p.arg;if(!l)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T;if(l.done)t[e.resultName]=l.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=a);else return l;return t.delegate=null,T}E(w),d(w,_,"Generator"),d(w,n,function(){return this}),d(w,"toString",function(){return"[object Generator]"});function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}o.keys=function(e){var t=[];for(var i in e)t.push(i);return t.reverse(),function p(){for(;t.length;){var l=t.pop();if(l in e)return p.value=l,p.done=!1,p}return p.done=!0,p}};function W(e){if(e){var t=e[n];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var i=-1,p=function l(){for(;++i<e.length;)if(u.call(e,i))return l.value=e[i],l.done=!1,l;return l.value=a,l.done=!0,l};return p.next=p}}return{next:X}}o.values=W;function X(){return{value:a,done:!0}}return M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=a,this.done=!1,this.delegate=null,this.method="next",this.arg=a,this.tryEntries.forEach(b),!e)for(var t in this)t.charAt(0)==="t"&&u.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=a)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(R,z){return C.type="throw",C.arg=e,t.next=R,z&&(t.method="next",t.arg=a),!!z}for(var p=this.tryEntries.length-1;p>=0;--p){var l=this.tryEntries[p],C=l.completion;if(l.tryLoc==="root")return i("end");if(l.tryLoc<=this.prev){var V=u.call(l,"catchLoc"),U=u.call(l,"finallyLoc");if(V&&U){if(this.prev<l.catchLoc)return i(l.catchLoc,!0);if(this.prev<l.finallyLoc)return i(l.finallyLoc)}else if(V){if(this.prev<l.catchLoc)return i(l.catchLoc,!0)}else if(U){if(this.prev<l.finallyLoc)return i(l.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var p=this.tryEntries[i];if(p.tryLoc<=this.prev&&u.call(p,"finallyLoc")&&this.prev<p.finallyLoc){var l=p;break}}l&&(e==="break"||e==="continue")&&l.tryLoc<=t&&t<=l.finallyLoc&&(l=null);var C=l?l.completion:{};return C.type=e,C.arg=t,l?(this.method="next",this.next=l.finallyLoc,T):this.complete(C)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),b(i),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var p=i.completion;if(p.type==="throw"){var l=p.arg;b(i)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:W(e),resultName:t,nextLoc:i},this.method==="next"&&(this.arg=a),T}},o}(v.exports);try{regeneratorRuntime=c}catch(o){typeof globalThis=="object"?globalThis.regeneratorRuntime=c:Function("r","regeneratorRuntime = r")(c)}},182:function(v,c,o){o.d(c,{Z:function(){return s}});function s(u){if(u.geometry&&u.geometry.dispose(),u.material){var a=Array.isArray(u.material)?u.material:[u.material];a.forEach(function(r){var n,f,_,d,g,k,L,B,D,S,T,Z,A;(n=r.map)===null||n===void 0||n.dispose(),(f=r.lightMap)===null||f===void 0||f.dispose(),(_=r.bumpMap)===null||_===void 0||_.dispose(),(d=r.normalMap)===null||d===void 0||d.dispose(),(g=r.specularMap)===null||g===void 0||g.dispose(),(k=r.envMap)===null||k===void 0||k.dispose(),(L=r.alphaMap)===null||L===void 0||L.dispose(),(B=r.aoMap)===null||B===void 0||B.dispose(),(D=r.displacementMap)===null||D===void 0||D.dispose(),(S=r.emissiveMap)===null||S===void 0||S.dispose(),(T=r.gradientMap)===null||T===void 0||T.dispose(),(Z=r.metalnessMap)===null||Z===void 0||Z.dispose(),(A=r.roughnessMap)===null||A===void 0||A.dispose(),r.dispose()})}}},794:function(v,c,o){o.d(c,{U:function(){return u},v:function(){return s}});var s=function(a){for(var r=a.offsetLeft,n=a.offsetParent;n!==null;)r+=n.offsetLeft,n=n.offsetParent;var f;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?f=document.body.scrollLeft:f=document.documentElement.scrollLeft,r-f},u=function(a){for(var r=a.offsetTop,n=a.offsetParent;n!==null;)r+=n.offsetTop,n=n.offsetParent;var f;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?f=document.body.scrollTop:f=document.documentElement.scrollTop,r-f}},975:function(v,c,o){o.d(c,{Z:function(){return u}});function s(a){return Object.prototype.toString.call(a)==="[object Object]"}function u(a){if(s(a)===!1)return!1;var r=a.constructor;if(r===void 0)return!0;var n=r.prototype;return!(s(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)}},653:function(v,c,o){o.d(c,{Z:function(){return u}});var s=o(620);function u(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={};return n.promise=new Promise(function(f,_){n.resolve=f,n.reject=_}),a&&(n.promise=(0,s.Z)(n.promise,r)),n}},226:function(v,c,o){o.d(c,{Z:function(){return s}});function s(u,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-a)*Math.PI/180,f=(90-u)*Math.PI/180;return[r*Math.sin(n)*Math.cos(f),r*Math.cos(n),r*Math.sin(n)*Math.sin(f)]}},688:function(v,c,o){o.d(c,{Z:function(){return a}});var s=o(438),u=function(){"use strict";function r(f){(0,s.Z)(this,r),this.onTick_=f,this.cancelPending_=null}var n=r.prototype;return n.tickAfter=function(_){var d=this;this.stop();var g=!0,k;this.cancelPending_=function(){clearTimeout(k),g=!1};var L=function(){g&&d.onTick_()};return k=window.setTimeout(L,_),this},n.stop=function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)},r}(),a=function(){"use strict";function r(f){(0,s.Z)(this,r),this.onTick_=f,this.ticker_=null}var n=r.prototype;return n.tickNow=function(){return this.stop(),this.onTick_(),this},n.tickAfter=function(_){var d=this;return this.stop(),this.ticker_=new u(function(){d.onTick_()}).tickAfter(_),this},n.tickEvery=function(_){var d=this;return this.stop(),this.ticker_=new u(function(){var g;(g=d.ticker_)===null||g===void 0||g.tickAfter(_),d.onTick_()}).tickAfter(_),this},n.stop=function(){this.ticker_&&(this.ticker_.stop(),this.ticker_=null)},r}()},620:function(v,c,o){o.d(c,{Z:function(){return u}});var s=o(42);function u(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return a.then(function(n){return(0,s.Z)({err:null,res:n},r)}).catch(function(n){return(0,s.Z)({err:n,res:void 0},r)})}},977:function(v,c,o){o.d(c,{C:function(){return r},y:function(){return a}});var s=o(949),u=new Map,a=function(n){return{generateTopUV:function(f,_,d,g,k){var L=_[d*3],B=_[d*3+1],D=_[g*3],S=_[g*3+1],T=_[k*3],Z=_[k*3+1],A;if(u.has(f))A=u.get(f);else{var G=n&&n.Box3||new s.Box3;if(!n||!n.Box3){var K=f.parameters.shapes.getPoints();G.setFromArray(K.map(function(E){return[E.x,E.y,0]}).flat())}var I=G.getSize(new s.Vector3);A={box:G,size:I},u.set(f,A)}var j=A.box,w=A.size;return[new s.Vector2((L-j.min.x)/w.x,(B-j.min.y)/w.y),new s.Vector2((D-j.min.x)/w.x,(S-j.min.y)/w.y),new s.Vector2((T-j.min.x)/w.x,(Z-j.min.y)/w.y)]},generateSideWallUV:function(f,_,d,g,k,L){var B=_[d*3],D=_[d*3+1],S=_[d*3+2],T=_[g*3],Z=_[g*3+1],A=_[g*3+2],G=_[k*3],K=_[k*3+1],I=_[k*3+2],j=_[L*3],w=_[L*3+1],E=_[L*3+2],m;if(u.has(_))m=u.get(_);else{var h=new s.Box3;h.setFromArray(_);var O=h.getSize(new s.Vector3);m={box:h,size:O},u.set(_,m)}var y=m.box,b=m.size;return Math.abs(D-Z)<.01?[new s.Vector2((B-y.min.x)/b.x,(S-y.min.z)/b.z),new s.Vector2((T-y.min.x)/b.x,(A-y.min.z)/b.z),new s.Vector2((G-y.min.x)/b.x,(I-y.min.z)/b.z),new s.Vector2((j-y.min.x)/b.x,(E-y.min.z)/b.z)]:[new s.Vector2((D-y.min.y)/b.x,(S-y.min.z)/b.z),new s.Vector2((Z-y.min.y)/b.x,(A-y.min.z)/b.z),new s.Vector2((K-y.min.y)/b.x,(I-y.min.z)/b.z),new s.Vector2((w-y.min.y)/b.x,(E-y.min.z)/b.z)]}}},r=function(){u.clear()}},949:function(v,c,o){var s=a=>{var r={};return o.d(r,a),r},u=a=>()=>a;v.exports=s({Box3:()=>F.Box3,Vector2:()=>F.Vector2,Vector3:()=>F.Vector3,sRGBEncoding:()=>F.sRGBEncoding})},943:function(v,c,o){o.d(c,{Z:function(){return s}});function s(u,a){(a==null||a>u.length)&&(a=u.length);for(var r=0,n=new Array(a);r<a;r++)n[r]=u[r];return n}},982:function(v,c,o){o.d(c,{Z:function(){return u}});var s=o(943);function u(a){if(Array.isArray(a))return(0,s.Z)(a)}},568:function(v,c,o){o.d(c,{Z:function(){return u}});function s(a,r,n,f,_,d,g){try{var k=a[d](g),L=k.value}catch(B){n(B);return}k.done?r(L):Promise.resolve(L).then(f,_)}function u(a){return function(){var r=this,n=arguments;return new Promise(function(f,_){var d=a.apply(r,n);function g(L){s(d,f,_,g,k,"next",L)}function k(L){s(d,f,_,g,k,"throw",L)}g(void 0)})}}},438:function(v,c,o){o.d(c,{Z:function(){return s}});function s(u,a){if(!(u instanceof a))throw new TypeError("Cannot call a class as a function")}},924:function(v,c,o){o.d(c,{Z:function(){return s}});function s(u,a,r){return a in u?Object.defineProperty(u,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):u[a]=r,u}},375:function(v,c,o){o.d(c,{Z:function(){return s}});function s(u){if(typeof Symbol!="undefined"&&u[Symbol.iterator]!=null||u["@@iterator"]!=null)return Array.from(u)}},270:function(v,c,o){o.d(c,{Z:function(){return s}});function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},42:function(v,c,o){o.d(c,{Z:function(){return u}});var s=o(924);function u(a){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{},f=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(f=f.concat(Object.getOwnPropertySymbols(n).filter(function(_){return Object.getOwnPropertyDescriptor(n,_).enumerable}))),f.forEach(function(_){(0,s.Z)(a,_,n[_])})}return a}},342:function(v,c,o){o.d(c,{Z:function(){return n}});var s=o(982),u=o(375),a=o(270),r=o(566);function n(f){return(0,s.Z)(f)||(0,u.Z)(f)||(0,r.Z)(f)||(0,a.Z)()}},566:function(v,c,o){o.d(c,{Z:function(){return u}});var s=o(943);function u(a,r){if(!!a){if(typeof a=="string")return(0,s.Z)(a,r);var n=Object.prototype.toString.call(a).slice(8,-1);if(n==="Object"&&a.constructor&&(n=a.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return(0,s.Z)(a,r)}}}},H={};function P(v){var c=H[v];if(c!==void 0)return c.exports;var o=H[v]={exports:{}};return Q[v](o,o.exports,P),o.exports}(function(){P.n=function(v){var c=v&&v.__esModule?function(){return v.default}:function(){return v};return P.d(c,{a:c}),c}})(),function(){P.d=function(v,c){for(var o in c)P.o(c,o)&&!P.o(v,o)&&Object.defineProperty(v,o,{enumerable:!0,get:c[o]})}}(),function(){P.o=function(v,c){return Object.prototype.hasOwnProperty.call(v,c)}}();var x={};(function(){P.d(x,{qo:function(){return _},B7:function(){return o.Z},CL:function(){return j.C},eK:function(){return G},LK:function(){return A},ZL:function(){return L},wf:function(){return g.Z},lJ:function(){return K},vP:function(){return I.v},Up:function(){return I.U},y_:function(){return j.y},PO:function(){return B.Z},Mf:function(){return v.Z},Rl:function(){return d.Z},to:function(){return c.Z}});var v=P(653),c=P(620),o=P(688),s=P(568),u=P(438),a=P(42),r=P(342),n=P(666),f=P.n(n),_=function(){"use strict";function w(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,u.Z)(this,w),this.index=0,this.repeatCount=0,this.repeatNum=0,this.isPlaying=!1,this.chainedList=[],this.children=[],this.options=(0,a.Z)({},{isdev:!1},m)}var E=w.prototype;return E.start=function(){return this.isPlaying?this:(this.index=0,this.isPlaying=!0,this.play())},E.stop1=function(){return this.isPlaying?(this.isPlaying=!1,this.repeatCount=0,this):this},E.stop=function(){return this.traverse(function(h){return h.stop1()}),this},E.dispose=function(){return this.stop(),this.chainedList=[],this.children=[],this},E.play=function(){var h=this;return(0,s.Z)(f().mark(function O(){var y;return f().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(y=h.chainedList[h.index],!(y&&h.isPlaying)){M.next=9;break}return M.next=4,Promise.all(y.map(function(W){return typeof W=="function"?W(h.repeatCount):W.start()}));case 4:return h.index+=1,M.next=7,h.play();case 7:M.next=17;break;case 9:if(!(!y&&h.isPlaying&&h.repeatCount<h.repeatNum)){M.next=16;break}return h.repeatCount+=1,h.index=0,M.next=14,h.play();case 14:M.next=17;break;case 16:!y&&h.isPlaying&&h.repeatCount===h.repeatNum&&h.stop();case 17:case"end":return M.stop()}},O)}))()},E.chain=function(){for(var h=arguments.length,O=new Array(h),y=0;y<h;y++)O[y]=arguments[y];var b=this;return(0,r.Z)(O).forEach(function(M){M instanceof w&&b.children.push(M)}),this.chainedList.push((0,r.Z)(O)),this},E.repeat=function(h){return this.repeatNum=h,this},E.timeout=function(h){return this.chain(function(){return new Promise(function(O){return setTimeout(O,h)})}),this},E.traverse=function(h){h(this),this.children.forEach(function(O){O.traverse(h)})},w}(),d=P(226),g=P(182),k=P(949);function L(w){if(w.material){var E=Array.isArray(w.material)?w.material:[w.material];E.forEach(function(m){var h,O;(h=m.color)===null||h===void 0||h.convertSRGBToLinear(),(O=m.emissive)===null||O===void 0||O.convertSRGBToLinear(),m.map&&(m.map.encoding=k.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=k.sRGBEncoding)})}}var B=P(975),D=P(924),S=w=>{var E={};return P.d(E,w),E},T=w=>()=>w,Z=S({clear:()=>Y.clear,del:()=>Y.del,get:()=>Y.get,set:()=>Y.set}),A=Z.del,G=Z.clear,K=function(){var w=(0,s.Z)(f().mark(function E(m,h){var O,y,b,M,W,X;return f().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return O=h.version,t.next=4,(0,Z.get)(m);case 4:if(b=t.sent,!(b&&b[O])){t.next=9;break}y=b[O],t.next=15;break;case 9:return t.next=11,(0,c.Z)(fetch(m).then(function(i){if(i.ok)return i.blob();throw new Error}));case 11:M=t.sent,W=M.res,X=M.err,X||(y=W,(0,Z.set)(m,(0,D.Z)({},O,W)));case 15:return t.abrupt("return",y?{url:URL.createObjectURL(y)}:{url:m});case 16:case"end":return t.stop()}},E)}));return function(m,h){return w.apply(this,arguments)}}(),I=P(794),j=P(977)})();var q=x.qo,tt=x.B7,et=x.CL,rt=x.eK,nt=x.LK,ot=x.ZL,at=x.wf,it=x.lJ,ut=x.vP,st=x.Up,ct=x.y_,ft=x.PO,_t=x.Mf,lt=x.Rl,pt=x.to;export{q as Chain,tt as Timer,et as claerUVGenerator,rt as clearAllCache,nt as clearCache,ot as colorCorrection,at as disposeMesh,it as getCache,ut as getElementViewLeft,st as getElementViewTop,ct as getUVGenerator,ft as isPlainObject,_t as makePromiseCreator,lt as polar2Cartesian,pt as to};
@@ -0,0 +1,8 @@
1
+ import * as THREE from 'three';
2
+ export declare const getUVGenerator: (options?: {
3
+ Box3?: THREE.Box3;
4
+ }) => {
5
+ generateTopUV(geometry: any, vertices: number[], indexA: number, indexB: number, indexC: number): THREE.Vector2[];
6
+ generateSideWallUV(geometry: any, vertices: number[], indexA: number, indexB: number, indexC: number, indexD: number): THREE.Vector2[];
7
+ };
8
+ export declare const claerUVGenerator: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "PORT=3002 bundler-dev",