Improve cursor scaling

This commit is contained in:
luboslenco
2020-04-27 17:27:52 +02:00
parent a50e4a2b60
commit d273f01a85
3 changed files with 11 additions and 6 deletions
+5 -2
View File
@@ -32,11 +32,14 @@ class Uniforms {
if (Config.raw.pressure_radius && pen.down()) {
val *= pen.pressure * Config.raw.pressure_sensitivity;
}
var scale2d = (900 / App.h()) * Config.raw.window_scale;
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
if (Config.raw.brush_3d && !decal) {
val *= Context.paint2d ? 0.6 : 2;
val *= Context.paint2d ? 0.55 * scale2d : 2;
}
else {
val *= scale2d; // Projection ratio
}
else val *= 900 / App.h(); // Projection ratio
return val;
}
if (link == "_brushScaleX") {
+3 -3
View File
@@ -759,7 +759,7 @@ class UISidebar {
}
var cursorImg = Res.get("cursor.k");
var psize = Std.int(cursorImg.width * (Context.brushRadius * Context.brushNodesRadius));
var psize = Std.int(cursorImg.width * (Context.brushRadius * Context.brushNodesRadius) * ui.SCALE());
// Clone source cursor
var mouse = Input.getMouse();
@@ -781,8 +781,8 @@ class UISidebar {
if (!Config.raw.brush_3d || in2dView || (decal && !Config.raw.brush_live)) {
if (decal && !inNodes) {
var psizex = Std.int(256 * (Context.brushRadius * Context.brushNodesRadius * Context.brushScaleX));
var psizey = Std.int(256 * (Context.brushRadius * Context.brushNodesRadius));
var psizex = Std.int(256 * ui.SCALE() * (Context.brushRadius * Context.brushNodesRadius * Context.brushScaleX));
var psizey = Std.int(256 * ui.SCALE() * (Context.brushRadius * Context.brushNodesRadius));
g.color = kha.Color.fromFloats(1, 1, 1, Context.brushOpacity);
var angle = (Context.brushAngle + Context.brushNodesAngle) * (Math.PI / 180);
g.pushRotation(-angle, mx, my);
+3 -1
View File
@@ -233,7 +233,9 @@ class UIView2D {
if (Context.tool == ToolPicker) {
var cursorImg = Res.get("cursor.k");
ui.g.drawScaledImage(cursorImg, tx + tw * Context.uvxPicked - 16, ty + th * Context.uvyPicked - 16, 32, 32);
var hsize = 16 * ui.SCALE();
var size = hsize * 2;
ui.g.drawScaledImage(cursorImg, tx + tw * Context.uvxPicked - hsize, ty + th * Context.uvyPicked - hsize, size, size);
}
}
ui.end();