mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-04-12 17:41:57 +08:00
Fix issue in painting grids with specific tex resolutions
This commit is contained in:
parent
4921cd0cb3
commit
3a72623718
@ -699,7 +699,6 @@ class GeneralAnimator {
|
||||
var kf = new Keyframe(data, uuid);
|
||||
this[channel].push(kf);
|
||||
kf.animator = this;
|
||||
Animation.selected.setLength();
|
||||
return kf;
|
||||
}
|
||||
}
|
||||
|
@ -1013,18 +1013,22 @@ const Canvas = {
|
||||
var texture = face.getTexture();
|
||||
if (texture == null) return;
|
||||
|
||||
var px_x = texture ? Project.texture_width / texture.width : 1;
|
||||
var px_y = texture ? Project.texture_height / texture.height : 1;
|
||||
var uv_size = [
|
||||
Math.abs(face.uv_size[0]),
|
||||
Math.abs(face.uv_size[1])
|
||||
]
|
||||
uv_offset = [
|
||||
uv_offset[0] == true
|
||||
? (face.uv_size[0] > 0 ? (1-face.uv[2]%1) : ( face.uv[2]%1))
|
||||
: (face.uv_size[0] > 0 ? ( face.uv[0]%1) : (1-face.uv[0]%1)),
|
||||
? (face.uv_size[0] > 0 ? (px_x-face.uv[2]) : ( face.uv[2]))
|
||||
: (face.uv_size[0] > 0 ? ( face.uv[0]) : (px_x-face.uv[0])),
|
||||
uv_offset[1] == true
|
||||
? (face.uv_size[1] > 0 ? (1-face.uv[3]%1) : ( face.uv[3]%1))
|
||||
: (face.uv_size[1] > 0 ? ( face.uv[1]%1) : (1-face.uv[1]%1))
|
||||
? (face.uv_size[1] > 0 ? (px_y-face.uv[3]) : ( face.uv[3]))
|
||||
: (face.uv_size[1] > 0 ? ( face.uv[1]) : (px_y-face.uv[1]))
|
||||
]
|
||||
uv_offset[0] = uv_offset[0] % px_x;
|
||||
uv_offset[1] = uv_offset[1] % px_y;
|
||||
|
||||
if ((face.rotation % 180 == 90) != (axis == 0)) {
|
||||
uv_size.reverse();
|
||||
@ -1036,7 +1040,6 @@ const Canvas = {
|
||||
//Columns
|
||||
var width = end[0]-start[0];
|
||||
var step = Math.abs( width / uv_size[0] );
|
||||
uv_offset[0] *= step;
|
||||
if (texture) step *= Project.texture_width / texture.width;
|
||||
if (step < epsilon) step = epsilon;
|
||||
|
||||
@ -1050,7 +1053,6 @@ const Canvas = {
|
||||
//lines
|
||||
var height = end[1]-start[1];
|
||||
var step = Math.abs( height / uv_size[1] );
|
||||
uv_offset[1] *= step;
|
||||
let tex_height = texture.frameCount ? (texture.height / texture.frameCount) : texture.height;
|
||||
if (texture) step *= Project.texture_height / tex_height;
|
||||
if (step < epsilon) step = epsilon;
|
||||
|
@ -3,7 +3,7 @@
|
||||
"preview_select": {"key": 1},
|
||||
"preview_rotate": {"key": 2},
|
||||
"preview_drag": {"key": 2, "shift": true},
|
||||
"preview_zoom": {"key": 1, "shift": true},
|
||||
"preview_zoom": {"key": 2, "ctrl": true},
|
||||
"confirm": {"key": 13},
|
||||
"cancel": {"key": 27},
|
||||
"move_tool": {"key": 71},
|
||||
|
@ -818,7 +818,7 @@
|
||||
"action.export_settings.desc": "Export the Blockbench settings as a .bbsettings file",
|
||||
|
||||
"action.load_keymap": "Load Keymap",
|
||||
"action.load_keymap.default": "Default (Trackpad)",
|
||||
"action.load_keymap.default": "Default (Trackpad/Mouse)",
|
||||
"action.load_keymap.mouse": "Default (Mouse)",
|
||||
"action.load_keymap.default.desc": "Default Blockbench keybindings, with viewport navigation controls optimized for use on laptop trackpads",
|
||||
"action.load_keymap.mouse.desc": "Default Blockbench keybindings, with viewport navigation bound to the middle mouse button",
|
||||
@ -899,9 +899,9 @@
|
||||
"action.add_to_palette": "Add To Palette",
|
||||
"action.add_to_palette.desc": "Add the selected color to the color palette",
|
||||
"action.import_palette": "Import Palette",
|
||||
"action.import_palette.desc": "Import a .bbpalette file",
|
||||
"action.import_palette.desc": "Import a palette file",
|
||||
"action.export_palette": "Export Palette",
|
||||
"action.export_palette.desc": "Export palette as a .bbpalette file",
|
||||
"action.export_palette.desc": "Export palette as a .GPL file",
|
||||
"action.generate_palette": "Generate Palette",
|
||||
"action.generate_palette.desc": "Generate palette from a texture",
|
||||
"action.sort_palette": "Sort Palette",
|
||||
|
Loading…
x
Reference in New Issue
Block a user