Append Multi Image
This commit is contained in:
parent
14e79668d1
commit
94f2531979
@ -928,19 +928,23 @@ editor_mode = function (editor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ysize = selectAppend.value.indexOf('48') === -1 ? 32 : 48;
|
var ysize = selectAppend.value.indexOf('48') === -1 ? 32 : 48;
|
||||||
var height = editor_mode.appendPic.toImg.height;
|
|
||||||
for (var ii = 0, v; v = editor_mode.appendPic.selectPos[ii]; ii++) {
|
for (var ii = 0, v; v = editor_mode.appendPic.selectPos[ii]; ii++) {
|
||||||
var imgData = source_ctx.getImageData(v.x * 32, v.y * ysize, 32, ysize);
|
// var imgData = source_ctx.getImageData(v.x * 32, v.y * ysize, 32, ysize);
|
||||||
sprite_ctx.putImageData(imgData, ii * 32, height);
|
// sprite_ctx.putImageData(imgData, ii * 32, sprite.height - ysize);
|
||||||
// sprite_ctx.drawImage(editor_mode.appendPic.img, v.x * 32, v.y * ysize, 32, ysize, ii * 32, height, 32, ysize)
|
// sprite_ctx.drawImage(editor_mode.appendPic.img, v.x * 32, v.y * ysize, 32, ysize, ii * 32, height, 32, ysize)
|
||||||
|
|
||||||
|
sprite_ctx.drawImage(source_ctx.canvas, v.x*32, v.y*ysize, 32, ysize, 32*ii, sprite.height - ysize, 32, ysize);
|
||||||
}
|
}
|
||||||
|
var dt = sprite_ctx.getImageData(0, 0, sprite.width, sprite.height);
|
||||||
var imgbase64 = sprite.toDataURL().split(',')[1];
|
var imgbase64 = sprite.toDataURL().split(',')[1];
|
||||||
fs.writeFile('./project/images/' + editor_mode.appendPic.imageName + '.png', imgbase64, 'base64', function (err, data) {
|
fs.writeFile('./project/images/' + editor_mode.appendPic.imageName + '.png', imgbase64, 'base64', function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
printe(err);
|
printe(err);
|
||||||
throw(err)
|
throw(err)
|
||||||
}
|
}
|
||||||
printe('追加素材成功,请F5刷新编辑器');
|
printe('追加素材成功,请F5刷新编辑器,或继续追加当前素材');
|
||||||
|
sprite.style.height = (sprite.height = (sprite.height+ysize)) + "px";
|
||||||
|
sprite_ctx.putImageData(dt, 0, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1819,10 +1819,16 @@ actions.prototype.clickSwitchs = function (x,y) {
|
|||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
window.open(core.platform.isPC?"editor.html":"editor-mobile.html", "_blank");
|
if (core.platform.isPC)
|
||||||
|
window.open("editor.html", "_blank");
|
||||||
|
else
|
||||||
|
window.location.href = "editor-mobile.html";
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
window.open(core.firstData.name+".zip", "_blank");
|
if (core.platform.isPC)
|
||||||
|
window.open(core.firstData.name+".zip");
|
||||||
|
else
|
||||||
|
window.location.href = core.firstData.name+".zip";
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
core.status.event.selection=0;
|
core.status.event.selection=0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user