diff --git a/_server/editor.js b/_server/editor.js index 8bf28c04..5afe7a24 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -769,9 +769,14 @@ editor.prototype.drawInitData = function (icons) { } var width = images[img].width, height = images[img].height, mh = height; if (editor.uivalues.folded) { - var per_height = (img == 'enemy48' || img == 'npc48' ? 48 : 32); - width = Math.ceil(height / per_height / editor.uivalues.foldPerCol) * 32; - if (width > 32) mh = per_height * editor.uivalues.foldPerCol; + if (img == 'terrains') { + width = Math.ceil((height / 32 + 2) / editor.uivalues.foldPerCol) * 32; + if (width > 32) mh = 32 * editor.uivalues.foldPerCol; + } else { + var per_height = (img == 'enemy48' || img == 'npc48' ? 48 : 32); + width = Math.ceil(height / per_height / editor.uivalues.foldPerCol) * 32; + if (width > 32) mh = per_height * editor.uivalues.foldPerCol; + } } editor.widthsX[img] = [img, sumWidth / 32, (sumWidth + width) / 32, height]; sumWidth += width; @@ -852,10 +857,14 @@ editor.prototype.drawInitData = function (icons) { })(editor.airwallImg,nowx); if (editor.uivalues.folded) { // --- 单列 & 折行 - var subimgs = core.splitImage(images[img], 32, editor.uivalues.foldPerCol * 32); + var canvas = document.createElement("canvas"); + canvas.width = 32; + canvas.height = images[img].height + 64; + canvas.getContext('2d').drawImage(images[img], 0, 64); + var subimgs = core.splitImage(canvas, 32, editor.uivalues.foldPerCol * 32); var frames = images[img].width / 32; for (var i = 0; i < subimgs.length; i+=frames) { - drawImage(subimgs[i], nowx, i==0?2*32:0, img); + drawImage(subimgs[i], nowx, 0, img); nowx += 32; } } diff --git a/_server/editor_materialpanel.js b/_server/editor_materialpanel.js index 8b7b8adb..cf18c927 100644 --- a/_server/editor_materialpanel.js +++ b/_server/editor_materialpanel.js @@ -150,10 +150,10 @@ editor_materialpanel_wrapper = function (editor) { } else { var height = editor.widthsX[spriter][3], col = height / ysize; + if (spriter == 'terrains') col += 2; if (editor.uivalues.folded && core.tilesets.indexOf(pos.images) == -1) { col = (pos.x == editor.widthsX[spriter][2] - 1) ? ((col - 1) % editor.uivalues.foldPerCol + 1) : editor.uivalues.foldPerCol; } - if (spriter == 'terrains' && pos.x == editor.widthsX[spriter][1]) col += 2; pos.y = Math.min(pos.y, col - 1); } @@ -177,7 +177,7 @@ editor_materialpanel_wrapper = function (editor) { if (editor.uivalues.folded) { y += editor.uivalues.foldPerCol * (pos.x - editor.widthsX[spriter][1]); } - if (pos.images == 'terrains' && pos.x == 0) y -= 2; + if (pos.images == 'terrains') y -= 2; editor.info = { 'images': pos.images, 'y': y } } diff --git a/editor.html b/editor.html index 0c0354c8..e3f5d4df 100644 --- a/editor.html +++ b/editor.html @@ -305,16 +305,16 @@