@wework/floormap-utils
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -248,4 +248,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
var s = getSize(_shapes[0]); | ||
if ((s.width < maxWidth) || (s.height < maxWidth)) { | ||
if (maxWidth > s.width) { | ||
maxWidth = s.width - 0.1; | ||
} else if (maxWidth > s.height) { | ||
maxWidth = s.height - 0.1; | ||
} | ||
@@ -252,0 +254,0 @@ objects.push({ |
@@ -1,2 +0,2 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0});var nook="https://cdn.spacemob.co/img/nook@2x.png",meeting="https://cdn.spacemob.co/img/meeting_room@2x.png",gameRoom="https://cdn.spacemob.co/img/gameroom@2x.png",women="https://cdn.spacemob.co/img/wc_f@2x.png",men="https://cdn.spacemob.co/img/wc_m@2x.png",shower="https://cdn.spacemob.co/img/shower@2x.png",itRoom="https://cdn.spacemob.co/img/IT_room@2x.png",printer="https://cdn.spacemob.co/img/printer@2x.png",phoneBooth="https://cdn.spacemob.co/img/phone_booth@2x.png",mechanical="https://cdn.spacemob.co/img/mechanical@2x.png",storage="https://cdn.spacemob.co/img/storage@2x.png",trash="https://cdn.spacemob.co/img/trash@2x.png",pantry="https://cdn.spacemob.co/img/pantry@2x.png",motherRoom="https://cdn.spacemob.co/img/motherroom@2x.png",mail="https://cdn.spacemob.co/img/mail_room@2x.png",serviceLift="https://cdn.spacemob.co/img/servicelift@2x.png",wellness="https://cdn.spacemob.co/img/wellnessroom@2x.png",electrical="https://cdn.spacemob.co/img/electrical@2x.png",fire="https://cdn.spacemob.co/img/fire_extinguisher@2x.png",maintenance="https://cdn.spacemob.co/img/maintenance@2x.png",getCenter=function(e){for(var t=1/0,a=1/0,r=-1/0,c=-1/0,s=0;s<e.length;s++)t=Math.min(t,e[s].x),a=Math.min(a,e[s].y),r=Math.max(r,e[s].x),c=Math.max(c,e[s].y);return{x:(r+t)/2,y:(c+a)/2}},createRenderObjects=function(e){var r=e.id,t=e.shapes,a=e.type,c=e.subType,s=e.programType,n=e.roomNumber,o=e.hasWindow,i=e.locationAngle,g=e.centroid,p=[],m="BACK",h="black",b=1,l=!1,E=getExtrude(s,6),u=getZed(s,6),x=getColor(s),y=getImage(s,c);if("object"===a)switch(c){case"CHAIR":x="rgb(206,206,206)",m="FRONT",u=-(6-(E=1))/2,h="black";break;case"TABLE":case"HOTDESK_TABLE":x="rgb(246,241,241)",m="FRONT",E=.5,u=-1.5,b=.7}else"space"===a||"room"===a||console.warn("invalid type:",a);var T={only:!1,color:h};switch(c){case"HALLWAY":case"ELEV LOBBY":T=null;break;case"PHONE BOOTH":case"PRINTER":h="#474747"}switch(s){case"MEET":switch(h="#474747",l=!0,c){case"NOOK":case"PHONE BOOTH":case"wt":l=!1}break;case"WORK":h="#EEB4B2",l=!0,o&&(x="rgb(228,243,247)");break;case"WASH":case"SERVE":h="#979797";break;case"OPERATE":case"WE":break;case"CIRCULATE":T=null;break;default:s&&console.log("invalid programType:",s)}T&&(T.color=h);var d=t,R={z:u},O=null;if(!d||0===d.length)switch(c){case"CHAIR":d=getChairGeometry(),(R=g).z=u,O={z:i};break;case"TABLE":d=getTableGeometry(),(R=g).z=u,O={z:i};break;case"HOTDESK_TABLE":d=getHotDeskTableGeometry(),(R=g).z=u,O={z:i}}if(d&&0!==d.length){if(d.forEach(function(e,t){var a=r;0!==t&&(a=r+"/"+t),p.push({id:a,type:"MESH",style:{color:x,side:m,outline:T,opacity:b},points:e,interactable:!0,extrude:E,position:R,rotation:O})}),l&&n){var f=getCenter(d[0]);y&&(f.y=f.y-2),p.push({id:n,type:"TEXT",text:n,position:f,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(y){var k=getCenter(d[0]);l&&n&&(k.y=k.y+1);var A=3,M=getSize(d[0]);(M.width<A||M.height<A)&&(A=M.width-.1),p.push({id:r+"_img",type:"SPRITE",position:k,scalar:1,style:{img:y,maxWidth:A},interactable:!1})}return p}console.warn("Invalid shapes",JSON.stringify(e))},getChairGeometry=function(){return[[{x:1,y:1.45},{x:-1,y:1.45},{x:-1,y:-.55},{x:1,y:-.55}]]},getTableGeometry=function(){return[[{x:2,y:2.3},{x:-2,y:2.3},{x:-2,y:.3},{x:2,y:.3}]]},getHotDeskTableGeometry=function(){return[[{x:1.97,y:1.97},{x:-1.97,y:1.97},{x:-1.97,y:-1.97},{x:1.97,y:-1.97}]]},getExtrude=function(e,t){switch(e){case"CIRCULATE":case"WE":return.1;default:return t}},getZed=function(e,t){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(t/2+.01);case"CIRCULATE":return-(t/2+.02);default:return 0}},getColor=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},stringArrayToPoints=function(e){if(e&&e.constructor===Array){var t=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&t.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),t}},getImage=function(e,t){var a=null;switch(t){case"PHONE BOOTH":a=phoneBooth;break;case"wt":case"NOOK":case"BOOTH":a=nook;break;case"LOUNGE":case"PANTRY":a=pantry;break;case"GAME RM":a=gameRoom;break;case"WOMEN WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":a=women;break;case"MEN WC":case"MALE WC":case"M RESTROOM":a=men;break;case"ADA WC":a=shower;break;case"IT":a=itRoom;break;case"PRINTER":a=printer;break;case"MECH":a=mechanical;break;case"STOR":case"STORE":a=storage;break;case"TRASH":a=trash;break;case"MOTHER RM":a=motherRoom;break;case"F&B":a=pantry;break;case"MAIL":a=mail;break;case"SHOWER":a=shower;break;case"SERVICE LIFT":a=serviceLift;break;case"WELLNESS RM":a=wellness;break;case"ELEC":a=electrical;break;case"FIRE":a=fire;break;case"MOP":case"JC":a=maintenance}if(!a)switch(e){case"MEET":a=meeting}return a},getSize=function(e){for(var t=1/0,a=1/0,r=-1/0,c=-1/0,s=0;s<e.length;s++)t=Math.min(t,e[s].x),a=Math.min(a,e[s].y),r=Math.max(r,e[s].x),c=Math.max(c,e[s].y);return{width:r-t,height:c-a}};exports.createRenderObjects=createRenderObjects,exports.getCenter=getCenter,exports.getSize=getSize,exports.stringArrayToPoints=stringArrayToPoints; | ||
Object.defineProperty(exports,"__esModule",{value:!0});var nook="https://cdn.spacemob.co/img/nook@2x.png",meeting="https://cdn.spacemob.co/img/meeting_room@2x.png",gameRoom="https://cdn.spacemob.co/img/gameroom@2x.png",women="https://cdn.spacemob.co/img/wc_f@2x.png",men="https://cdn.spacemob.co/img/wc_m@2x.png",shower="https://cdn.spacemob.co/img/shower@2x.png",itRoom="https://cdn.spacemob.co/img/IT_room@2x.png",printer="https://cdn.spacemob.co/img/printer@2x.png",phoneBooth="https://cdn.spacemob.co/img/phone_booth@2x.png",mechanical="https://cdn.spacemob.co/img/mechanical@2x.png",storage="https://cdn.spacemob.co/img/storage@2x.png",trash="https://cdn.spacemob.co/img/trash@2x.png",pantry="https://cdn.spacemob.co/img/pantry@2x.png",motherRoom="https://cdn.spacemob.co/img/motherroom@2x.png",mail="https://cdn.spacemob.co/img/mail_room@2x.png",serviceLift="https://cdn.spacemob.co/img/servicelift@2x.png",wellness="https://cdn.spacemob.co/img/wellnessroom@2x.png",electrical="https://cdn.spacemob.co/img/electrical@2x.png",fire="https://cdn.spacemob.co/img/fire_extinguisher@2x.png",maintenance="https://cdn.spacemob.co/img/maintenance@2x.png",getCenter=function(e){for(var t=1/0,a=1/0,r=-1/0,c=-1/0,s=0;s<e.length;s++)t=Math.min(t,e[s].x),a=Math.min(a,e[s].y),r=Math.max(r,e[s].x),c=Math.max(c,e[s].y);return{x:(r+t)/2,y:(c+a)/2}},createRenderObjects=function(e){var r=e.id,t=e.shapes,a=e.type,c=e.subType,s=e.programType,n=e.roomNumber,o=e.hasWindow,i=e.locationAngle,g=e.centroid,p=[],m="BACK",h="black",b=1,l=!1,E=getExtrude(s,6),u=getZed(s,6),x=getColor(s),y=getImage(s,c);if("object"===a)switch(c){case"CHAIR":x="rgb(206,206,206)",m="FRONT",u=-(6-(E=1))/2,h="black";break;case"TABLE":case"HOTDESK_TABLE":x="rgb(246,241,241)",m="FRONT",E=.5,u=-1.5,b=.7}else"space"===a||"room"===a||console.warn("invalid type:",a);var T={only:!1,color:h};switch(c){case"HALLWAY":case"ELEV LOBBY":T=null;break;case"PHONE BOOTH":case"PRINTER":h="#474747"}switch(s){case"MEET":switch(h="#474747",l=!0,c){case"NOOK":case"PHONE BOOTH":case"wt":l=!1}break;case"WORK":h="#EEB4B2",l=!0,o&&(x="rgb(228,243,247)");break;case"WASH":case"SERVE":h="#979797";break;case"OPERATE":case"WE":break;case"CIRCULATE":T=null;break;default:s&&console.log("invalid programType:",s)}T&&(T.color=h);var d=t,R={z:u},O=null;if(!d||0===d.length)switch(c){case"CHAIR":d=getChairGeometry(),(R=g).z=u,O={z:i};break;case"TABLE":d=getTableGeometry(),(R=g).z=u,O={z:i};break;case"HOTDESK_TABLE":d=getHotDeskTableGeometry(),(R=g).z=u,O={z:i}}if(d&&0!==d.length){if(d.forEach(function(e,t){var a=r;0!==t&&(a=r+"/"+t),p.push({id:a,type:"MESH",style:{color:x,side:m,outline:T,opacity:b},points:e,interactable:!0,extrude:E,position:R,rotation:O})}),l&&n){var f=getCenter(d[0]);y&&(f.y=f.y-2),p.push({id:n,type:"TEXT",text:n,position:f,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(y){var k=getCenter(d[0]);l&&n&&(k.y=k.y+1);var A=3,M=getSize(d[0]);A>M.width?A=M.width-.1:A>M.height&&(A=M.height-.1),p.push({id:r+"_img",type:"SPRITE",position:k,scalar:1,style:{img:y,maxWidth:A},interactable:!1})}return p}console.warn("Invalid shapes",JSON.stringify(e))},getChairGeometry=function(){return[[{x:1,y:1.45},{x:-1,y:1.45},{x:-1,y:-.55},{x:1,y:-.55}]]},getTableGeometry=function(){return[[{x:2,y:2.3},{x:-2,y:2.3},{x:-2,y:.3},{x:2,y:.3}]]},getHotDeskTableGeometry=function(){return[[{x:1.97,y:1.97},{x:-1.97,y:1.97},{x:-1.97,y:-1.97},{x:1.97,y:-1.97}]]},getExtrude=function(e,t){switch(e){case"CIRCULATE":case"WE":return.1;default:return t}},getZed=function(e,t){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(t/2+.01);case"CIRCULATE":return-(t/2+.02);default:return 0}},getColor=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},stringArrayToPoints=function(e){if(e&&e.constructor===Array){var t=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&t.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),t}},getImage=function(e,t){var a=null;switch(t){case"PHONE BOOTH":a=phoneBooth;break;case"wt":case"NOOK":case"BOOTH":a=nook;break;case"LOUNGE":case"PANTRY":a=pantry;break;case"GAME RM":a=gameRoom;break;case"WOMEN WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":a=women;break;case"MEN WC":case"MALE WC":case"M RESTROOM":a=men;break;case"ADA WC":a=shower;break;case"IT":a=itRoom;break;case"PRINTER":a=printer;break;case"MECH":a=mechanical;break;case"STOR":case"STORE":a=storage;break;case"TRASH":a=trash;break;case"MOTHER RM":a=motherRoom;break;case"F&B":a=pantry;break;case"MAIL":a=mail;break;case"SHOWER":a=shower;break;case"SERVICE LIFT":a=serviceLift;break;case"WELLNESS RM":a=wellness;break;case"ELEC":a=electrical;break;case"FIRE":a=fire;break;case"MOP":case"JC":a=maintenance}if(!a)switch(e){case"MEET":a=meeting}return a},getSize=function(e){for(var t=1/0,a=1/0,r=-1/0,c=-1/0,s=0;s<e.length;s++)t=Math.min(t,e[s].x),a=Math.min(a,e[s].y),r=Math.max(r,e[s].x),c=Math.max(c,e[s].y);return{width:r-t,height:c-a}};exports.createRenderObjects=createRenderObjects,exports.getCenter=getCenter,exports.getSize=getSize,exports.stringArrayToPoints=stringArrayToPoints; | ||
//# sourceMappingURL=floormap-utils.cjs.min.js.map |
@@ -246,4 +246,6 @@ var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
var s = getSize(_shapes[0]); | ||
if ((s.width < maxWidth) || (s.height < maxWidth)) { | ||
if (maxWidth > s.width) { | ||
maxWidth = s.width - 0.1; | ||
} else if (maxWidth > s.height) { | ||
maxWidth = s.height - 0.1; | ||
} | ||
@@ -250,0 +252,0 @@ objects.push({ |
@@ -252,4 +252,6 @@ (function (global, factory) { | ||
var s = getSize(_shapes[0]); | ||
if ((s.width < maxWidth) || (s.height < maxWidth)) { | ||
if (maxWidth > s.width) { | ||
maxWidth = s.width - 0.1; | ||
} else if (maxWidth > s.height) { | ||
maxWidth = s.height - 0.1; | ||
} | ||
@@ -256,0 +258,0 @@ objects.push({ |
@@ -1,2 +0,2 @@ | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a(e.FloormapUtils={})}(this,function(e){var t="https://cdn.spacemob.co/img/shower@2x.png",r="https://cdn.spacemob.co/img/pantry@2x.png",w=function(e){for(var a=1/0,c=1/0,t=-1/0,r=-1/0,s=0;s<e.length;s++)a=Math.min(a,e[s].x),c=Math.min(c,e[s].y),t=Math.max(t,e[s].x),r=Math.max(r,e[s].y);return{x:(t+a)/2,y:(r+c)/2}},S=function(){return[[{x:1,y:1.45},{x:-1,y:1.45},{x:-1,y:-.55},{x:1,y:-.55}]]},W=function(){return[[{x:2,y:2.3},{x:-2,y:2.3},{x:-2,y:.3},{x:2,y:.3}]]},C=function(){return[[{x:1.97,y:1.97},{x:-1.97,y:1.97},{x:-1.97,y:-1.97},{x:1.97,y:-1.97}]]},H=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},L=function(e,a){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(a/2+.01);case"CIRCULATE":return-(a/2+.02);default:return 0}},v=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},I=function(e,a){var c=null;switch(a){case"PHONE BOOTH":c="https://cdn.spacemob.co/img/phone_booth@2x.png";break;case"wt":case"NOOK":case"BOOTH":c="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":case"PANTRY":c=r;break;case"GAME RM":c="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":c="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":case"MALE WC":case"M RESTROOM":c="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"ADA WC":c=t;break;case"IT":c="https://cdn.spacemob.co/img/IT_room@2x.png";break;case"PRINTER":c="https://cdn.spacemob.co/img/printer@2x.png";break;case"MECH":c="https://cdn.spacemob.co/img/mechanical@2x.png";break;case"STOR":case"STORE":c="https://cdn.spacemob.co/img/storage@2x.png";break;case"TRASH":c="https://cdn.spacemob.co/img/trash@2x.png";break;case"MOTHER RM":c="https://cdn.spacemob.co/img/motherroom@2x.png";break;case"F&B":c=r;break;case"MAIL":c="https://cdn.spacemob.co/img/mail_room@2x.png";break;case"SHOWER":c=t;break;case"SERVICE LIFT":c="https://cdn.spacemob.co/img/servicelift@2x.png";break;case"WELLNESS RM":c="https://cdn.spacemob.co/img/wellnessroom@2x.png";break;case"ELEC":c="https://cdn.spacemob.co/img/electrical@2x.png";break;case"FIRE":c="https://cdn.spacemob.co/img/fire_extinguisher@2x.png";break;case"MOP":case"JC":c="https://cdn.spacemob.co/img/maintenance@2x.png"}if(!c)switch(e){case"MEET":c="https://cdn.spacemob.co/img/meeting_room@2x.png"}return c},N=function(e){for(var a=1/0,c=1/0,t=-1/0,r=-1/0,s=0;s<e.length;s++)a=Math.min(a,e[s].x),c=Math.min(c,e[s].y),t=Math.max(t,e[s].x),r=Math.max(r,e[s].y);return{width:t-a,height:r-c}};e.createRenderObjects=function(e){var t=e.id,a=e.shapes,c=e.type,r=e.subType,s=e.programType,n=e.roomNumber,o=e.hasWindow,i=e.locationAngle,p=e.centroid,b=[],g="BACK",m="black",h=1,E=!1,u=H(s,6),l=L(s,6),d=v(s),x=I(s,r);if("object"===c)switch(r){case"CHAIR":d="rgb(206,206,206)",g="FRONT",l=-(6-(u=1))/2,m="black";break;case"TABLE":case"HOTDESK_TABLE":d="rgb(246,241,241)",g="FRONT",u=.5,l=-1.5,h=.7}else"space"===c||"room"===c||console.warn("invalid type:",c);var f={only:!1,color:m};switch(r){case"HALLWAY":case"ELEV LOBBY":f=null;break;case"PHONE BOOTH":case"PRINTER":m="#474747"}switch(s){case"MEET":switch(m="#474747",E=!0,r){case"NOOK":case"PHONE BOOTH":case"wt":E=!1}break;case"WORK":m="#EEB4B2",E=!0,o&&(d="rgb(228,243,247)");break;case"WASH":case"SERVE":m="#979797";break;case"OPERATE":case"WE":break;case"CIRCULATE":f=null;break;default:s&&console.log("invalid programType:",s)}f&&(f.color=m);var y=a,O={z:l},T=null;if(!y||0===y.length)switch(r){case"CHAIR":y=S(),(O=p).z=l,T={z:i};break;case"TABLE":y=W(),(O=p).z=l,T={z:i};break;case"HOTDESK_TABLE":y=C(),(O=p).z=l,T={z:i}}if(y&&0!==y.length){if(y.forEach(function(e,a){var c=t;0!==a&&(c=t+"/"+a),b.push({id:c,type:"MESH",style:{color:d,side:g,outline:f,opacity:h},points:e,interactable:!0,extrude:u,position:O,rotation:T})}),E&&n){var R=w(y[0]);x&&(R.y=R.y-2),b.push({id:n,type:"TEXT",text:n,position:R,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(x){var k=w(y[0]);E&&n&&(k.y=k.y+1);var A=3,M=N(y[0]);(M.width<A||M.height<A)&&(A=M.width-.1),b.push({id:t+"_img",type:"SPRITE",position:k,scalar:1,style:{img:x,maxWidth:A},interactable:!1})}return b}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=w,e.getSize=N,e.stringArrayToPoints=function(e){if(e&&e.constructor===Array){var a=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&a.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),a}},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a(e.FloormapUtils={})}(this,function(e){var t="https://cdn.spacemob.co/img/shower@2x.png",r="https://cdn.spacemob.co/img/pantry@2x.png",w=function(e){for(var a=1/0,c=1/0,t=-1/0,r=-1/0,s=0;s<e.length;s++)a=Math.min(a,e[s].x),c=Math.min(c,e[s].y),t=Math.max(t,e[s].x),r=Math.max(r,e[s].y);return{x:(t+a)/2,y:(r+c)/2}},S=function(){return[[{x:1,y:1.45},{x:-1,y:1.45},{x:-1,y:-.55},{x:1,y:-.55}]]},W=function(){return[[{x:2,y:2.3},{x:-2,y:2.3},{x:-2,y:.3},{x:2,y:.3}]]},C=function(){return[[{x:1.97,y:1.97},{x:-1.97,y:1.97},{x:-1.97,y:-1.97},{x:1.97,y:-1.97}]]},H=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},L=function(e,a){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(a/2+.01);case"CIRCULATE":return-(a/2+.02);default:return 0}},v=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},I=function(e,a){var c=null;switch(a){case"PHONE BOOTH":c="https://cdn.spacemob.co/img/phone_booth@2x.png";break;case"wt":case"NOOK":case"BOOTH":c="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":case"PANTRY":c=r;break;case"GAME RM":c="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":c="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":case"MALE WC":case"M RESTROOM":c="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"ADA WC":c=t;break;case"IT":c="https://cdn.spacemob.co/img/IT_room@2x.png";break;case"PRINTER":c="https://cdn.spacemob.co/img/printer@2x.png";break;case"MECH":c="https://cdn.spacemob.co/img/mechanical@2x.png";break;case"STOR":case"STORE":c="https://cdn.spacemob.co/img/storage@2x.png";break;case"TRASH":c="https://cdn.spacemob.co/img/trash@2x.png";break;case"MOTHER RM":c="https://cdn.spacemob.co/img/motherroom@2x.png";break;case"F&B":c=r;break;case"MAIL":c="https://cdn.spacemob.co/img/mail_room@2x.png";break;case"SHOWER":c=t;break;case"SERVICE LIFT":c="https://cdn.spacemob.co/img/servicelift@2x.png";break;case"WELLNESS RM":c="https://cdn.spacemob.co/img/wellnessroom@2x.png";break;case"ELEC":c="https://cdn.spacemob.co/img/electrical@2x.png";break;case"FIRE":c="https://cdn.spacemob.co/img/fire_extinguisher@2x.png";break;case"MOP":case"JC":c="https://cdn.spacemob.co/img/maintenance@2x.png"}if(!c)switch(e){case"MEET":c="https://cdn.spacemob.co/img/meeting_room@2x.png"}return c},N=function(e){for(var a=1/0,c=1/0,t=-1/0,r=-1/0,s=0;s<e.length;s++)a=Math.min(a,e[s].x),c=Math.min(c,e[s].y),t=Math.max(t,e[s].x),r=Math.max(r,e[s].y);return{width:t-a,height:r-c}};e.createRenderObjects=function(e){var t=e.id,a=e.shapes,c=e.type,r=e.subType,s=e.programType,n=e.roomNumber,o=e.hasWindow,i=e.locationAngle,p=e.centroid,b=[],g="BACK",m="black",h=1,E=!1,u=H(s,6),l=L(s,6),d=v(s),x=I(s,r);if("object"===c)switch(r){case"CHAIR":d="rgb(206,206,206)",g="FRONT",l=-(6-(u=1))/2,m="black";break;case"TABLE":case"HOTDESK_TABLE":d="rgb(246,241,241)",g="FRONT",u=.5,l=-1.5,h=.7}else"space"===c||"room"===c||console.warn("invalid type:",c);var f={only:!1,color:m};switch(r){case"HALLWAY":case"ELEV LOBBY":f=null;break;case"PHONE BOOTH":case"PRINTER":m="#474747"}switch(s){case"MEET":switch(m="#474747",E=!0,r){case"NOOK":case"PHONE BOOTH":case"wt":E=!1}break;case"WORK":m="#EEB4B2",E=!0,o&&(d="rgb(228,243,247)");break;case"WASH":case"SERVE":m="#979797";break;case"OPERATE":case"WE":break;case"CIRCULATE":f=null;break;default:s&&console.log("invalid programType:",s)}f&&(f.color=m);var y=a,O={z:l},T=null;if(!y||0===y.length)switch(r){case"CHAIR":y=S(),(O=p).z=l,T={z:i};break;case"TABLE":y=W(),(O=p).z=l,T={z:i};break;case"HOTDESK_TABLE":y=C(),(O=p).z=l,T={z:i}}if(y&&0!==y.length){if(y.forEach(function(e,a){var c=t;0!==a&&(c=t+"/"+a),b.push({id:c,type:"MESH",style:{color:d,side:g,outline:f,opacity:h},points:e,interactable:!0,extrude:u,position:O,rotation:T})}),E&&n){var R=w(y[0]);x&&(R.y=R.y-2),b.push({id:n,type:"TEXT",text:n,position:R,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(x){var k=w(y[0]);E&&n&&(k.y=k.y+1);var A=3,M=N(y[0]);A>M.width?A=M.width-.1:A>M.height&&(A=M.height-.1),b.push({id:t+"_img",type:"SPRITE",position:k,scalar:1,style:{img:x,maxWidth:A},interactable:!1})}return b}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=w,e.getSize=N,e.stringArrayToPoints=function(e){if(e&&e.constructor===Array){var a=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&a.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),a}},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=floormap-utils.umd.min.js.map |
{ | ||
"name": "@wework/floormap-utils", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"browser": "dist/floormap-utils.min.js", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "dist/floormap-utils.es.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81793
1512