mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Fix reference image drag n drop
Add icon to reference image delete dialog
This commit is contained in:
parent
ac41bb4ea3
commit
00b477de2d
15
js/io/io.js
15
js/io/io.js
@ -7,6 +7,19 @@ function setupDragHandlers() {
|
||||
loadImages(files, event)
|
||||
}
|
||||
)
|
||||
Blockbench.addDragHandler(
|
||||
'reference_image',
|
||||
{extensions: ['jpg', 'jpeg', 'bmp', 'tiff', 'tif', 'gif'], propagate: true, readtype: 'image', condition: () => !Dialog.open},
|
||||
function(files, event) {
|
||||
files.map(file => {
|
||||
return new ReferenceImage({
|
||||
source: file.content,
|
||||
name: file.name || 'Reference'
|
||||
}).addAsReference(true);
|
||||
}).last().select();
|
||||
ReferenceImageMode.activate();
|
||||
}
|
||||
)
|
||||
Blockbench.addDragHandler(
|
||||
'model',
|
||||
{extensions: Codec.getAllExtensions},
|
||||
@ -125,7 +138,7 @@ async function loadImages(files, event) {
|
||||
} else if (method == 'reference_image') {
|
||||
|
||||
files.map(file => {
|
||||
new ReferenceImage({
|
||||
return new ReferenceImage({
|
||||
source: file.content,
|
||||
name: file.name || 'Reference'
|
||||
}).addAsReference(true);
|
||||
|
@ -520,9 +520,12 @@ class ReferenceImage {
|
||||
}
|
||||
async delete(force) {
|
||||
if (!force) {
|
||||
let img = new Image();
|
||||
img.src = this.source;
|
||||
let result = await new Promise(resolve => Blockbench.showMessageBox({
|
||||
title: 'data.reference_image',
|
||||
message: 'message.delete_reference_image',
|
||||
icon: img,
|
||||
buttons: ['dialog.confirm', 'dialog.cancel']
|
||||
}, resolve));
|
||||
if (result == 1) return;
|
||||
|
Loading…
Reference in New Issue
Block a user