Revert to last working state (68437c3) before PNG icon changes

This commit is contained in:
gmp
2026-05-10 06:45:47 -04:00
parent 1b1cf51528
commit fe3e7c3d75
4 changed files with 67 additions and 136 deletions
+5 -3
View File
@@ -25,7 +25,9 @@ type ConfigUpdate interface {
}
func (e ConfigEvent) apply(s *State) {
s.SetSize(e.Width, e.Height)
s.ScreenWidth = e.Width
s.ScreenHeight = e.Height
s.Elems = EditorLayout(e.Width, e.Height)
}
func (e ScaleEvent) apply(s *State) {
@@ -91,14 +93,14 @@ func (l *Logic) ResultChan() <-chan ResultEvent {
func (l *Logic) ScreenSize() (ui.Dp, ui.Dp) {
l.mu.Lock()
defer l.mu.Unlock()
return l.state.ScreenWidth(), l.state.ScreenHeight()
return l.state.ScreenWidth, l.state.ScreenHeight
}
// Scale returns the current scale factor (pixels per DP).
func (l *Logic) Scale() float32 {
l.mu.Lock()
defer l.mu.Unlock()
return l.state.Scale()
return l.state.Scale
}
// Run runs the logic goroutine loop.
+8 -24
View File
@@ -7,9 +7,9 @@ import (
// State holds all application state owned by the logic goroutine.
// All dimensions are in device-independent pixels (Dp).
type State struct {
screenWidth ui.Dp
screenHeight ui.Dp
scale float32 // pixels per DP, default 1.0
ScreenWidth ui.Dp
ScreenHeight ui.Dp
Scale float32 // pixels per DP, default 1.0
Elems []ui.Element
}
@@ -18,33 +18,17 @@ type State struct {
// scale defaults to 1.0 until updated by ScaleEvent.
func NewState(screenWidth, screenHeight ui.Dp) *State {
return &State{
screenWidth: screenWidth,
screenHeight: screenHeight,
scale: 1.0,
ScreenWidth: screenWidth,
ScreenHeight: screenHeight,
Scale: 1.0,
Elems: EditorLayout(screenWidth, screenHeight),
}
}
// Scale returns the current scale factor (pixels per DP).
func (s *State) Scale() float32 { return s.scale }
// ScreenWidth returns the current screen width in Dp.
func (s *State) ScreenWidth() ui.Dp { return s.screenWidth }
// ScreenHeight returns the current screen height in Dp.
func (s *State) ScreenHeight() ui.Dp { return s.screenHeight }
// SetScale updates the scale factor and recomputes layout.
func (s *State) SetScale(scale float32) {
s.scale = scale
s.Elems = EditorLayout(s.screenWidth, s.screenHeight)
}
// SetSize updates the screen dimensions and recomputes layout.
func (s *State) SetSize(width, height ui.Dp) {
s.screenWidth = width
s.screenHeight = height
s.Elems = EditorLayout(width, height)
s.Scale = scale
s.Elems = EditorLayout(s.ScreenWidth, s.ScreenHeight)
}
// EditorLayout computes regions for the editor page.