Improve lazy mouse precision

This commit is contained in:
luboslenco
2020-03-24 17:31:47 +01:00
parent 8f6459d834
commit b3554c7846
+5 -7
View File
@@ -81,11 +81,10 @@ class InputNode extends LogicNode {
else if (kb.released(Config.keymap.brush_ruler)) { lockX = lockY = lockBegin = false; }
if (UISidebar.inst.brushLazyRadius > 0) {
var ratio = iron.App.w() / iron.App.h();
var v1 = new Vec4(UISidebar.inst.brushLazyX * ratio, UISidebar.inst.brushLazyY, 0.0);
var v2 = new Vec4(coords.x * ratio, coords.y, 0.0);
var v1 = new Vec4(UISidebar.inst.brushLazyX * iron.App.w(), UISidebar.inst.brushLazyY * iron.App.h(), 0.0);
var v2 = new Vec4(coords.x * iron.App.w(), coords.y * iron.App.h(), 0.0);
var d = Vec4.distance(v1, v2);
var r = UISidebar.inst.brushLazyRadius / 10;
var r = UISidebar.inst.brushLazyRadius * 85;
if (d > r) {
var v3 = new Vec4();
v3.subvecs(v2, v1);
@@ -93,10 +92,9 @@ class InputNode extends LogicNode {
v3.mult(1.0 - UISidebar.inst.brushLazyStep);
v3.mult(r);
v2.addvecs(v1, v3);
coords.x = v2.x / ratio;
coords.y = v2.y;
coords.x = v2.x / iron.App.w();
coords.y = v2.y / iron.App.h();
}
UISidebar.inst.lastPaintX = -1;
UISidebar.inst.lastPaintY = -1;
}