@wework/floormap-utils
Advanced tools
Comparing version 0.1.1 to 0.2.0
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// import { Box2, Vector2 } from './three' | ||
var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
@@ -21,9 +19,5 @@ var meeting = 'https://cdn.spacemob.co/img/meeting_room@2x.png'; | ||
// export const getCenter = (points) => { | ||
// let b = new Box2() | ||
// b.setFromPoints(points) | ||
// const c = b.getCenter(new Vector2()) | ||
// return { x: c.x, y: c.y } | ||
// } | ||
/** | ||
* Return {x, y} center given an array of points | ||
*/ | ||
var getCenter = function (points) { | ||
@@ -43,2 +37,5 @@ var minX = +Infinity; | ||
/** | ||
* Returns an array of RenderObjects to be used for FloormapGL | ||
*/ | ||
var createRenderObjects = function (params) { | ||
@@ -273,1 +270,2 @@ var id = params.id; | ||
exports.createRenderObjects = createRenderObjects; | ||
exports.getCenter = getCenter; |
@@ -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",getCenter=function(e){for(var a=1/0,o=1/0,c=-1/0,t=-1/0,r=0;r<e.length;r++)a=Math.min(a,e[r].x),o=Math.min(o,e[r].y),c=Math.max(c,e[r].x),t=Math.max(t,e[r].y);return{x:(c+a)/2,y:(t+o)/2}},createRenderObjects=function(e){var c=e.id,a=e.shapes,o=e.type,t=e.subType,r=e.programType,s=e.roomNumber,n=e.hasWindow,p=[],m="rgb(253,235,236)",i="BACK",b=6,g=0,h="black",l=1,d=!1,k=null;if("object"===o)switch(t){case"CHAIR":m="rgb(206,206,206)",i="FRONT",g=-(6-(b=1))/2,h="black";break;case"TABLE":m="rgb(246,241,241)",i="FRONT",b=.5,g=-1.5,l=.7;break;default:m="rgb(253,235,236)"}else"space"===o||"room"===o||console.warn("invalid type:",o);var E={only:!1,color:h};switch(t){case"HALLWAY":case"ELEV LOBBY":m="rgb(255,247,224)",E=null,b=.1,g=-3;break;case"PHONE BOOTH":m="#D8D8D8",h="#474747",k=phoneBooth;break;case"wt":case"NOOK":k=nook;break;case"LOUNGE":k=pantry,m="rgb(255,211,106)";break;case"GAME RM":k=gameRoom;break;case"WOMEN WC":k=women;break;case"MEN WC":k=men;break;case"ADA WC":k=shower;break;case"IT":k=itRoom;break;case"PRINTER":m="#D8D8D8",h="#474747",k=printer;break;case"JC":case"MECH":k=mechanical;break;case"STOR":k=storage;break;case"TRASH":k=trash;break;case"MOTHER RM":k=motherRoom;break;case"F&B":k=pantry;break;case"MAIL":k=mail;break;case"SHOWER":k=shower}switch(r){case"MEET":switch(m="rgb(184,240,218)",h="#474747",d=!0,k||(k=meeting),t){case"NOOK":case"PHONE BOOTH":case"wt":d=!1}break;case"WORK":m="rgb(228,243,247)",h="#EEB4B2",d=!0,n||(m="rgb(172,222,232)");break;case"WASH":case"SERVE":m="#D8D8D8",h="#979797";break;case"OPERATE":case"WE":case"CIRCULATE":break;default:r&&console.log("invalid programType:",r)}if(E&&(E.color=h),a.forEach(function(e,a){var o=c;0!==a&&(o=c+"/"+a),p.push({id:o,type:"MESH",style:{color:m,side:i,outline:E,opacity:l},points:e,interactable:!0,extrude:b,position:{z:g}})}),d&&s){var x=getCenter(a[0]);k&&(x.y=x.y-2),p.push({id:s,type:"TEXT",text:s,position:x,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(k){var y=getCenter(a[0]);d&&s&&(y.y=y.y+1),p.push({id:c+"_img",type:"SPRITE",position:y,scalar:1,style:{img:k,maxWidth:3},interactable:!1})}return p};exports.createRenderObjects=createRenderObjects; | ||
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",getCenter=function(e){for(var a=1/0,o=1/0,t=-1/0,c=-1/0,r=0;r<e.length;r++)a=Math.min(a,e[r].x),o=Math.min(o,e[r].y),t=Math.max(t,e[r].x),c=Math.max(c,e[r].y);return{x:(t+a)/2,y:(c+o)/2}},createRenderObjects=function(e){var t=e.id,a=e.shapes,o=e.type,c=e.subType,r=e.programType,s=e.roomNumber,n=e.hasWindow,p=[],m="rgb(253,235,236)",i="BACK",b=6,g=0,h="black",l=1,d=!1,k=null;if("object"===o)switch(c){case"CHAIR":m="rgb(206,206,206)",i="FRONT",g=-(6-(b=1))/2,h="black";break;case"TABLE":m="rgb(246,241,241)",i="FRONT",b=.5,g=-1.5,l=.7;break;default:m="rgb(253,235,236)"}else"space"===o||"room"===o||console.warn("invalid type:",o);var E={only:!1,color:h};switch(c){case"HALLWAY":case"ELEV LOBBY":m="rgb(255,247,224)",E=null,b=.1,g=-3;break;case"PHONE BOOTH":m="#D8D8D8",h="#474747",k=phoneBooth;break;case"wt":case"NOOK":k=nook;break;case"LOUNGE":k=pantry,m="rgb(255,211,106)";break;case"GAME RM":k=gameRoom;break;case"WOMEN WC":k=women;break;case"MEN WC":k=men;break;case"ADA WC":k=shower;break;case"IT":k=itRoom;break;case"PRINTER":m="#D8D8D8",h="#474747",k=printer;break;case"JC":case"MECH":k=mechanical;break;case"STOR":k=storage;break;case"TRASH":k=trash;break;case"MOTHER RM":k=motherRoom;break;case"F&B":k=pantry;break;case"MAIL":k=mail;break;case"SHOWER":k=shower}switch(r){case"MEET":switch(m="rgb(184,240,218)",h="#474747",d=!0,k||(k=meeting),c){case"NOOK":case"PHONE BOOTH":case"wt":d=!1}break;case"WORK":m="rgb(228,243,247)",h="#EEB4B2",d=!0,n||(m="rgb(172,222,232)");break;case"WASH":case"SERVE":m="#D8D8D8",h="#979797";break;case"OPERATE":case"WE":case"CIRCULATE":break;default:r&&console.log("invalid programType:",r)}if(E&&(E.color=h),a.forEach(function(e,a){var o=t;0!==a&&(o=t+"/"+a),p.push({id:o,type:"MESH",style:{color:m,side:i,outline:E,opacity:l},points:e,interactable:!0,extrude:b,position:{z:g}})}),d&&s){var x=getCenter(a[0]);k&&(x.y=x.y-2),p.push({id:s,type:"TEXT",text:s,position:x,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(k){var y=getCenter(a[0]);d&&s&&(y.y=y.y+1),p.push({id:t+"_img",type:"SPRITE",position:y,scalar:1,style:{img:k,maxWidth:3},interactable:!1})}return p};exports.createRenderObjects=createRenderObjects,exports.getCenter=getCenter; | ||
//# sourceMappingURL=floormap-utils.cjs.min.js.map |
@@ -1,3 +0,1 @@ | ||
// import { Box2, Vector2 } from './three' | ||
var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
@@ -19,9 +17,5 @@ var meeting = 'https://cdn.spacemob.co/img/meeting_room@2x.png'; | ||
// export const getCenter = (points) => { | ||
// let b = new Box2() | ||
// b.setFromPoints(points) | ||
// const c = b.getCenter(new Vector2()) | ||
// return { x: c.x, y: c.y } | ||
// } | ||
/** | ||
* Return {x, y} center given an array of points | ||
*/ | ||
var getCenter = function (points) { | ||
@@ -41,2 +35,5 @@ var minX = +Infinity; | ||
/** | ||
* Returns an array of RenderObjects to be used for FloormapGL | ||
*/ | ||
var createRenderObjects = function (params) { | ||
@@ -270,2 +267,2 @@ var id = params.id; | ||
export { createRenderObjects }; | ||
export { createRenderObjects, getCenter }; |
@@ -7,4 +7,2 @@ (function (global, factory) { | ||
// import { Box2, Vector2 } from './three' | ||
var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
@@ -26,9 +24,5 @@ var meeting = 'https://cdn.spacemob.co/img/meeting_room@2x.png'; | ||
// export const getCenter = (points) => { | ||
// let b = new Box2() | ||
// b.setFromPoints(points) | ||
// const c = b.getCenter(new Vector2()) | ||
// return { x: c.x, y: c.y } | ||
// } | ||
/** | ||
* Return {x, y} center given an array of points | ||
*/ | ||
var getCenter = function (points) { | ||
@@ -48,2 +42,5 @@ var minX = +Infinity; | ||
/** | ||
* Returns an array of RenderObjects to be used for FloormapGL | ||
*/ | ||
var createRenderObjects = function (params) { | ||
@@ -278,2 +275,3 @@ var id = params.id; | ||
exports.createRenderObjects = createRenderObjects; | ||
exports.getCenter = getCenter; | ||
@@ -280,0 +278,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -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 f="https://cdn.spacemob.co/img/shower@2x.png",u="https://cdn.spacemob.co/img/pantry@2x.png",O=function(e){for(var a=1/0,c=1/0,o=-1/0,t=-1/0,s=0;s<e.length;s++)a=Math.min(a,e[s].x),c=Math.min(c,e[s].y),o=Math.max(o,e[s].x),t=Math.max(t,e[s].y);return{x:(o+a)/2,y:(t+c)/2}};e.createRenderObjects=function(e){var o=e.id,a=e.shapes,c=e.type,t=e.subType,s=e.programType,r=e.roomNumber,n=e.hasWindow,p=[],i="rgb(253,235,236)",b="BACK",m=6,g=0,h="black",d=1,l=!1,E=null;if("object"===c)switch(t){case"CHAIR":i="rgb(206,206,206)",b="FRONT",g=-(6-(m=1))/2,h="black";break;case"TABLE":i="rgb(246,241,241)",b="FRONT",m=.5,g=-1.5,d=.7;break;default:i="rgb(253,235,236)"}else"space"===c||"room"===c||console.warn("invalid type:",c);var k={only:!1,color:h};switch(t){case"HALLWAY":case"ELEV LOBBY":i="rgb(255,247,224)",k=null,m=.1,g=-3;break;case"PHONE BOOTH":i="#D8D8D8",h="#474747",E="https://cdn.spacemob.co/img/phone_booth@2x.png";break;case"wt":case"NOOK":E="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":E=u,i="rgb(255,211,106)";break;case"GAME RM":E="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":E="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":E="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"ADA WC":E=f;break;case"IT":E="https://cdn.spacemob.co/img/IT_room@2x.png";break;case"PRINTER":i="#D8D8D8",h="#474747",E="https://cdn.spacemob.co/img/printer@2x.png";break;case"JC":case"MECH":E="https://cdn.spacemob.co/img/mechanical@2x.png";break;case"STOR":E="https://cdn.spacemob.co/img/storage@2x.png";break;case"TRASH":E="https://cdn.spacemob.co/img/trash@2x.png";break;case"MOTHER RM":E="https://cdn.spacemob.co/img/motherroom@2x.png";break;case"F&B":E=u;break;case"MAIL":E="https://cdn.spacemob.co/img/mail_room@2x.png";break;case"SHOWER":E=f}switch(s){case"MEET":switch(i="rgb(184,240,218)",h="#474747",l=!0,E||(E="https://cdn.spacemob.co/img/meeting_room@2x.png"),t){case"NOOK":case"PHONE BOOTH":case"wt":l=!1}break;case"WORK":i="rgb(228,243,247)",h="#EEB4B2",l=!0,n||(i="rgb(172,222,232)");break;case"WASH":case"SERVE":i="#D8D8D8",h="#979797";break;case"OPERATE":case"WE":case"CIRCULATE":break;default:s&&console.log("invalid programType:",s)}if(k&&(k.color=h),a.forEach(function(e,a){var c=o;0!==a&&(c=o+"/"+a),p.push({id:c,type:"MESH",style:{color:i,side:b,outline:k,opacity:d},points:e,interactable:!0,extrude:m,position:{z:g}})}),l&&r){var x=O(a[0]);E&&(x.y=x.y-2),p.push({id:r,type:"TEXT",text:r,position:x,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(E){var y=O(a[0]);l&&r&&(y.y=y.y+1),p.push({id:o+"_img",type:"SPRITE",position:y,scalar:1,style:{img:E,maxWidth:3},interactable:!1})}return p},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 f="https://cdn.spacemob.co/img/shower@2x.png",u="https://cdn.spacemob.co/img/pantry@2x.png",O=function(e){for(var a=1/0,c=1/0,o=-1/0,t=-1/0,s=0;s<e.length;s++)a=Math.min(a,e[s].x),c=Math.min(c,e[s].y),o=Math.max(o,e[s].x),t=Math.max(t,e[s].y);return{x:(o+a)/2,y:(t+c)/2}};e.createRenderObjects=function(e){var o=e.id,a=e.shapes,c=e.type,t=e.subType,s=e.programType,r=e.roomNumber,n=e.hasWindow,p=[],i="rgb(253,235,236)",b="BACK",m=6,g=0,h="black",d=1,l=!1,E=null;if("object"===c)switch(t){case"CHAIR":i="rgb(206,206,206)",b="FRONT",g=-(6-(m=1))/2,h="black";break;case"TABLE":i="rgb(246,241,241)",b="FRONT",m=.5,g=-1.5,d=.7;break;default:i="rgb(253,235,236)"}else"space"===c||"room"===c||console.warn("invalid type:",c);var k={only:!1,color:h};switch(t){case"HALLWAY":case"ELEV LOBBY":i="rgb(255,247,224)",k=null,m=.1,g=-3;break;case"PHONE BOOTH":i="#D8D8D8",h="#474747",E="https://cdn.spacemob.co/img/phone_booth@2x.png";break;case"wt":case"NOOK":E="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":E=u,i="rgb(255,211,106)";break;case"GAME RM":E="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":E="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":E="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"ADA WC":E=f;break;case"IT":E="https://cdn.spacemob.co/img/IT_room@2x.png";break;case"PRINTER":i="#D8D8D8",h="#474747",E="https://cdn.spacemob.co/img/printer@2x.png";break;case"JC":case"MECH":E="https://cdn.spacemob.co/img/mechanical@2x.png";break;case"STOR":E="https://cdn.spacemob.co/img/storage@2x.png";break;case"TRASH":E="https://cdn.spacemob.co/img/trash@2x.png";break;case"MOTHER RM":E="https://cdn.spacemob.co/img/motherroom@2x.png";break;case"F&B":E=u;break;case"MAIL":E="https://cdn.spacemob.co/img/mail_room@2x.png";break;case"SHOWER":E=f}switch(s){case"MEET":switch(i="rgb(184,240,218)",h="#474747",l=!0,E||(E="https://cdn.spacemob.co/img/meeting_room@2x.png"),t){case"NOOK":case"PHONE BOOTH":case"wt":l=!1}break;case"WORK":i="rgb(228,243,247)",h="#EEB4B2",l=!0,n||(i="rgb(172,222,232)");break;case"WASH":case"SERVE":i="#D8D8D8",h="#979797";break;case"OPERATE":case"WE":case"CIRCULATE":break;default:s&&console.log("invalid programType:",s)}if(k&&(k.color=h),a.forEach(function(e,a){var c=o;0!==a&&(c=o+"/"+a),p.push({id:c,type:"MESH",style:{color:i,side:b,outline:k,opacity:d},points:e,interactable:!0,extrude:m,position:{z:g}})}),l&&r){var x=O(a[0]);E&&(x.y=x.y-2),p.push({id:r,type:"TEXT",text:r,position:x,scalar:1.7,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(E){var y=O(a[0]);l&&r&&(y.y=y.y+1),p.push({id:o+"_img",type:"SPRITE",position:y,scalar:1,style:{img:E,maxWidth:3},interactable:!1})}return p},e.getCenter=O,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=floormap-utils.umd.min.js.map |
@@ -1,1 +0,1 @@ | ||
export { createRenderObjects } from './src/spatial-service.js' | ||
export { createRenderObjects, getCenter } from './src/spatial-service.js' |
{ | ||
"name": "@wework/floormap-utils", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"browser": "dist/floormap-utils.min.js", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "dist/floormap-utils.es.js", |
@@ -1,3 +0,1 @@ | ||
// import { Box2, Vector2 } from './three' | ||
const nook = 'https://cdn.spacemob.co/img/nook@2x.png' | ||
@@ -19,9 +17,5 @@ const meeting = 'https://cdn.spacemob.co/img/meeting_room@2x.png' | ||
// export const getCenter = (points) => { | ||
// let b = new Box2() | ||
// b.setFromPoints(points) | ||
// const c = b.getCenter(new Vector2()) | ||
// return { x: c.x, y: c.y } | ||
// } | ||
/** | ||
* Return {x, y} center given an array of points | ||
*/ | ||
export const getCenter = (points) => { | ||
@@ -41,2 +35,5 @@ let minX = +Infinity | ||
/** | ||
* Returns an array of RenderObjects to be used for FloormapGL | ||
*/ | ||
export const createRenderObjects = (params) => { | ||
@@ -43,0 +40,0 @@ const { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
83515
1493