Fix settings and keybindings search bar character casing issue

Fix keybinding conflicts not showing on start
Fix some settings not updating correctly
Fix copy paste tool accuracy issue
This commit is contained in:
JannisX11 2022-06-10 17:55:13 +02:00
parent 45d5ef2c5a
commit 502c2b3321
3 changed files with 10 additions and 6 deletions

View File

@ -492,7 +492,7 @@ onVueSetup(function() {
computed: { computed: {
list() { list() {
if (this.search_term) { if (this.search_term) {
var keywords = this.search_term.replace(/_/g, ' ').split(' '); var keywords = this.search_term.toLowerCase().replace(/_/g, ' ').split(' ');
var actions = []; var actions = [];
for (var action of Keybinds.actions) { for (var action of Keybinds.actions) {
@ -548,6 +548,9 @@ onVueSetup(function() {
}, },
onButton() { onButton() {
Settings.save(); Settings.save();
},
onOpen() {
updateKeybindConflicts();
} }
}) })
}) })

View File

@ -385,7 +385,7 @@ const Settings = {
} }
for (var id in settings) { for (var id in settings) {
var setting = settings[id]; var setting = settings[id];
if (!Condition(setting.condition)) return; if (!Condition(setting.condition)) continue;
if (setting.onChange && hasSettingChanged(id)) { if (setting.onChange && hasSettingChanged(id)) {
setting.onChange(setting.value); setting.onChange(setting.value);
} }
@ -559,7 +559,7 @@ onVueSetup(function() {
computed: { computed: {
list() { list() {
if (this.search_term) { if (this.search_term) {
var keywords = this.search_term.replace(/_/g, ' ').split(' '); var keywords = this.search_term.toLowerCase().replace(/_/g, ' ').split(' ');
var items = {}; var items = {};
for (var key in settings) { for (var key in settings) {
var setting = settings[key]; var setting = settings[key];

View File

@ -159,9 +159,6 @@ const UVEditor = {
let texture = UVEditor.texture; let texture = UVEditor.texture;
var {x, y} = UVEditor.getBrushCoordinates(e1, texture); var {x, y} = UVEditor.getBrushCoordinates(e1, texture);
if (texture.img.naturalWidth + texture.img.naturalHeight == 0) return; if (texture.img.naturalWidth + texture.img.naturalHeight == 0) return;
if (x === Painter.current.x && y === Painter.current.y) return;
Painter.current.x = x = Math.clamp(x, 0, texture.img.naturalWidth);
Painter.current.y = y = Math.clamp(y, 0, texture.img.naturalHeight);
UVEditor.dragSelection(x, y, e1); UVEditor.dragSelection(x, y, e1);
} }
function stop() { function stop() {
@ -176,6 +173,9 @@ const UVEditor = {
let m = UVEditor.inner_width / UVEditor.texture.width; let m = UVEditor.inner_width / UVEditor.texture.width;
if (!Painter.selection.overlay) { if (!Painter.selection.overlay) {
if (x === Painter.current.x && y === Painter.current.y) return;
Painter.current.x = x = Math.clamp(x, 0, UVEditor.texture.img.naturalWidth);
Painter.current.y = y = Math.clamp(y, 0, UVEditor.texture.img.naturalHeight);
let calcrect = getRectangle(Painter.selection.start_x, Painter.selection.start_y, x, y) let calcrect = getRectangle(Painter.selection.start_x, Painter.selection.start_y, x, y)
if (!calcrect.x && !calcrect.y) return; if (!calcrect.x && !calcrect.y) return;
UVEditor.vue.copy_overlay.state = 'select'; UVEditor.vue.copy_overlay.state = 'select';
@ -190,6 +190,7 @@ const UVEditor = {
.css('width', calcrect.x *m + 'px') .css('width', calcrect.x *m + 'px')
.css('height', calcrect.y *m + 'px') .css('height', calcrect.y *m + 'px')
.css('visibility', 'visible') .css('visibility', 'visible')
} else if (UVEditor.texture && Painter.selection.canvas) { } else if (UVEditor.texture && Painter.selection.canvas) {
Painter.selection.x = Painter.selection.start_x + Math.round((event.clientX - Painter.selection.start_event.clientX) / m); Painter.selection.x = Painter.selection.start_x + Math.round((event.clientX - Painter.selection.start_event.clientX) / m);
Painter.selection.y = Painter.selection.start_y + Math.round((event.clientY - Painter.selection.start_event.clientY) / m); Painter.selection.y = Painter.selection.start_y + Math.round((event.clientY - Painter.selection.start_event.clientY) / m);