From 941e214499d20bbfb11e4347721b7e2816e88624 Mon Sep 17 00:00:00 2001 From: Nordup Date: Sun, 17 Aug 2025 13:36:11 +0700 Subject: [PATCH] bookmarks fix changing position on icon update --- app/scripts/api/featured_gates.gd | 4 ++-- app/scripts/resources/bookmarks.gd | 12 ++++++++++++ app/shaders/spinning_border.gdshader | 4 +--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/scripts/api/featured_gates.gd b/app/scripts/api/featured_gates.gd index 18939b6..708196c 100644 --- a/app/scripts/api/featured_gates.gd +++ b/app/scripts/api/featured_gates.gd @@ -49,5 +49,5 @@ func star_gate(gate_d: Dictionary) -> void: gate.featured = true bookmarks.star(gate) - gate.icon = await FileDownloader.download(gate.icon_url) - bookmarks.update(gate) + var icon = await FileDownloader.download(gate.icon_url) + bookmarks.update_icon(gate.url, icon) diff --git a/app/scripts/resources/bookmarks.gd b/app/scripts/resources/bookmarks.gd index 62aaf6f..936e45d 100644 --- a/app/scripts/resources/bookmarks.gd +++ b/app/scripts/resources/bookmarks.gd @@ -31,6 +31,18 @@ func make_first(url: String) -> void: gates[url] = gate +func update_icon(url: String, icon: String) -> void: + if not gates.has(url): return + + var gate = gates[url] + gate.icon = icon + + var index = starred_gates.find(gate) + starred_gates[index].icon = icon + + save_icon.emit(gate) + + func update(gate: Gate) -> void: if not gates.has(gate.url): return diff --git a/app/shaders/spinning_border.gdshader b/app/shaders/spinning_border.gdshader index 7ef12f3..87a2d6b 100644 --- a/app/shaders/spinning_border.gdshader +++ b/app/shaders/spinning_border.gdshader @@ -40,7 +40,7 @@ void fragment() { // Decide radii source: pixel radii (if provided) or UV radii scaled to pixels float base_scale = min(size_px.x, size_px.y); vec4 r_src_px = corner_radius * base_scale; - + // Clamp radii to reasonable bounds float r_tl = clamp(r_src_px.x, 0.0, 0.5 * base_scale); float r_tr = clamp(r_src_px.y, 0.0, 0.5 * base_scale); @@ -150,5 +150,3 @@ void fragment() { vec4 col = texture(gradient, vec2(t, 0.5)); COLOR = vec4(col.rgb, col.a * mask); } - -