Skip to content

Commit

Permalink
fix the dpr bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfwind521 committed Apr 24, 2015
1 parent 3f1972f commit 200bcc9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Binary file added img/marker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions js/IndoorMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,15 @@ var IndoorMap = function (params) {
_this.is3d = false;
}

var marker = document.createElement("image");
marker.style.position = "absolute";
marker.style.src = System.imgPath+"/marker.png";
marker.visibility = false;
marker.style.width = "39px";
marker.style.height = "54px";
document.body.appendChild(marker);
_indoorMap.setSelectionMarker(marker);


}

Expand Down
18 changes: 14 additions & 4 deletions js/IndoorMap2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ IndoorMap2d = function(mapdiv){
var _selected, _selectedOldColor;
this.renderer = null;
this.is3d = false;
var _marker;

this.init = function(){
_this.renderer = new Canvas2DRenderer(_mapDiv);
Expand Down Expand Up @@ -115,6 +116,9 @@ IndoorMap2d = function(mapdiv){
redraw();
}

this.setSelectionMarker = function(marker){
_marker = marker;
}

//set if the objects are selectable
this.setSelectable = function (selectable) {
Expand All @@ -129,8 +133,14 @@ IndoorMap2d = function(mapdiv){

//select object(just hight light it)
function select(obj){
_selectedOldColor = obj.fillColor;
obj.fillColor = _this.mall.theme.selected;
if(obj != undefined) {
_selectedOldColor = obj.fillColor;
obj.fillColor = _this.mall.theme.selected;
pos = _this.renderer.localToWorld(obj.Center);
_marker.style.left = pos[0] - _marker.width / 2;
_marker.style.top = pos[1] - _marker.height / 2;
_marker.style.visibility = true;
}
}

function onSelectObject(event){
Expand Down Expand Up @@ -169,7 +179,6 @@ IndoorMap2d = function(mapdiv){
}

}

}

function redraw(){
Expand Down Expand Up @@ -252,8 +261,9 @@ Canvas2DRenderer = function (mapDiv) {
var _curFloor = null;

this.domElement = _canvas;
var _devicePixelRatio = window.devicePixelRatio;
//var _devicePixelRatio = window.devicePixelRatio;

var _devicePixelRatio = 1;
this.setDefaultView = function(object){
if(object._id != _oldId) {
var width = object.rect.br[0] - object.rect.tl[0];
Expand Down

0 comments on commit 200bcc9

Please sign in to comment.