Improve drag/drop path handling and landing layout

This commit is contained in:
Stu 2025-12-04 06:59:08 -05:00
parent e749a32926
commit ffca39811a

22
main.go
View File

@ -655,7 +655,6 @@ func (s *appState) showPlayerView() {
centerStack := container.NewVBox(
container.NewCenter(icon),
layout.NewSpacer(),
container.NewCenter(loadBtn),
container.NewCenter(hint),
)
@ -3805,10 +3804,7 @@ func (s *appState) handleDropPlayer(items []fyne.URI) {
var videoPaths []string
for _, uri := range items {
if uri.Scheme() != "file" {
continue
}
path := uri.Path()
path := uriPath(uri)
logging.Debug(logging.CatModule, "drop received path=%s", path)
if info, err := os.Stat(path); err == nil && info.IsDir() {
@ -3831,6 +3827,22 @@ func (s *appState) handleDropPlayer(items []fyne.URI) {
}
}
// uriPath extracts a usable local path from a fyne URI.
func uriPath(u fyne.URI) string {
if u == nil {
return ""
}
// Prefer Path() when present.
if p := u.Path(); p != "" {
return p
}
raw := u.String()
if strings.HasPrefix(raw, "file://") {
raw = strings.TrimPrefix(raw, "file://")
}
return filepath.FromSlash(raw)
}
// detectModuleTileAtPosition calculates which module tile is at the given position
// based on the main menu grid layout (3 columns)
func (s *appState) detectModuleTileAtPosition(pos fyne.Position) string {