Skip to content

Commit

Permalink
Add icons to import image dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Nov 5, 2023
1 parent 00db0a9 commit 3882562
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions css/dialogs.css
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@
margin-right: 10px;
pointer-events: none;
}
.dialog_message_box_command > .icon {
margin-right: 10px;
}
.dialog_message_box_checkboxes {
margin-top: 15px;
margin-bottom: -14px;
Expand Down
5 changes: 4 additions & 1 deletion js/interface/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,10 @@ window.MessageBox = class MessageBox extends Dialog {
let command = options.commands[id];
if (!command || !Condition(command.condition)) continue;
let text = tl(typeof command == 'string' ? command : command.text);
let entry = Interface.createElement('li', {class: 'dialog_message_box_command'}, text)
let entry = Interface.createElement('li', {class: 'dialog_message_box_command'}, text);
if (command.icon) {
entry.prepend(Blockbench.getIconNode(command.icon));
}
entry.addEventListener('click', e => {
this.close(id, results, e);
})
Expand Down
15 changes: 14 additions & 1 deletion js/io/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,25 @@ async function loadImages(files, event) {
doLoadImages(all_methods[0]);

} else if (all_methods.length) {
let icons = {
replace_texture: 'file_upload',
texture: 'library_add',
layer: 'new_window',
reference_image: 'wallpaper',
edit: 'draw',
minecraft_skin: 'icon-player',
extrude_with_cubes: 'eject',
};
let commands = {};
for (let id in options) {
commands[id] = {text: options[id], icon: icons[id]};
}
let title = tl('message.load_images.title');
let message = `${files[0].name}`;
if (files.length > 1) message += ` (${files.length})`;
Blockbench.showMessageBox({
id: 'load_images',
commands: options,
commands,
title, message,
icon: img,
buttons: ['dialog.cancel'],
Expand Down

0 comments on commit 3882562

Please sign in to comment.