Skip to content

Commit

Permalink
fix pubpoint sprites loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfwind521 committed Feb 12, 2015
1 parent b8348da commit bdd1e79
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions js/IndoorMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
* Created by gaimeng on 14/12/27.
*/

var System={};
var js=document.scripts;
js=js[js.length-1].src.substring(0,js[js.length-1].src.lastIndexOf("/"));
System.path = js;
System.libPath = System.path.substring(0,System.path.lastIndexOf("/"));
System.imgPath = System.libPath+"/img";


//---------------------the GeomUtility class--------------------
function GeomUtility(){}

Expand Down Expand Up @@ -280,12 +288,12 @@ var defaultTheme = {

pubPointImg: {

"11001": "./img/toilet.png",
"11002": "./img/ATM.png",
"21001": "./img/stair.png",
"22006": "./img/entry.png",
"21002": "./img/escalator.png",
"21003": "./img/lift.png"
"11001": System.imgPath+"/toilet.png",
"11002": System.imgPath+"/ATM.png",
"21001": System.imgPath+"/stair.png",
"22006": System.imgPath+"/entry.png",
"21002": System.imgPath+"/escalator.png",
"21003": System.imgPath+"/lift.png"
}

////icons of the labels
Expand Down Expand Up @@ -953,9 +961,14 @@ var IndoorMap = function (params) {
var visible = true;
var visibleMargin = 5;
for(var j = 0; j < i; j++){
var img = sprite.material.map.image;
if(!img){
visible = false;
break;
}

var dis = sprite.position.distanceTo( _pubPointSprites.children[j].position ) ;

var img = sprite.material.map.image;
if(dis < img.width){
visible = false;
break;
Expand Down Expand Up @@ -1089,7 +1102,7 @@ var IndoorMap = function (params) {
if(_this.mall != null && _spriteMaterials.length == 0){
var images = _this.mall.theme.pubPointImg;
for(var key in images){
var texture = THREE.ImageUtils.loadTexture(images[key]);
var texture = THREE.ImageUtils.loadTexture(images[key], undefined, redraw);
var material = new THREE.SpriteMaterial({map:texture});
_spriteMaterials[key] = material;
}
Expand Down

0 comments on commit bdd1e79

Please sign in to comment.