Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right click menu for maps #15

Open
1 of 4 tasks
TechnicJelle opened this issue Sep 3, 2024 · 1 comment
Open
1 of 4 tasks

Right click menu for maps #15

TechnicJelle opened this issue Sep 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@TechnicJelle
Copy link
Owner

TechnicJelle commented Sep 3, 2024

return GestureDetector(
onSecondaryTap: () {/*right click menu will come here*/},
child: MouseRegion(

  • Rename
  • Delete
    • This removes the need for the inline delete icon.
  • Duplicate?

Also:

  • Remove unnecessary file watchers. They will have been replaced by these new built-in buttons.
    One could call that a regression, because right now it does work based on the actual file system, but it's incredibly wonky and I don't like it.
    //watch for changes to files in the maps directory
    final sub = entity
    .watch(
    events: FileSystemEvent.create |
    FileSystemEvent.delete |
    FileSystemEvent.move)
    .listen((FileSystemEvent event) {
    switch (event.type) {
    case FileSystemEvent.create:
    addMap(File(event.path));
    break;
    case FileSystemEvent.delete:
    removeMap(File(event.path));
    break;
    case FileSystemEvent.move:
    final FileSystemMoveEvent moveEvent = event as FileSystemMoveEvent;
    String? destination = moveEvent.destination;
    if (destination != null) {
    removeMap(File(moveEvent.path));
    addMap(File(destination));
    final String prevMapID = p.basenameWithoutExtension(moveEvent.path);
    final String nextMapID = p.basenameWithoutExtension(destination);
    //Also rename the map data directory:
    final Directory mapDataDir =
    Directory(p.join(projectPath, "web", "maps", prevMapID));
    if (mapDataDir.existsSync()) {
    mapDataDir.rename(p.join(projectPath, "web", "maps", nextMapID));
    }
    } else {
    //could not get destination, so we nuke everything and re-add it all
    maps.clear();
    for (final FileSystemEntity map in entity.listSync()) {
    if (map is File) {
    maps.add(map);
    }
    }
    }
    break;
    }
    });

(Probably requires maps list to become a provider.)

@TechnicJelle TechnicJelle added the enhancement New feature or request label Sep 3, 2024
@TechnicJelle
Copy link
Owner Author

I tried adding an actual Right Click functionality, but that proved to be more challenging than I thought.
For the time being, a simple kebab menu on the right will suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant