diff --git a/_server/editor_mode.js b/_server/editor_mode.js index 6693d42e..cc0022cc 100644 --- a/_server/editor_mode.js +++ b/_server/editor_mode.js @@ -581,8 +581,11 @@ editor_mode = function (editor) { editor_mode.appendPic.height = image.height; if (selectAppend.value == 'autotile') { - sprite.style.width = (sprite.width = image.width) / ratio + 'px'; - sprite.style.height = (sprite.height = image.height) / ratio + 'px'; + for (var ii = 0; ii < 3; ii++) { + var newsprite = appendPicCanvas.children[ii]; + newsprite.style.width = (newsprite.width = image.width) / ratio + 'px'; + newsprite.style.height = (newsprite.height = image.height) / ratio + 'px'; + } sprite_ctx.clearRect(0, 0, sprite.width, sprite.height); sprite_ctx.drawImage(image, 0, 0); } @@ -804,17 +807,12 @@ editor_mode = function (editor) { appendConfirm.onclick = function () { var confirmAutotile = function () { - if (sprite.width != 96 || sprite.height != 128) { - if (sprite.height==128 && sprite.width%96==0) { - printe("这里只能导入单帧的自动元件,多帧的动画请先导入单帧自动元件再同名替换素材即可。"); - } - else { - printe("不合法的Autotile图片!"); - } - + var image = editor_mode.appendPic.img; + if (image.width % 96 !=0 || image.height != 128) { + printe("不合法的Autotile图片!"); return; } - var imgData = source_ctx.getImageData(0,0,sprite.width,sprite.height); + var imgData = source_ctx.getImageData(0,0,image.width,image.height); sprite_ctx.putImageData(imgData, 0, 0); var imgbase64 = sprite.toDataURL().split(',')[1];