@soonspacejs/plugin-soonmanager2-sync 2.4.9 → 2.4.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.esm.js CHANGED
@@ -1,4 +1,3 @@
1
- function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(t,e)||n(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||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.")}()}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */i=function(){return e};var e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function p(){}function d(){}function y(){}var v={};u(v,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==r&&n.call(m,a)&&(v=m);var b=y.prototype=p.prototype=Object.create(v);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(e,r){function o(i,a,c,s){var u=h(e[i],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==t(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){o("next",t,c,s)}),(function(t){o("throw",t,c,s)})):r.resolve(f).then((function(t){l.value=t,c(l)}),(function(t){return o("throw",t,c,s)}))}s(u.arg)}var i;this._invoke=function(t,e){function n(){return new r((function(r,n){o(t,e,r,n)}))}return i=i?i.then(n,n):n()}}function L(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function E(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return d.prototype=y,u(b,"constructor",y),u(y,"constructor",d),d.displayName=u(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},x(w.prototype),u(w.prototype,c,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new w(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),u(b,s,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}
2
1
  /*! *****************************************************************************
3
2
  Copyright (c) Microsoft Corporation.
4
3
 
@@ -13,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
13
  PERFORMANCE OF THIS SOFTWARE.
15
14
  ***************************************************************************** */
16
- function c(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function c(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,c)}s((n=n.apply(t,e||[])).next())}))}var s,u,l;!function(t){t.Sbm="Sbm",t.Model="Model",t.Poi="Poi",t.Point="Point",t.Line="Line",t.Polygon="Polygon",t.Circle="Circle",t.Grid="Grid",t.Ground="Ground",t.Light="Light"}(s||(s={})),function(t){t.Model="model",t.MarkPoint="markPoint",t.BaseObject="baseObject",t.Topology="topology",t.Light="light",t.Effect="effect"}(u||(u={})),function(t){t.SimpleModel="simpleModel",t.GroupModel="groupModel",t.Point="point",t.Line="line",t.Polygon="polygon",t.AmbientLight="ambientLight",t.DirectionalLight="directionalLight",t.HemisphereLight="hemisphereLight"}(l||(l={}));var h=function(t){var e;if(!t)return{};try{return null!==(e=JSON.parse(t))&&void 0!==e?e:{}}catch(t){return{}}},f=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ssp=e,this.baseUrl="",this.spaceData=null,this.lightData=null,this.spaceTreeData=null}var n,o,f;return n=t,(o=[{key:"setBaseUrl",value:function(t){this.baseUrl=t}},{key:"syncLight",value:function(){return c(this,void 0,void 0,i().mark((function t(){var e,r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getData("/data/light.json");case 2:if(this.lightData=t.sent,this.lightData&&this.lightData.length){t.next=5;break}return t.abrupt("return");case 5:(e=this.ssp).removeLightById("defaultAmbientLight"),e.removeLightById("defaultDirectionalLight"),e.removeLightById("defaultHemisphereLight"),null==(r=this.lightData)||r.forEach((function(t){var r=t.spaceObjectDto;if(r&&r.templateAggregateDto.firstClassify===u.Light){var n=h(r.attribute);n.id=t.id,n.position&&(n.position=h(n.position)),n.target&&(n.target=h(n.target)),r.templateAggregateDto.secondClassify===l.AmbientLight?e.getLightById(n.id)?e.setAmbientLight(n):e.createAmbientLight(n):r.templateAggregateDto.secondClassify===l.DirectionalLight?e.getLightById(n.id)?e.setDirectionalLight(n):e.createDirectionalLight(n):r.templateAggregateDto.secondClassify===l.HemisphereLight&&(e.getLightById(n.id)?e.setHemisphereLight(n):e.createHemisphereLight(n))}}));case 11:case"end":return t.stop()}}),t,this)})))}},{key:"loadScene",value:function(t){var e;return c(this,void 0,void 0,i().mark((function r(){var n,o,a=this;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=4;break}this.spaceData=t,r.next=7;break;case 4:return r.next=6,this.getData();case 6:this.spaceData=r.sent;case 7:if(this.spaceTreeData=this.spaceData2SpaceTreeData(this.spaceData),null===(e=this.spaceTreeData)||void 0===e?void 0:e.length){r.next=10;break}return r.abrupt("return");case 10:return n=this.spaceTreeData,o=function t(e){return c(a,void 0,void 0,i().mark((function r(){var n,o,a,c;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=e.pid,a=e.sceneType,!(c=this.formatSpaceDataByType(e))){r.next=45;break}if(a!==s.Sbm){r.next=14;break}if(!this.ssp.getSbmGroupById(o)){r.next=10;break}return r.next=8,this.ssp.addSbmForGroup(o,[c]);case 8:r.next=12;break;case 10:return r.next=12,this.ssp.loadSbmToGroup({id:o},[c]);case 12:r.next=45;break;case 14:if(a!==s.Model){r.next=25;break}if(!this.ssp.getModelGroupById(o)){r.next=21;break}return r.next=19,this.ssp.addModelForGroup(o,[c]);case 19:r.next=23;break;case 21:return r.next=23,this.ssp.loadModelToGroup({id:o},[c]);case 23:r.next=45;break;case 25:if(a!==s.Poi){r.next=36;break}if(!this.ssp.getPoiGroupById(o)){r.next=32;break}return r.next=30,this.ssp.addPoiForGroup(o,[c]);case 30:r.next=34;break;case 32:return r.next=34,this.ssp.createPoiToGroup({id:o},[c]);case 34:r.next=45;break;case 36:if(a!==s.Point&&a!==s.Line&&a!==s.Polygon){r.next=45;break}if(!this.ssp.getCanvas3DGroupById(o)){r.next=43;break}return r.next=41,this.ssp.addCanvas3DForGroup(o,[c]);case 41:r.next=45;break;case 43:return r.next=45,this.ssp.createCanvas3DToGroup({id:o},[c]);case 45:if(!(null===(n=e.children)||void 0===n?void 0:n.length)){r.next=48;break}return r.next=48,Promise.allSettled(e.children.map((function(e){return t(e)})));case 48:case"end":return r.stop()}}),r,this)})))},r.next=14,Promise.allSettled(n.map((function(t){return o(t)})));case 14:case"end":return r.stop()}}),r,this)})))}},{key:"getData",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/data/space.json";return fetch("".concat(this.baseUrl).concat(e)).then((function(t){return t.json()})).then((function(e){return c(t,void 0,void 0,i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e);case 1:case"end":return t.stop()}}),t)})))}))}},{key:"spaceData2SpaceTreeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.spaceData,e=[],n=[];if(t){var o=r(t);o.forEach((function(t){n.includes(t.id)||n.push(t.id)})),o.forEach((function(t){n.includes(t.pid)||e.push(Object.assign({},t))})),e.forEach((function(t){var e=o.findIndex((function(e){return e.id===t.id}));-1!==e&&o.splice(e,1)}));var i=function t(e,r){var n=[];e.forEach((function(t){t.pid===r.id&&n.push(t)})),n.length>0&&(r.children=n,n.forEach((function(r){return t(e,r)})))};e.forEach((function(t){return i(o,t)}))}return e}},{key:"formatSpaceDataByType",value:function(t){var r;if(t.sceneType){var n=t.id,o=t.name,i=t.sceneType,a=t.spaceObjectDto,c=t.position,u=(c=void 0===c?{}:c).coordinates,l=this.ssp.utils.deg2Euler,f=null!=a?a:{},p=f.attribute,d=f.templateAggregateDto,y=(null!=d?d:{}).fileResourceBaseDto,v=e(null!=u?u:[],3),g=v[0],m=void 0===g?0:g,b=v[1],x=void 0===b?0:b,w=v[2],L=void 0===w?0:w,D=h(p),k=D.rotation,S=void 0===k?{}:k,E=D.scale,j=void 0===E?{}:E,P=D.configAttribute,O=void 0===P?{}:P,G=S.x,T=void 0===G?0:G,A=S.y,I=void 0===A?0:A,B=S.z,_=void 0===B?0:B,z=j.x,M=void 0===z?1:z,C=j.y,F=void 0===C?1:C,N=j.z,U=void 0===N?1:N,H=null!==(r=null==y?void 0:y.path)&&void 0!==r?r:"";return i===s.Sbm||i===s.Model||i===s.Poi?{id:n,name:o,url:"".concat(this.baseUrl).concat(H),position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U},userData:Object.assign({},t)}:i===s.Point?{id:n,name:o,points:[Object.assign({id:n,position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U}},O)],userData:Object.assign({},t)}:i===s.Line?{id:n,name:o,lines:[Object.assign({id:n,position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U}},O)],userData:Object.assign({},t)}:i===s.Polygon?{id:n,name:o,polygons:[Object.assign({id:n,position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U}},O)],userData:Object.assign({},t)}:void s.Circle}}}])&&a(n.prototype,o),f&&a(n,f),Object.defineProperty(n,"prototype",{writable:!1}),t}();export{f as default};
15
+ function t(t,e,i,s){return new(i||(i=Promise))((function(o,a){function n(t){try{l(s.next(t))}catch(t){a(t)}}function r(t){try{l(s.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,r)}l((s=s.apply(t,e||[])).next())}))}var e,i,s;!function(t){t.Sbm="Sbm",t.Model="Model",t.Poi="Poi",t.Point="Point",t.Line="Line",t.Polygon="Polygon",t.Circle="Circle",t.Grid="Grid",t.Ground="Ground",t.Light="Light"}(e||(e={})),function(t){t.Model="model",t.MarkPoint="markPoint",t.BaseObject="baseObject",t.Topology="topology",t.Light="light",t.Effect="effect"}(i||(i={})),function(t){t.SimpleModel="simpleModel",t.GroupModel="groupModel",t.Point="point",t.Line="line",t.Polygon="polygon",t.AmbientLight="ambientLight",t.DirectionalLight="directionalLight",t.HemisphereLight="hemisphereLight"}(s||(s={}));const o=t=>{var e;if(!t)return{};try{return null!==(e=JSON.parse(t))&&void 0!==e?e:{}}catch(t){return{}}};class a{constructor(t){this.ssp=t,this.baseUrl="",this.spaceData=null,this.lightData=null,this.spaceTreeData=null}setBaseUrl(t){this.baseUrl=t}syncLight(){return t(this,void 0,void 0,(function*(){if(this.lightData=yield this.getData("/data/light.json"),!this.lightData||!this.lightData.length)return;const t=this.ssp;t.removeLightById("defaultAmbientLight"),t.removeLightById("defaultDirectionalLight"),t.removeLightById("defaultHemisphereLight");const e=this.lightData;null==e||e.forEach((e=>{const a=e.spaceObjectDto;if(a&&a.templateAggregateDto.firstClassify===i.Light){const i=o(a.attribute);if(i.id=e.id,i.position&&(i.position=o(i.position)),i.target&&(i.target=o(i.target)),a.templateAggregateDto.secondClassify===s.AmbientLight){t.getLightById(i.id)?t.setAmbientLight(i):t.createAmbientLight(i)}else if(a.templateAggregateDto.secondClassify===s.DirectionalLight){t.getLightById(i.id)?t.setDirectionalLight(i):t.createDirectionalLight(i)}else if(a.templateAggregateDto.secondClassify===s.HemisphereLight){t.getLightById(i.id)?t.setHemisphereLight(i):t.createHemisphereLight(i)}}}))}))}loadScene(i){var s;return t(this,void 0,void 0,(function*(){if(this.spaceData=i||(yield this.getData()),this.spaceTreeData=this.spaceData2SpaceTreeData(this.spaceData),!(null===(s=this.spaceTreeData)||void 0===s?void 0:s.length))return;const o=this.spaceTreeData,a=i=>t(this,void 0,void 0,(function*(){var t;const{pid:s,sceneType:o}=i,n=this.formatSpaceDataByType(i);if(n)if(o===e.Sbm){this.ssp.getSbmGroupById(s)?yield this.ssp.addSbmForGroup(s,[n]):yield this.ssp.loadSbmToGroup({id:s},[n])}else if(o===e.Model){this.ssp.getModelGroupById(s)?yield this.ssp.addModelForGroup(s,[n]):yield this.ssp.loadModelToGroup({id:s},[n])}else if(o===e.Poi){this.ssp.getPoiGroupById(s)?yield this.ssp.addPoiForGroup(s,[n]):yield this.ssp.createPoiToGroup({id:s},[n])}else if(o===e.Point||o===e.Line||o===e.Polygon){this.ssp.getCanvas3DGroupById(s)?yield this.ssp.addCanvas3DForGroup(s,[n]):yield this.ssp.createCanvas3DToGroup({id:s},[n])}(null===(t=i.children)||void 0===t?void 0:t.length)&&(yield Promise.allSettled(i.children.map((t=>a(t)))))}));yield Promise.allSettled(o.map((t=>a(t))))}))}getData(e="/data/space.json"){return fetch(`${this.baseUrl}${e}`).then((t=>t.json())).then((e=>t(this,void 0,void 0,(function*(){return e}))))}spaceData2SpaceTreeData(t=this.spaceData){const e=[],i=[];if(t){const s=[...t];s.forEach((t=>{i.includes(t.id)||i.push(t.id)})),s.forEach((t=>{i.includes(t.pid)||e.push(Object.assign({},t))})),e.forEach((t=>{const e=s.findIndex((e=>e.id===t.id));-1!==e&&s.splice(e,1)}));const o=(t,e)=>{const i=[];t.forEach((t=>{t.pid===e.id&&i.push(t)})),i.length>0&&(e.children=i,i.forEach((e=>o(t,e))))};e.forEach((t=>o(s,t)))}return e}formatSpaceDataByType(t){var i;if(!t.sceneType)return;const{id:s,name:a,sceneType:n,spaceObjectDto:r,position:{coordinates:l}={}}=t,{deg2Euler:d}=this.ssp.utils,{attribute:c,templateAggregateDto:h}=null!=r?r:{},{fileResourceBaseDto:p}=null!=h?h:{},[g=0,u=0,y=0]=null!=l?l:[],{rotation:f={},scale:m={},configAttribute:D={}}=o(c),{x:L=0,y:b=0,z:v=0}=f,{x:P=1,y:x=1,z:G=1}=m,S=null!==(i=null==p?void 0:p.path)&&void 0!==i?i:"";return n===e.Sbm||n===e.Model||n===e.Poi?{id:s,name:a,url:`${this.baseUrl}${S}`,position:{x:g,y:u,z:y},rotation:{x:d(L),y:d(b),z:d(v)},scale:{x:P,y:x,z:G},userData:Object.assign({},t)}:n===e.Point?{id:s,name:a,points:[Object.assign({id:s,position:{x:g,y:u,z:y},rotation:{x:d(L),y:d(b),z:d(v)},scale:{x:P,y:x,z:G}},D)],userData:Object.assign({},t)}:n===e.Line?{id:s,name:a,lines:[Object.assign({id:s,position:{x:g,y:u,z:y},rotation:{x:d(L),y:d(b),z:d(v)},scale:{x:P,y:x,z:G}},D)],userData:Object.assign({},t)}:n===e.Polygon?{id:s,name:a,polygons:[Object.assign({id:s,position:{x:g,y:u,z:y},rotation:{x:d(L),y:d(b),z:d(v)},scale:{x:P,y:x,z:G}},D)],userData:Object.assign({},t)}:void e.Circle}}export{a as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-soonmanager2-sync",
3
3
  "pluginName": "Soonmanager2SyncPlugin",
4
- "version": "2.4.9",
4
+ "version": "2.4.12",
5
5
  "description": "Sync soonmanager 2.x data plugin for SoonSpace.js",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.esm.js",
@@ -13,5 +13,5 @@
13
13
  ],
14
14
  "author": "xuek",
15
15
  "license": "UNLICENSED",
16
- "gitHead": "bc38cb459b7cd6894e492ffea333465fe423cdc5"
16
+ "gitHead": "1c14eab2badba701ba58d6c8df1a6e1798ca4ec5"
17
17
  }