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
+7 -7
View File
@@ -9,10 +9,10 @@ import (
)
/*
Editor pan integration for Fyne Draggable:
Client pan integration for Fyne Draggable:
- DragEvent provides absolute coordinates in "Fyne units".
- Editor knows canvasScale (Fyne units per pixel) and converts to pixels.
- Client knows canvasScale (Fyne units per pixel) and converts to pixels.
- We keep last drag position and compute dx/dy ourselves.
- We update camera center in world-fixed (CameraXWorldFp/YWorldFp).
@@ -21,9 +21,9 @@ Sign convention (map follows pointer):
- Drag down (dyPx > 0): move world content down => move camera up => CameraYWorldFp -= dyWorldFp
*/
// draggableEditor is the minimal interface we need from your editor implementation.
// If your Editor already has these methods/fields, you can fold the code directly into it.
type draggableEditor interface {
// draggableClient is the minimal interface we need from your client implementation.
// If your Client already has these methods/fields, you can fold the code directly into it.
type draggableClient interface {
// CanvasScale returns the fyne-units-per-pixel scale factor.
CanvasScale() float32
@@ -39,7 +39,7 @@ type draggableEditor interface {
// PanController holds per-drag transient state.
type PanController struct {
ed draggableEditor
ed draggableClient
dragging bool
lastFx float32 // last absolute position in Fyne units
@@ -50,7 +50,7 @@ type PanController struct {
remPxY float32
}
func NewPanController(ed draggableEditor) *PanController {
func NewPanController(ed draggableClient) *PanController {
return &PanController{ed: ed}
}