Switching page on paginated lists now scrolls to top

Fix painting on selected layered texture when it's hidden
This commit is contained in:
JannisX11 2023-07-29 16:44:25 +02:00
parent b579ea106f
commit 9c51bb6fe6
3 changed files with 10 additions and 9 deletions

View File

@ -506,6 +506,7 @@ BARS.defineActions(() => {
},
setPage(number) {
this.page = number;
this.$refs.backups_list.scrollTop = 0;
}
},
computed: {
@ -532,7 +533,7 @@ BARS.defineActions(() => {
<div class="bar">
<search-bar v-model="search_term" @input="setPage(0)"></search-bar>
</div>
<ul id="view_backups_list" class="list">
<ul id="view_backups_list" class="list" ref="backups_list">
<li v-for="backup in viewed_backups" :key="backup.id" :class="{selected: selected == backup}" @dblclick="open(backup)" @click="select(backup);">
<span :title="backup.id">{{ backup.name }}</span>
<div class="view_backups_info_field" :title="backup.date_long">{{ backup.date }}</div>

View File

@ -817,6 +817,7 @@ BARS.defineActions(function() {
},
setPage(number) {
this.page = number;
this.$refs.plugin_list.scrollTop = 0;
},
selectPlugin(plugin) {
plugin.fetchAbout();
@ -864,7 +865,7 @@ BARS.defineActions(function() {
<div :class="{open: tab == 'installed'}" @click="setTab('installed')">${tl('dialog.plugins.installed')}</div>
<div :class="{open: tab == 'available'}" @click="setTab('available')">${tl('dialog.plugins.available')}</div>
</div>
<ul class="list" id="plugin_list">
<ul class="list" id="plugin_list" ref="plugin_list">
<li v-for="plugin in viewed_plugins" :plugin="plugin.id" :class="{plugin: true, testing: plugin.fromFile, selected: plugin == selected_plugin, disabled_plugin: plugin.disabled, incompatible: plugin.isInstallable() !== true}" @click="selectPlugin(plugin)" @contextmenu="selectPlugin(plugin); plugin.showContextMenu($event)">
<div>
<div class="plugin_icon_area">

View File

@ -1619,17 +1619,16 @@ class Texture {
])
Texture.getDefault = function() {
if (Texture.selected && Texture.all.includes(Texture.selected)) {
return Texture.selected;
if (Texture.selected.visible || Texture.selected.render_mode !== 'layered') {
return Texture.selected;
} else {
return Texture.all.findLast(tex => tex.visible);
}
} else if (Texture.selected) {
Texture.selected = undefined;
}
if (Texture.all.length > 1 && Texture.all.find(t => t.render_mode == 'layered')) {
var i = 0;
for (var i = Texture.all.length-1; i >= 0; i--) {
if (Texture.all[i].visible) {
return Texture.all[i]
}
}
return Texture.all.findLast(tex => tex.visible);
}
return Texture.all[0]
}