Merge pull request #193 from zhaouv/bigmap

fix gameCanvas.style in editor-mobile
This commit is contained in:
Zhang Chen 2018-08-27 14:57:02 +08:00 committed by GitHub
commit 74e7d84d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 15 deletions

View File

@ -202,23 +202,23 @@ editor.prototype.drawEventBlock = function () {
fg.clearRect(0, 0, 416, 416);
for (var i=0;i<13;i++) {
for (var j=0;j<13;j++) {
var color=null;
var color=[];
var loc=(i+core.bigmap.offsetX/32)+","+(j+core.bigmap.offsetY/32);
if (core.isset(editor.currentFloorData.events[loc]))
color = '#FF0000';
else if (core.isset(editor.currentFloorData.changeFloor[loc]))
color = '#00FF00';
else if (core.isset(editor.currentFloorData.afterBattle[loc]))
color = '#FFFF00';
else if (core.isset(editor.currentFloorData.afterGetItem[loc]))
color = '#00FFFF';
else if (core.isset(editor.currentFloorData.afterOpenDoor[loc]))
color = '#FF00FF';
else if (core.isset(editor.currentFloorData.cannotMove[loc]))
color = '#0000FF';
if (color!=null) {
fg.fillStyle = color;
fg.fillRect(32*i, 32*j+32-8, 8, 8);
color.push('#FF0000');
if (core.isset(editor.currentFloorData.changeFloor[loc]))
color.push('#00FF00');
if (core.isset(editor.currentFloorData.afterBattle[loc]))
color.push('#FFFF00');
if (core.isset(editor.currentFloorData.afterGetItem[loc]))
color.push('#00FFFF');
if (core.isset(editor.currentFloorData.afterOpenDoor[loc]))
color.push('#FF00FF');
if (core.isset(editor.currentFloorData.cannotMove[loc]))
color.push('#0000FF');
for(var kk=0,cc;cc=color[kk];kk++){
fg.fillStyle = cc;
fg.fillRect(32*i+8*kk, 32*j+32-8, 8, 8);
}
}
}

View File

@ -986,6 +986,12 @@ control.prototype.setGameCanvasTranslate = function(canvas,x,y){
c.style.webkitTransform='translate('+x+'px,'+y+'px)';
c.style.OTransform='translate('+x+'px,'+y+'px)';
c.style.MozTransform='translate('+x+'px,'+y+'px)';
if(main.mode==='editor' && editor.isMobile){
c.style.transform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
c.style.webkitTransform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
c.style.OTransform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
c.style.MozTransform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
}
};
////// 更新视野范围 //////

View File

@ -192,6 +192,10 @@ maps.prototype.resizeMap = function(floorId) {
core.canvas[cn].canvas.setAttribute("height",cheight);
core.canvas[cn].canvas.style.width = cwidth*core.domStyle.scale + "px";
core.canvas[cn].canvas.style.height = cheight*core.domStyle.scale + "px";
if(main.mode==='editor' && editor.isMobile){
core.canvas[cn].canvas.style.width = core.bigmap.width*32/416*96 + "vw";
core.canvas[cn].canvas.style.height = core.bigmap.height*32/416*96 + "vw";
}
});
}