Improve layout on mobile
Fix issues with panel arranging
This commit is contained in:
parent
781c1ff728
commit
bc4705c2d2
@ -1241,6 +1241,9 @@
|
||||
height: 42px;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
body.is_mobile #action_selector {
|
||||
top: 26px;
|
||||
}
|
||||
#action_selector > input {
|
||||
width: calc(100% - 38px);
|
||||
height: 42px;
|
||||
@ -1326,11 +1329,6 @@
|
||||
top: 4px;
|
||||
left: 49px;
|
||||
}
|
||||
@media (max-device-width: 640px) {
|
||||
dialog#action_selector {
|
||||
top: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Edit History */
|
||||
#edit_history_list ul {
|
||||
|
@ -85,6 +85,10 @@
|
||||
#status_bar {
|
||||
grid-area: status_bar;
|
||||
}
|
||||
#top_slot,
|
||||
#bottom_slot {
|
||||
background-color: var(--color-ui);
|
||||
}
|
||||
.single_canvas_wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
@ -307,7 +311,7 @@
|
||||
}
|
||||
body.is_mobile.is_landscape #work_screen {
|
||||
grid-template-columns: auto 48px !important;
|
||||
grid-template-rows: auto minmax(100px, 5000px) 26px !important;
|
||||
grid-template-rows: auto minmax(200px, 5000px) 26px !important;
|
||||
grid-template-areas:
|
||||
"toolbar panel_selector"
|
||||
"center panel_selector"
|
||||
@ -320,6 +324,10 @@
|
||||
body.is_mobile #main_toolbar {
|
||||
display: block;
|
||||
}
|
||||
body.is_mobile.is_landscape #main_toolbar {
|
||||
display: flex;
|
||||
height: fit-content;
|
||||
}
|
||||
body.is_mobile #main_toolbar > * {
|
||||
display: block;
|
||||
}
|
||||
|
@ -301,12 +301,7 @@ Keybinds.loadKeymap = function(id, from_start_screen = false) {
|
||||
return true;
|
||||
}
|
||||
Keybinds.no_overlap = function(k1, k2) {
|
||||
if (typeof k1.condition !== 'object' || typeof k2.condition !== 'object') return false;
|
||||
if (k1.condition.modes && k2.condition.modes && k1.condition.modes.overlap(k2.condition.modes) == 0) return true;
|
||||
if (k1.condition.tools && k2.condition.tools && k1.condition.tools.overlap(k2.condition.tools) == 0) return true;
|
||||
if (k1.condition.formats && k2.condition.formats && k1.condition.formats.overlap(k2.condition.formats) == 0) return true;
|
||||
if (k1.condition.features && k2.condition.features && k1.condition.features.overlap(k2.condition.features) == 0) return true;
|
||||
return false;
|
||||
return Condition.mutuallyExclusive(k1.condition, k2.condition);
|
||||
}
|
||||
function updateKeybindConflicts() {
|
||||
for (var key in Keybinds.structure) {
|
||||
|
@ -374,20 +374,25 @@ class Panel {
|
||||
} else {
|
||||
$(ref_panel.node).after(this.node);
|
||||
}
|
||||
Interface.data[slot].remove(this.id);
|
||||
Interface.data[slot].splice(Interface.data[slot].indexOf(ref_panel.id) + (before ? 0 : 1), 0, this.id);
|
||||
} else {
|
||||
document.getElementById(slot).append(this.node);
|
||||
Interface.data[slot].push(this.id);
|
||||
}
|
||||
|
||||
} else if (slot == 'top') {
|
||||
let top_panel = Interface.getTopPanel();
|
||||
if (top_panel && top_panel !== this) top_panel.moveTo(top_panel.previous_slot);
|
||||
|
||||
if (top_panel && top_panel !== this && !Condition.mutuallyExclusive(this.condition, top_panel.condition)) {
|
||||
top_panel.moveTo(top_panel.previous_slot);
|
||||
}
|
||||
document.getElementById('top_slot').append(this.node);
|
||||
|
||||
} else if (slot == 'bottom') {
|
||||
let bottom_panel = Interface.getBottomPanel();
|
||||
if (bottom_panel && bottom_panel !== this) bottom_panel.moveTo(bottom_panel.previous_slot);
|
||||
|
||||
if (bottom_panel && bottom_panel !== this && !Condition.mutuallyExclusive(this.condition, bottom_panel.condition)) {
|
||||
bottom_panel.moveTo(bottom_panel.previous_slot);
|
||||
}
|
||||
document.getElementById('bottom_slot').append(this.node);
|
||||
|
||||
} else if (slot == 'float') {
|
||||
@ -525,7 +530,9 @@ function updateSidebarOrder() {
|
||||
|
||||
Interface.data[bar].forEach(panel_id => {
|
||||
let panel = Panels[panel_id];
|
||||
if (panel) bar_node.append(panel.node);
|
||||
if (panel && panel.slot == bar) {
|
||||
bar_node.append(panel.node);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ Interface.definePanels(() => {
|
||||
|
||||
ColorPanel = new Panel('color', {
|
||||
icon: 'palette',
|
||||
condition: () => Modes.id === 'paint',
|
||||
condition: {modes: ['paint']},
|
||||
default_position: {
|
||||
slot: 'right_bar',
|
||||
float_position: [0, 0],
|
||||
|
@ -50,6 +50,15 @@ const Condition = function(condition, context) {
|
||||
return !!condition
|
||||
}
|
||||
}
|
||||
Condition.mutuallyExclusive = function(a, b) {
|
||||
if (typeof a !== 'object' || typeof b !== 'object') return false;
|
||||
if (a.modes && b.modes && a.modes.overlap(b.modes) == 0) return true;
|
||||
if (a.tools && b.tools && a.tools.overlap(b.tools) == 0) return true;
|
||||
if (a.formats && b.formats && a.formats.overlap(b.formats) == 0) return true;
|
||||
if (a.features && b.features && a.features.overlap(b.features) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
class oneLiner {
|
||||
constructor(data) {
|
||||
if (data !== undefined) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user