Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wework/floormap-utils

Package Overview
Dependencies
Maintainers
18
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wework/floormap-utils - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

2

dist/floormap-utils.cjs.js

@@ -247,3 +247,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

pos$1 = centroid;
pos$1.z = zed;
pos$1.z = 0;
}

@@ -250,0 +250,0 @@ if (showRoomNumber && roomNumber) {

@@ -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,m=[],p="BACK",h="#474747",l=1,b=!1,E=getExtrude(s,6),u=getZed(s,6),O=getColor(s),T=getImage(s,c);if("object"===a)switch(c){case"CHAIR":O="rgb(206,206,206)",p="FRONT",u=-(6-(E=1))/2;break;case"TABLE":case"HOTDESK_TABLE":O="rgb(246,241,241)",p="FRONT",E=.5,u=-1.5,l=.7}else"space"===a||"room"===a||console.warn("invalid type:",a);var R={only:!1,color:h};switch(c){case"HALLWAY":case"ELEV LOBBY":R=null}switch(s){case"MEET":switch(b=!0,c){case"NOOK":case"PHONE BOOTH":case"wt":b=!1}break;case"WORK":b=!0,o&&(O="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":R=null;break;default:s&&console.log("invalid programType:",s)}R&&(R.color=h);var x=t,y={z:u},d=null;if(!x||0===x.length)if(g)switch(c){case"CHAIR":x=getChairGeometry(),(y=g).z=u,d={z:i};break;case"TABLE":x=getTableGeometry(),(y=g).z=u,d={z:i};break;case"HOTDESK_TABLE":x=getHotDeskTableGeometry(),(y=g).z=u,d={z:i}}else console.warn("centroid is not available",JSON.stringify(e));if(x&&0!==x.length){if(x.forEach(function(e,t){var a=r;0!==t&&(a=r+"/"+t),m.push({id:a,type:"MESH",style:{color:O,side:p,outline:R,opacity:l},points:e,interactable:!0,extrude:E,position:y,rotation:d})}),b&&n){var f=getCenter(x[0]);T&&(f.y=f.y-2),m.push({id:n,type:"TEXT",text:n,position:f,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(T){var A=getCenter(x[0]);g&&((A=g).z=u),b&&n&&(A.y=A.y+1);var M=3,S=getSize(x[0]);M>S.width?M=S.width-.1:M>S.height&&(M=S.height-.1),m.push({id:r+"_img",type:"SPRITE",position:A,scalar:1,style:{img:T,maxWidth:M},interactable:!1})}return m}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":case"BOOTHS":a=nook;break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":a=pantry;break;case"GAME RM":a=gameRoom;break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":a=women;break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":a=men;break;case"IT":a=itRoom;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":a=printer;break;case"MECH":a=mechanical;break;case"STOR":case"STORE":case"STORAGE":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":case"WELLNESS ROOM":a=wellness;break;case"ELEC":a=electrical;break;case"FIRE":a=fire;break;case"MOP":case"JC":case"JANITOR":a=maintenance;break;case"CONV. BOOTH":a=meeting}if(t.startsWith("IT ")&&(a=itRoom),!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,m=[],p="BACK",h="#474747",l=1,b=!1,E=getExtrude(s,6),u=getZed(s,6),O=getColor(s),T=getImage(s,c);if("object"===a)switch(c){case"CHAIR":O="rgb(206,206,206)",p="FRONT",u=-(6-(E=1))/2;break;case"TABLE":case"HOTDESK_TABLE":O="rgb(246,241,241)",p="FRONT",E=.5,u=-1.5,l=.7}else"space"===a||"room"===a||console.warn("invalid type:",a);var R={only:!1,color:h};switch(c){case"HALLWAY":case"ELEV LOBBY":R=null}switch(s){case"MEET":switch(b=!0,c){case"NOOK":case"PHONE BOOTH":case"wt":b=!1}break;case"WORK":b=!0,o&&(O="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":R=null;break;default:s&&console.log("invalid programType:",s)}R&&(R.color=h);var x=t,y={z:u},d=null;if(!x||0===x.length)if(g)switch(c){case"CHAIR":x=getChairGeometry(),(y=g).z=u,d={z:i};break;case"TABLE":x=getTableGeometry(),(y=g).z=u,d={z:i};break;case"HOTDESK_TABLE":x=getHotDeskTableGeometry(),(y=g).z=u,d={z:i}}else console.warn("centroid is not available",JSON.stringify(e));if(x&&0!==x.length){if(x.forEach(function(e,t){var a=r;0!==t&&(a=r+"/"+t),m.push({id:a,type:"MESH",style:{color:O,side:p,outline:R,opacity:l},points:e,interactable:!0,extrude:E,position:y,rotation:d})}),b&&n){var f=getCenter(x[0]);T&&(f.y=f.y-2),m.push({id:n,type:"TEXT",text:n,position:f,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(T){var A=getCenter(x[0]);g&&((A=g).z=0),b&&n&&(A.y=A.y+1);var M=3,S=getSize(x[0]);M>S.width?M=S.width-.1:M>S.height&&(M=S.height-.1),m.push({id:r+"_img",type:"SPRITE",position:A,scalar:1,style:{img:T,maxWidth:M},interactable:!1})}return m}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":case"BOOTHS":a=nook;break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":a=pantry;break;case"GAME RM":a=gameRoom;break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":a=women;break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":a=men;break;case"IT":a=itRoom;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":a=printer;break;case"MECH":a=mechanical;break;case"STOR":case"STORE":case"STORAGE":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":case"WELLNESS ROOM":a=wellness;break;case"ELEC":a=electrical;break;case"FIRE":a=fire;break;case"MOP":case"JC":case"JANITOR":a=maintenance;break;case"CONV. BOOTH":a=meeting}if(t.startsWith("IT ")&&(a=itRoom),!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

@@ -245,3 +245,3 @@ var nook = 'https://cdn.spacemob.co/img/nook@2x.png';

pos$1 = centroid;
pos$1.z = zed;
pos$1.z = 0;
}

@@ -248,0 +248,0 @@ if (showRoomNumber && roomNumber) {

@@ -251,3 +251,3 @@ (function (global, factory) {

pos$1 = centroid;
pos$1.z = zed;
pos$1.z = 0;
}

@@ -254,0 +254,0 @@ if (showRoomNumber && roomNumber) {

@@ -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/meeting_room@2x.png",s="https://cdn.spacemob.co/img/IT_room@2x.png",r="https://cdn.spacemob.co/img/pantry@2x.png",k=function(e){for(var a=1/0,c=1/0,t=-1/0,s=-1/0,r=0;r<e.length;r++)a=Math.min(a,e[r].x),c=Math.min(c,e[r].y),t=Math.max(t,e[r].x),s=Math.max(s,e[r].y);return{x:(t+a)/2,y:(s+c)/2}},N=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}]]},w=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}]]},C=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},H=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}},I=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)"}},L=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":case"BOOTHS":c="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":c=r;break;case"GAME RM":c="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":c="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":c="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"IT":c=s;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":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":case"STORAGE":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="https://cdn.spacemob.co/img/shower@2x.png";break;case"SERVICE LIFT":c="https://cdn.spacemob.co/img/servicelift@2x.png";break;case"WELLNESS RM":case"WELLNESS ROOM":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":case"JANITOR":c="https://cdn.spacemob.co/img/maintenance@2x.png";break;case"CONV. BOOTH":c=t}if(a.startsWith("IT ")&&(c=s),!c)switch(e){case"MEET":c=t}return c},v=function(e){for(var a=1/0,c=1/0,t=-1/0,s=-1/0,r=0;r<e.length;r++)a=Math.min(a,e[r].x),c=Math.min(c,e[r].y),t=Math.max(t,e[r].x),s=Math.max(s,e[r].y);return{width:t-a,height:s-c}};e.createRenderObjects=function(e){var t=e.id,a=e.shapes,c=e.type,s=e.subType,r=e.programType,n=e.roomNumber,o=e.hasWindow,i=e.locationAngle,p=e.centroid,g=[],h="BACK",m="#474747",E=1,b=!1,u=C(r,6),l=H(r,6),O=I(r),T=L(r,s);if("object"===c)switch(s){case"CHAIR":O="rgb(206,206,206)",h="FRONT",l=-(6-(u=1))/2;break;case"TABLE":case"HOTDESK_TABLE":O="rgb(246,241,241)",h="FRONT",u=.5,l=-1.5,E=.7}else"space"===c||"room"===c||console.warn("invalid type:",c);var d={only:!1,color:m};switch(s){case"HALLWAY":case"ELEV LOBBY":d=null}switch(r){case"MEET":switch(b=!0,s){case"NOOK":case"PHONE BOOTH":case"wt":b=!1}break;case"WORK":b=!0,o&&(O="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":d=null;break;default:r&&console.log("invalid programType:",r)}d&&(d.color=m);var x=a,R={z:l},f=null;if(!x||0===x.length)if(p)switch(s){case"CHAIR":x=N(),(R=p).z=l,f={z:i};break;case"TABLE":x=W(),(R=p).z=l,f={z:i};break;case"HOTDESK_TABLE":x=w(),(R=p).z=l,f={z:i}}else console.warn("centroid is not available",JSON.stringify(e));if(x&&0!==x.length){if(x.forEach(function(e,a){var c=t;0!==a&&(c=t+"/"+a),g.push({id:c,type:"MESH",style:{color:O,side:h,outline:d,opacity:E},points:e,interactable:!0,extrude:u,position:R,rotation:f})}),b&&n){var y=k(x[0]);T&&(y.y=y.y-2),g.push({id:n,type:"TEXT",text:n,position:y,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(T){var M=k(x[0]);p&&((M=p).z=l),b&&n&&(M.y=M.y+1);var A=3,S=v(x[0]);A>S.width?A=S.width-.1:A>S.height&&(A=S.height-.1),g.push({id:t+"_img",type:"SPRITE",position:M,scalar:1,style:{img:T,maxWidth:A},interactable:!1})}return g}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=k,e.getSize=v,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/meeting_room@2x.png",s="https://cdn.spacemob.co/img/IT_room@2x.png",r="https://cdn.spacemob.co/img/pantry@2x.png",k=function(e){for(var a=1/0,c=1/0,t=-1/0,s=-1/0,r=0;r<e.length;r++)a=Math.min(a,e[r].x),c=Math.min(c,e[r].y),t=Math.max(t,e[r].x),s=Math.max(s,e[r].y);return{x:(t+a)/2,y:(s+c)/2}},N=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}]]},w=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}]]},C=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},H=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}},I=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)"}},L=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":case"BOOTHS":c="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":c=r;break;case"GAME RM":c="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":c="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":c="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"IT":c=s;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":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":case"STORAGE":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="https://cdn.spacemob.co/img/shower@2x.png";break;case"SERVICE LIFT":c="https://cdn.spacemob.co/img/servicelift@2x.png";break;case"WELLNESS RM":case"WELLNESS ROOM":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":case"JANITOR":c="https://cdn.spacemob.co/img/maintenance@2x.png";break;case"CONV. BOOTH":c=t}if(a.startsWith("IT ")&&(c=s),!c)switch(e){case"MEET":c=t}return c},v=function(e){for(var a=1/0,c=1/0,t=-1/0,s=-1/0,r=0;r<e.length;r++)a=Math.min(a,e[r].x),c=Math.min(c,e[r].y),t=Math.max(t,e[r].x),s=Math.max(s,e[r].y);return{width:t-a,height:s-c}};e.createRenderObjects=function(e){var t=e.id,a=e.shapes,c=e.type,s=e.subType,r=e.programType,n=e.roomNumber,o=e.hasWindow,i=e.locationAngle,p=e.centroid,g=[],h="BACK",m="#474747",E=1,b=!1,u=C(r,6),l=H(r,6),O=I(r),T=L(r,s);if("object"===c)switch(s){case"CHAIR":O="rgb(206,206,206)",h="FRONT",l=-(6-(u=1))/2;break;case"TABLE":case"HOTDESK_TABLE":O="rgb(246,241,241)",h="FRONT",u=.5,l=-1.5,E=.7}else"space"===c||"room"===c||console.warn("invalid type:",c);var d={only:!1,color:m};switch(s){case"HALLWAY":case"ELEV LOBBY":d=null}switch(r){case"MEET":switch(b=!0,s){case"NOOK":case"PHONE BOOTH":case"wt":b=!1}break;case"WORK":b=!0,o&&(O="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":d=null;break;default:r&&console.log("invalid programType:",r)}d&&(d.color=m);var x=a,R={z:l},f=null;if(!x||0===x.length)if(p)switch(s){case"CHAIR":x=N(),(R=p).z=l,f={z:i};break;case"TABLE":x=W(),(R=p).z=l,f={z:i};break;case"HOTDESK_TABLE":x=w(),(R=p).z=l,f={z:i}}else console.warn("centroid is not available",JSON.stringify(e));if(x&&0!==x.length){if(x.forEach(function(e,a){var c=t;0!==a&&(c=t+"/"+a),g.push({id:c,type:"MESH",style:{color:O,side:h,outline:d,opacity:E},points:e,interactable:!0,extrude:u,position:R,rotation:f})}),b&&n){var y=k(x[0]);T&&(y.y=y.y-2),g.push({id:n,type:"TEXT",text:n,position:y,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(T){var M=k(x[0]);p&&((M=p).z=0),b&&n&&(M.y=M.y+1);var A=3,S=v(x[0]);A>S.width?A=S.width-.1:A>S.height&&(A=S.height-.1),g.push({id:t+"_img",type:"SPRITE",position:M,scalar:1,style:{img:T,maxWidth:A},interactable:!1})}return g}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=k,e.getSize=v,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.5.4",
"version": "0.5.5",
"jsnext:main": "dist/floormap-utils.es.js",

@@ -5,0 +5,0 @@ "module": "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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc