client refactor

This commit is contained in:
Ilia Denisov
2026-03-09 13:26:17 +02:00
committed by GitHub
parent ac35360d60
commit bb2bb899de
10 changed files with 339 additions and 295 deletions
+8 -8
View File
@@ -11,7 +11,7 @@ import (
"github.com/iliadenisov/galaxy/client/world"
)
type fakeEditor struct {
type fakeClient struct {
scale float32
p world.RenderParams
@@ -20,21 +20,21 @@ type fakeEditor struct {
refresh int
}
func (e *fakeEditor) CanvasScale() float32 { return e.scale }
func (e *fakeClient) CanvasScale() float32 { return e.scale }
func (e *fakeEditor) UpdateParams(fn func(p *world.RenderParams)) {
func (e *fakeClient) UpdateParams(fn func(p *world.RenderParams)) {
fn(&e.p)
e.updates++
}
func (e *fakeEditor) RequestRefresh() { e.refresh++ }
func (e *fakeClient) RequestRefresh() { e.refresh++ }
func (e *fakeEditor) ForceFullRedraw() { e.forced = true }
func (e *fakeClient) ForceFullRedraw() { e.forced = true }
func TestPanController_DraggedUpdatesCameraByDeltaPx(t *testing.T) {
t.Parallel()
fe := &fakeEditor{
fe := &fakeClient{
scale: 1.0, // 1 fyne unit == 1 px for the test
p: world.RenderParams{
CameraZoom: 1.0,
@@ -60,7 +60,7 @@ func TestPanController_DraggedUpdatesCameraByDeltaPx(t *testing.T) {
func TestPanController_DraggedUsesCanvasScaleByMultiplying(t *testing.T) {
t.Parallel()
fe := &fakeEditor{
fe := &fakeClient{
scale: 2.0, // 2 px per fyne unit
p: world.RenderParams{
CameraZoom: 1.0,
@@ -82,7 +82,7 @@ func TestPanController_DraggedUsesCanvasScaleByMultiplying(t *testing.T) {
func TestPanController_DragEndForcesFullRedrawAndRefresh(t *testing.T) {
t.Parallel()
fe := &fakeEditor{
fe := &fakeClient{
scale: 1.0,
p: world.RenderParams{
CameraZoom: 1.0,