fold autotile

This commit is contained in:
ckcz123 2021-07-21 19:21:32 +08:00
parent 7666fc3f5b
commit 30f48b0b68
2 changed files with 16 additions and 10 deletions

View File

@ -638,7 +638,7 @@ editor.prototype.drawInitData = function (icons) {
if (img == 'autotile') { if (img == 'autotile') {
var autotiles = images[img]; var autotiles = images[img];
for (var im in autotiles) { for (var im in autotiles) {
tempy += autotiles[im].height; tempy += editor.uivalues.folded ? 32 : autotiles[im].height;
} }
var tempx = editor.uivalues.folded ? 32 : 3 * 32; var tempx = editor.uivalues.folded ? 32 : 3 * 32;
editor.widthsX[img] = [img, sumWidth / 32, (sumWidth + tempx) / 32, tempy]; editor.widthsX[img] = [img, sumWidth / 32, (sumWidth + tempx) / 32, tempy];
@ -748,9 +748,10 @@ editor.prototype.drawInitData = function (icons) {
var autotiles = images[img]; var autotiles = images[img];
var tempx = editor.uivalues.folded ? 32 : 96; var tempx = editor.uivalues.folded ? 32 : 96;
for (var im in autotiles) { for (var im in autotiles) {
var subimgs = core.splitImage(autotiles[im], tempx, autotiles[im].height); var tempy = editor.uivalues.folded ? 32 : autotiles[im].height;
var subimgs = core.splitImage(autotiles[im], tempx, tempy);
drawImage(subimgs[0], nowx, nowy, img); drawImage(subimgs[0], nowx, nowy, img);
nowy += autotiles[im].height; nowy += tempy;
} }
nowx += tempx; nowx += tempx;
continue; continue;

View File

@ -132,6 +132,10 @@ editor_materialpanel_wrapper = function (editor) {
var autotiles = core.material.images['autotile']; var autotiles = core.material.images['autotile'];
if (pos.images == 'autotile') { if (pos.images == 'autotile') {
var imNames = Object.keys(autotiles); var imNames = Object.keys(autotiles);
if (editor.uivalues.folded) {
pos.y = Math.min(pos.y, imNames.length - 1);
pos.images = imNames[pos.y];
} else {
if ((pos.y + 1) * ysize > editor.widthsX[spriter][3]) if ((pos.y + 1) * ysize > editor.widthsX[spriter][3])
pos.y = ~~(editor.widthsX[spriter][3] / ysize) - 4; pos.y = ~~(editor.widthsX[spriter][3] / ysize) - 4;
else { else {
@ -143,6 +147,7 @@ editor_materialpanel_wrapper = function (editor) {
} }
} }
} }
}
else { else {
var height = editor.widthsX[spriter][3], col = height / ysize; var height = editor.widthsX[spriter][3], col = height / ysize;
if (editor.uivalues.folded && core.tilesets.indexOf(pos.images) == -1) { if (editor.uivalues.folded && core.tilesets.indexOf(pos.images) == -1) {