Fix : prevent render retrigger when color changes

This commit is contained in:
2024-05-22 12:45:34 +02:00
parent 310b3e7b17
commit bd6978d392
3 changed files with 34 additions and 13 deletions
+15 -2
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
const settingsStore = useSettingsStore()
import { off } from 'process';
import ShaderWorker from '~/assets/workers/ShaderWorker?worker'
const worker = new ShaderWorker()
@@ -49,6 +49,8 @@ function resizeShader() {
command: 'changeBounds',
bounds: { left: bounds.left, bottom: bounds.bottom },
screen: { height: window.screen.height, width: window.screen.width, devicePixelRatio },
colorStart: props.colorStart,
colorEnd: props.colorEnd
})
}
@@ -58,11 +60,22 @@ function endShader() {
})
}
watch(() => [settingsStore.shaderQuality, settingsStore.shaderFramerate, props.colorEnd, props.colorStart], () => {
watch(() => [settingsStore.shaderQuality, settingsStore.shaderFramerate], () => {
safeReloadShader()
})
let has_resized = false
watch(() => [props.colorEnd, props.colorStart], () => {
if (!has_resized) {
has_resized = true
nextTick(() => {
resizeShader()
has_resized = false
})
}
})
onMounted(async () => {
nextTick(() => {
initShader()
-1
View File
@@ -60,7 +60,6 @@ function can_buy_fire_gem(): boolean {
function checkEndTurn() {
// TODO: Add a confirmation dialog if resources are left
console.log("Checking end turn")
if (
(!warning.value)
&& has_actions_remaining()) {