mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Save selected tool when switching modes
This commit is contained in:
parent
8af0c8e3d4
commit
7a3f948a3d
@ -390,6 +390,9 @@ class Tool extends Action {
|
||||
Toolbox.selected = this;
|
||||
delete Toolbox.original;
|
||||
this.uses++;
|
||||
if (Project) {
|
||||
Project.tool = Mode.selected.tool = this.id;
|
||||
}
|
||||
|
||||
if (this.transformerMode) {
|
||||
Transformer.setMode(this.transformerMode)
|
||||
|
@ -143,8 +143,6 @@ class ModelProject {
|
||||
}
|
||||
}
|
||||
saveEditorState() {
|
||||
this.tool = Toolbox.selected.id;
|
||||
|
||||
UVEditor.saveViewportOffset();
|
||||
|
||||
Preview.all.forEach(preview => {
|
||||
|
@ -67,10 +67,12 @@ class Mode extends KeybindItem {
|
||||
}
|
||||
|
||||
Canvas.updateRenderSides()
|
||||
if (BarItems[this.default_tool]) {
|
||||
if (!BarItems[this.default_tool].selected) BarItems[this.default_tool].select()
|
||||
if (BarItems[this.tool] && Condition(BarItems[this.tool])) {
|
||||
BarItems[this.tool].select();
|
||||
} else if (BarItems[this.default_tool]) {
|
||||
if (!BarItems[this.default_tool].selected) BarItems[this.default_tool].select();
|
||||
} else {
|
||||
if (!BarItems.move_tool.selected) BarItems.move_tool.select()
|
||||
if (!BarItems.move_tool.selected) BarItems.move_tool.select();
|
||||
}
|
||||
TickUpdates.interface = true;
|
||||
TickUpdates.selection = true;
|
||||
|
@ -184,7 +184,7 @@ class Plugin {
|
||||
}).fail(reject)
|
||||
} else {
|
||||
try {
|
||||
eval(file.content);
|
||||
new Function(file.content)();
|
||||
} catch (err) {
|
||||
reject(err)
|
||||
}
|
||||
|
3
main.js
3
main.js
@ -205,6 +205,7 @@ ipcMain.on('new-window', (event, data, position) => {
|
||||
})
|
||||
if (place_in_window) {
|
||||
place_in_window.send('load-tab', load_project_data);
|
||||
place_in_window.focus();
|
||||
load_project_data = null;
|
||||
} else {
|
||||
createWindow(true, {
|
||||
@ -246,7 +247,7 @@ app.on('ready', () => {
|
||||
}
|
||||
|
||||
if (app_was_loaded) {
|
||||
console.log('[Blockbench] App reloaded')
|
||||
console.log('[Blockbench] App reloaded or new window opened')
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user