From ddc0a334443474c0d5e3ded1fc676d6986f50032 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Mon, 27 Jan 2020 10:42:27 +0100 Subject: [PATCH] Set operator key repeat --- Sources/arm/ui/UITrait.hx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Sources/arm/ui/UITrait.hx b/Sources/arm/ui/UITrait.hx index 36d2c73f..f921a45a 100644 --- a/Sources/arm/ui/UITrait.hx +++ b/Sources/arm/ui/UITrait.hx @@ -530,14 +530,14 @@ class UITrait { lockStartedX = mouse.x; lockStartedY = mouse.y; } - else if (Operator.shortcut(Config.keymap.brush_radius_decrease)) { - brushRadius -= 0.1; + else if (Operator.shortcut(Config.keymap.brush_radius_decrease, true)) { + brushRadius -= getRadiusIncrement(); brushRadius = Math.round(brushRadius * 100) / 100; brushRadiusHandle.value = brushRadius; headerHandle.redraws = 2; } - else if (Operator.shortcut(Config.keymap.brush_radius_increase)) { - brushRadius += 0.1; + else if (Operator.shortcut(Config.keymap.brush_radius_increase, true)) { + brushRadius += getRadiusIncrement(); brushRadius = Math.round(brushRadius * 100) / 100; brushRadiusHandle.value = brushRadius; headerHandle.redraws = 2; @@ -561,13 +561,13 @@ class UITrait { camHandle.position = cameraType; ViewportUtil.updateCameraType(cameraType); } - else if (Operator.shortcut(Config.keymap.view_orbit_left)) ViewportUtil.orbit(-Math.PI / 12, 0); - else if (Operator.shortcut(Config.keymap.view_orbit_right)) ViewportUtil.orbit(Math.PI / 12, 0); - else if (Operator.shortcut(Config.keymap.view_orbit_up)) ViewportUtil.orbit(0, -Math.PI / 12); - else if (Operator.shortcut(Config.keymap.view_orbit_down)) ViewportUtil.orbit(0, Math.PI / 12); + else if (Operator.shortcut(Config.keymap.view_orbit_left, true)) ViewportUtil.orbit(-Math.PI / 12, 0); + else if (Operator.shortcut(Config.keymap.view_orbit_right, true)) ViewportUtil.orbit(Math.PI / 12, 0); + else if (Operator.shortcut(Config.keymap.view_orbit_up, true)) ViewportUtil.orbit(0, -Math.PI / 12); + else if (Operator.shortcut(Config.keymap.view_orbit_down, true)) ViewportUtil.orbit(0, Math.PI / 12); else if (Operator.shortcut(Config.keymap.view_orbit_opposite)) ViewportUtil.orbit(Math.PI, 0); - else if (Operator.shortcut(Config.keymap.view_zoom_in)) ViewportUtil.zoom(0.2); - else if (Operator.shortcut(Config.keymap.view_zoom_out)) ViewportUtil.zoom(-0.2); + else if (Operator.shortcut(Config.keymap.view_zoom_in, true)) ViewportUtil.zoom(0.2); + else if (Operator.shortcut(Config.keymap.view_zoom_out, true)) ViewportUtil.zoom(-0.2); } if (brushCanLock || brushLocked) { @@ -637,6 +637,10 @@ class UITrait { App.resize(); } + inline function getRadiusIncrement(): Float { + return 0.1; + } + function updateUI() { if (Log.messageTimer > 0) {