Save color picker tab between sessions

Fix plugin install message
Fix issue with gimbal controls in display mode locked slots
This commit is contained in:
JannisX11 2021-02-28 00:42:01 +01:00
parent 486acea2b8
commit 2b8852421a
4 changed files with 10 additions and 5 deletions

View File

@ -596,7 +596,6 @@
} }
#start_screen section#start-files left { #start_screen section#start-files left {
width: 38%; width: 38%;
overflow: hidden;
padding: 20px 24px 0px 24px; padding: 20px 24px 0px 24px;
position: relative; position: relative;
display: flex; display: flex;

View File

@ -68,7 +68,7 @@ class Plugin {
var scope = this; var scope = this;
Plugins.registered[this.id] = this; Plugins.registered[this.id] = this;
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
$.getScript(Plugins.path + scope.id + '.js', function() { $.getScript(Plugins.path + scope.id + '.js', () => {
if (cb) cb.bind(scope)() if (cb) cb.bind(scope)()
scope.bindGlobalData(first) scope.bindGlobalData(first)
if (first && scope.oninstall) { if (first && scope.oninstall) {
@ -76,7 +76,7 @@ class Plugin {
} }
if (first) Blockbench.showQuickMessage(tl('message.installed_plugin', [this.title])); if (first) Blockbench.showQuickMessage(tl('message.installed_plugin', [this.title]));
resolve() resolve()
}).fail(function() { }).fail(() => {
if (isApp) { if (isApp) {
console.log('Could not find file of plugin "'+scope.id+'". Uninstalling it instead.') console.log('Could not find file of plugin "'+scope.id+'". Uninstalling it instead.')
scope.uninstall() scope.uninstall()

View File

@ -1290,7 +1290,7 @@ class GimbalControls {
// Interact // Interact
addEventListeners(this.node, 'mousedown touchstart', e1 => { addEventListeners(this.node, 'mousedown touchstart', e1 => {
if (!scope.preview.controls.enableRotate && scope.preview.angle == null) return; if (!scope.preview.controls.enableRotate || !scope.preview.controls.enabled || scope.preview.angle != null) return;
convertTouchEvent(e1); convertTouchEvent(e1);
let last_event = e1; let last_event = e1;
let move_calls = 0; let move_calls = 0;

View File

@ -45,6 +45,8 @@ function colorDistance(color1, color2) {
] ]
} }
Interface.definePanels(() => { Interface.definePanels(() => {
StateMemory.init('color_picker_tab', 'string')
ColorPanel = Interface.Panels.color = new Panel({ ColorPanel = Interface.Panels.color = new Panel({
id: 'color', id: 'color',
icon: 'palette', icon: 'palette',
@ -84,7 +86,7 @@ Interface.definePanels(() => {
Interface.Panels.color.vue = new Vue({ Interface.Panels.color.vue = new Vue({
el: '#color_panel_wrapper', el: '#color_panel_wrapper',
data: { data: {
open_tab: 'picker', open_tab: StateMemory.color_picker_tab || 'picker',
main_color: '#000000', main_color: '#000000',
hover_color: '', hover_color: '',
get color_code() {return this.hover_color || this.main_color}, get color_code() {return this.hover_color || this.main_color},
@ -149,6 +151,10 @@ Interface.definePanels(() => {
BarItems.slider_color_v.update(); BarItems.slider_color_v.update();
$('#main_colorpicker').spectrum('set', value); $('#main_colorpicker').spectrum('set', value);
this.text_input = value; this.text_input = value;
},
open_tab(tab) {
StateMemory.color_picker_tab = tab;
StateMemory.save('color_picker_tab')
} }
} }
}) })