| 720 | | // set real start position of centerTile |
|---|
| 721 | | var startPosX = (tile.position.x + |
|---|
| 722 | | parseInt(this.map.layerContainerDiv.style.left)); |
|---|
| 723 | | // set new left position |
|---|
| 724 | | var leftOffset = newTileSize.w / tile.size.w |
|---|
| 725 | | * (centerPx.x - startPosX); |
|---|
| 726 | | leftOffset = Math.round(leftOffset); |
|---|
| 727 | | var newLeftPos = centerPx.x - leftOffset |
|---|
| 728 | | - parseInt(this.map.layerContainerDiv.style.left); |
|---|
| 729 | | tile.imgDiv.style.left = Math.round(newLeftPos) + "px"; |
|---|
| 730 | | |
|---|
| 731 | | // set real start position of centerTile |
|---|
| 732 | | var startPosY = (tile.position.y + |
|---|
| 733 | | parseInt(this.map.layerContainerDiv.style.top)); |
|---|
| 734 | | //set new top position |
|---|
| 735 | | var topOffset = newTileSize.h / tile.size.h |
|---|
| 736 | | * (centerPx.y - startPosY); |
|---|
| 737 | | topOffset = Math.round(topOffset); |
|---|
| 738 | | var newTopPos = centerPx.y - topOffset |
|---|
| 739 | | - parseInt(this.map.layerContainerDiv.style.top); |
|---|
| 740 | | tile.imgDiv.style.top = Math.round(newTopPos) + "px"; |
|---|
| 741 | | |
|---|
| 742 | | //set new width and height |
|---|
| 743 | | tile.imgDiv.style.width = Math.round(newTileSize.w) + "px"; |
|---|
| 744 | | tile.imgDiv.style.height = Math.round(newTileSize.h) + "px"; |
|---|
| 745 | | |
|---|
| | 720 | if ((newTileSize.w < Math.pow(2,15)) && |
|---|
| | 721 | (newTileSize.h < Math.pow(2,15)) ){ |
|---|
| | 722 | |
|---|
| | 723 | // set real start position of centerTile |
|---|
| | 724 | var startPosX = (tile.position.x + |
|---|
| | 725 | parseInt(this.map.layerContainerDiv.style.left)); |
|---|
| | 726 | // set new left position |
|---|
| | 727 | var leftOffset = newTileSize.w / tile.size.w |
|---|
| | 728 | * (centerPx.x - startPosX); |
|---|
| | 729 | leftOffset = Math.round(leftOffset); |
|---|
| | 730 | var newLeftPos = centerPx.x - leftOffset |
|---|
| | 731 | - parseInt(this.map.layerContainerDiv.style.left); |
|---|
| | 732 | tile.imgDiv.style.left = Math.round(newLeftPos) + "px"; |
|---|
| | 733 | |
|---|
| | 734 | // set real start position of centerTile |
|---|
| | 735 | var startPosY = (tile.position.y + |
|---|
| | 736 | parseInt(this.map.layerContainerDiv.style.top)); |
|---|
| | 737 | //set new top position |
|---|
| | 738 | var topOffset = newTileSize.h / tile.size.h |
|---|
| | 739 | * (centerPx.y - startPosY); |
|---|
| | 740 | topOffset = Math.round(topOffset); |
|---|
| | 741 | var newTopPos = centerPx.y - topOffset |
|---|
| | 742 | - parseInt(this.map.layerContainerDiv.style.top); |
|---|
| | 743 | tile.imgDiv.style.top = Math.round(newTopPos) + "px"; |
|---|
| | 744 | |
|---|
| | 745 | //set new width and height |
|---|
| | 746 | tile.imgDiv.style.width = Math.round(newTileSize.w) + "px"; |
|---|
| | 747 | tile.imgDiv.style.height = Math.round(newTileSize.h) + "px"; |
|---|
| | 748 | } |
|---|