@wework/floormap-utils
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -115,3 +115,2 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
case 'MEET': | ||
// color = 'rgb(184,240,218)' | ||
outlineColor = '#474747'; | ||
@@ -138,3 +137,2 @@ showRoomNumber = true; | ||
case 'SERVE': | ||
// color = '#D8D8D8' | ||
outlineColor = '#979797'; | ||
@@ -275,4 +273,2 @@ break | ||
// TODO: fit image to space | ||
var getChairGeometry = function () { | ||
@@ -423,2 +419,4 @@ var shapes = [ | ||
case 'LOUNGE': | ||
case 'HONESTY MKT': | ||
case 'HONESTY MARKET': | ||
case 'PANTRY': | ||
@@ -448,2 +446,4 @@ img = pantry; | ||
case 'PRINTER': | ||
case 'PRINT': | ||
case 'PRINTER NOOK': | ||
img = printer; | ||
@@ -478,2 +478,3 @@ break | ||
case 'WELLNESS RM': | ||
case 'WELLNESS ROOM': | ||
img = wellness; | ||
@@ -492,5 +493,11 @@ break | ||
break | ||
case 'CONV. BOOTH': | ||
img = meeting; | ||
break | ||
default: | ||
break | ||
} | ||
if (subType.startsWith('IT ')) { | ||
img = itRoom; | ||
} | ||
if (!img) { | ||
@@ -497,0 +504,0 @@ switch (programType) { |
@@ -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),T=getColor(s),x=getImage(s,c);if("object"===a)switch(c){case"CHAIR":T="rgb(206,206,206)",m="FRONT",u=-(6-(E=1))/2,h="black";break;case"TABLE":case"HOTDESK_TABLE":T="rgb(246,241,241)",m="FRONT",E=.5,u=-1.5,b=.7}else"space"===a||"room"===a||console.warn("invalid type:",a);var y={only:!1,color:h};switch(c){case"HALLWAY":case"ELEV LOBBY":y=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&&(T="rgb(228,243,247)");break;case"WASH":case"SERVE":h="#979797";break;case"OPERATE":case"WE":break;case"CIRCULATE":y=null;break;default:s&&console.log("invalid programType:",s)}y&&(y.color=h);var O=t,R={z:u},d=null;if(!O||0===O.length)switch(c){case"CHAIR":O=getChairGeometry(),(R=g).z=u,d={z:i};break;case"TABLE":O=getTableGeometry(),(R=g).z=u,d={z:i};break;case"HOTDESK_TABLE":O=getHotDeskTableGeometry(),(R=g).z=u,d={z:i}}if(O&&0!==O.length){if(O.forEach(function(e,t){var a=r;0!==t&&(a=r+"/"+t),p.push({id:a,type:"MESH",style:{color:T,side:m,outline:y,opacity:b},points:e,interactable:!0,extrude:E,position:R,rotation:d})}),l&&n){var f=getCenter(O[0]);x&&(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(x){var k=getCenter(O[0]);g&&((k=g).z=u),l&&n&&(k.y=k.y+1);var A=3,M=getSize(O[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:x,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":case"BOOTHS":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":case"UNISEX":case"ADA RESTROOM":case"ADA WC":a=women;break;case"MEN WC":case"MALE WC":case"M RESTROOM":a=men;break;case"IT":a=itRoom;break;case"PRINTER":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":a=wellness;break;case"ELEC":a=electrical;break;case"FIRE":a=fire;break;case"MOP":case"JC":case"JANITOR":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,m=[],p="BACK",h="black",b=1,E=!1,l=getExtrude(s,6),T=getZed(s,6),O=getColor(s),u=getImage(s,c);if("object"===a)switch(c){case"CHAIR":O="rgb(206,206,206)",p="FRONT",T=-(6-(l=1))/2,h="black";break;case"TABLE":case"HOTDESK_TABLE":O="rgb(246,241,241)",p="FRONT",l=.5,T=-1.5,b=.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;break;case"PHONE BOOTH":case"PRINTER":h="#474747"}switch(s){case"MEET":switch(h="#474747",E=!0,c){case"NOOK":case"PHONE BOOTH":case"wt":E=!1}break;case"WORK":h="#EEB4B2",E=!0,o&&(O="rgb(228,243,247)");break;case"WASH":case"SERVE":h="#979797";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:T},d=null;if(!x||0===x.length)switch(c){case"CHAIR":x=getChairGeometry(),(y=g).z=T,d={z:i};break;case"TABLE":x=getTableGeometry(),(y=g).z=T,d={z:i};break;case"HOTDESK_TABLE":x=getHotDeskTableGeometry(),(y=g).z=T,d={z:i}}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:b},points:e,interactable:!0,extrude:l,position:y,rotation:d})}),E&&n){var f=getCenter(x[0]);u&&(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(u){var k=getCenter(x[0]);g&&((k=g).z=T),E&&n&&(k.y=k.y+1);var A=3,M=getSize(x[0]);A>M.width?A=M.width-.1:A>M.height&&(A=M.height-.1),m.push({id:r+"_img",type:"SPRITE",position:k,scalar:1,style:{img:u,maxWidth:A},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"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":a=women;break;case"MEN 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 |
@@ -113,3 +113,2 @@ var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
case 'MEET': | ||
// color = 'rgb(184,240,218)' | ||
outlineColor = '#474747'; | ||
@@ -136,3 +135,2 @@ showRoomNumber = true; | ||
case 'SERVE': | ||
// color = '#D8D8D8' | ||
outlineColor = '#979797'; | ||
@@ -273,4 +271,2 @@ break | ||
// TODO: fit image to space | ||
var getChairGeometry = function () { | ||
@@ -421,2 +417,4 @@ var shapes = [ | ||
case 'LOUNGE': | ||
case 'HONESTY MKT': | ||
case 'HONESTY MARKET': | ||
case 'PANTRY': | ||
@@ -446,2 +444,4 @@ img = pantry; | ||
case 'PRINTER': | ||
case 'PRINT': | ||
case 'PRINTER NOOK': | ||
img = printer; | ||
@@ -476,2 +476,3 @@ break | ||
case 'WELLNESS RM': | ||
case 'WELLNESS ROOM': | ||
img = wellness; | ||
@@ -490,5 +491,11 @@ break | ||
break | ||
case 'CONV. BOOTH': | ||
img = meeting; | ||
break | ||
default: | ||
break | ||
} | ||
if (subType.startsWith('IT ')) { | ||
img = itRoom; | ||
} | ||
if (!img) { | ||
@@ -495,0 +502,0 @@ switch (programType) { |
@@ -119,3 +119,2 @@ (function (global, factory) { | ||
case 'MEET': | ||
// color = 'rgb(184,240,218)' | ||
outlineColor = '#474747'; | ||
@@ -142,3 +141,2 @@ showRoomNumber = true; | ||
case 'SERVE': | ||
// color = '#D8D8D8' | ||
outlineColor = '#979797'; | ||
@@ -279,4 +277,2 @@ break | ||
// TODO: fit image to space | ||
var getChairGeometry = function () { | ||
@@ -427,2 +423,4 @@ var shapes = [ | ||
case 'LOUNGE': | ||
case 'HONESTY MKT': | ||
case 'HONESTY MARKET': | ||
case 'PANTRY': | ||
@@ -452,2 +450,4 @@ img = pantry; | ||
case 'PRINTER': | ||
case 'PRINT': | ||
case 'PRINTER NOOK': | ||
img = printer; | ||
@@ -482,2 +482,3 @@ break | ||
case 'WELLNESS RM': | ||
case 'WELLNESS ROOM': | ||
img = wellness; | ||
@@ -496,5 +497,11 @@ break | ||
break | ||
case 'CONV. BOOTH': | ||
img = meeting; | ||
break | ||
default: | ||
break | ||
} | ||
if (subType.startsWith('IT ')) { | ||
img = itRoom; | ||
} | ||
if (!img) { | ||
@@ -501,0 +508,0 @@ switch (programType) { |
@@ -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/pantry@2x.png",S=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}},w=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}]]},H=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}},I=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}},L=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)"}},N=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"PANTRY":c=t;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":case"UNISEX":case"ADA RESTROOM":case"ADA WC":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"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":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=t;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":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"}if(!c)switch(e){case"MEET":c="https://cdn.spacemob.co/img/meeting_room@2x.png"}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=[],b="BACK",m="black",h=1,E=!1,u=C(r,6),l=I(r,6),d=L(r),O=N(r,s);if("object"===c)switch(s){case"CHAIR":d="rgb(206,206,206)",b="FRONT",l=-(6-(u=1))/2,m="black";break;case"TABLE":case"HOTDESK_TABLE":d="rgb(246,241,241)",b="FRONT",u=.5,l=-1.5,h=.7}else"space"===c||"room"===c||console.warn("invalid type:",c);var x={only:!1,color:m};switch(s){case"HALLWAY":case"ELEV LOBBY":x=null;break;case"PHONE BOOTH":case"PRINTER":m="#474747"}switch(r){case"MEET":switch(m="#474747",E=!0,s){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":x=null;break;default:r&&console.log("invalid programType:",r)}x&&(x.color=m);var T=a,f={z:l},y=null;if(!T||0===T.length)switch(s){case"CHAIR":T=w(),(f=p).z=l,y={z:i};break;case"TABLE":T=W(),(f=p).z=l,y={z:i};break;case"HOTDESK_TABLE":T=H(),(f=p).z=l,y={z:i}}if(T&&0!==T.length){if(T.forEach(function(e,a){var c=t;0!==a&&(c=t+"/"+a),g.push({id:c,type:"MESH",style:{color:d,side:b,outline:x,opacity:h},points:e,interactable:!0,extrude:u,position:f,rotation:y})}),E&&n){var R=S(T[0]);O&&(R.y=R.y-2),g.push({id:n,type:"TEXT",text:n,position:R,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(O){var A=S(T[0]);p&&((A=p).z=l),E&&n&&(A.y=A.y+1);var k=3,M=v(T[0]);k>M.width?k=M.width-.1:k>M.height&&(k=M.height-.1),g.push({id:t+"_img",type:"SPRITE",position:A,scalar:1,style:{img:O,maxWidth:k},interactable:!1})}return g}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=S,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",S=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}]]},H=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}]]},w=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},I=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}},C=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"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"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,E=[],b="BACK",g="black",h=1,m=!1,u=w(r,6),l=I(r,6),O=C(r),T=L(r,s);if("object"===c)switch(s){case"CHAIR":O="rgb(206,206,206)",b="FRONT",l=-(6-(u=1))/2,g="black";break;case"TABLE":case"HOTDESK_TABLE":O="rgb(246,241,241)",b="FRONT",u=.5,l=-1.5,h=.7}else"space"===c||"room"===c||console.warn("invalid type:",c);var d={only:!1,color:g};switch(s){case"HALLWAY":case"ELEV LOBBY":d=null;break;case"PHONE BOOTH":case"PRINTER":g="#474747"}switch(r){case"MEET":switch(g="#474747",m=!0,s){case"NOOK":case"PHONE BOOTH":case"wt":m=!1}break;case"WORK":g="#EEB4B2",m=!0,o&&(O="rgb(228,243,247)");break;case"WASH":case"SERVE":g="#979797";break;case"OPERATE":case"WE":break;case"CIRCULATE":d=null;break;default:r&&console.log("invalid programType:",r)}d&&(d.color=g);var x=a,R={z:l},f=null;if(!x||0===x.length)switch(s){case"CHAIR":x=N(),(R=p).z=l,f={z:i};break;case"TABLE":x=H(),(R=p).z=l,f={z:i};break;case"HOTDESK_TABLE":x=W(),(R=p).z=l,f={z:i}}if(x&&0!==x.length){if(x.forEach(function(e,a){var c=t;0!==a&&(c=t+"/"+a),E.push({id:c,type:"MESH",style:{color:O,side:b,outline:d,opacity:h},points:e,interactable:!0,extrude:u,position:R,rotation:f})}),m&&n){var y=S(x[0]);T&&(y.y=y.y-2),E.push({id:n,type:"TEXT",text:n,position:y,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(T){var A=S(x[0]);p&&((A=p).z=l),m&&n&&(A.y=A.y+1);var M=3,k=v(x[0]);M>k.width?M=k.width-.1:M>k.height&&(M=k.height-.1),E.push({id:t+"_img",type:"SPRITE",position:A,scalar:1,style:{img:T,maxWidth:M},interactable:!1})}return E}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=S,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.1", | ||
"version": "0.5.2", | ||
"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
84088
1558