Prevent camera movement when combo is selected

This commit is contained in:
Lubos Lenco
2021-08-04 11:20:27 +02:00
parent 02971e5316
commit cfbc976ea2
4 changed files with 16 additions and 9 deletions
+7 -1
View File
@@ -652,7 +652,13 @@ class App {
}
public static function isScrolling(): Bool {
return UISidebar.inst.ui.isScrolling;
for (ui in getUIs()) if (ui.isScrolling) return true;
return false;
}
public static function isComboSelected(): Bool {
for (ui in getUIs()) if (@:privateAccess ui.comboSelectedHandle != null) return true;
return false;
}
public static function getUIs(): Array<Zui> {
+3 -4
View File
@@ -103,15 +103,14 @@ class BrushOutputNode extends LogicNode {
Context.paintVec.x < right &&
Context.paintVec.y > 0 &&
Context.paintVec.y < 1 &&
!UISidebar.inst.ui.isHovered &&
!UISidebar.inst.ui.isScrolling &&
!fillLayer &&
!groupLayer &&
(Context.layer.isVisible() || Context.paint2d) &&
!UISidebar.inst.ui.isHovered &&
!arm.App.isDragging &&
!arm.App.isResizing &&
@:privateAccess UISidebar.inst.ui.comboSelectedHandle == null &&
@:privateAccess UIView2D.inst.ui.comboSelectedHandle == null) { // Header combos are in use
!arm.App.isScrolling() &&
!arm.App.isComboSelected()) {
// Set color pick
var down = iron.system.Input.getMouse().down() || iron.system.Input.getPen().down();
+5 -3
View File
@@ -295,11 +295,13 @@ class UINodes {
public static function getCanvasControl(ui: Zui): zui.Nodes.CanvasControl {
var pan = ui.inputDownR || Operator.shortcut(Config.keymap.action_pan, ShortcutDown);
var zoomDelta = Operator.shortcut(Config.keymap.action_zoom, ShortcutDown) ? getZoomDelta(ui) / 100.0 : 0.0;
return {
var control = {
panX: pan ? ui.inputDX : 0.0,
panY: pan ? ui.inputDY : 0.0,
zoom: ui.inputWheelDelta != 0.0 ? -ui.inputWheelDelta / 10 : zoomDelta
}
};
if (App.isComboSelected()) control.zoom = 0.0;
return control;
}
static function getZoomDelta(ui: Zui): Float {
@@ -750,7 +752,7 @@ class UINodes {
var cats = canvasType == CanvasMaterial ? NodesMaterial.categories : NodesBrush.categories;
for (i in 0...cats.length) {
if ((ui.button(tr(cats[i]), Left) && UISidebar.inst.ui.comboSelectedHandle == null) || (ui.isHovered && drawMenu)) {
if ((ui.button(tr(cats[i]), Left) && !arm.App.isComboSelected()) || (ui.isHovered && drawMenu)) {
addNodeButton = true;
menuCategory = i;
popupX = wx + ui._x;
+1 -1
View File
@@ -551,7 +551,7 @@ class UISidebar {
if (Context.brushTime == 0 &&
!App.isDragging &&
!App.isResizing &&
@:privateAccess ui.comboSelectedHandle == null) { // Paint started
!App.isComboSelected()) { // Paint started
// Draw line
if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown)) {