Skip to content

use file system access api - #363

Merged
Vegita2 merged 68 commits into
masterfrom
file-system-api
Nov 24, 2026
Merged

Vegita2 merged 68 commits into
masterfrom
file-system-api

Conversation

@Vegita2

@Vegita2 Vegita2 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Editor now uses file system access api to save/load files.

  • editor now runs fully as a website. No need for backend. (Chromium Browsers only)
  • files are now saved from where they were loaded.
  • tons of simplifications, no need for separate backend/common projects anymore or electron specific code in the webapp
  • added support for base game DLC's
  • allow selecting multiple mods
  • added missing destructible types
  • updated to angular 22

@2767mr 2767mr left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR works way better than I expected it to. I also only found one or two things I would consider a bug, the rest are only minor inconsistencies and code style issues.

  • This PR drops support for mod name coloring:
image
  • Trying to add an entity via left clicking the map opens the browsers context menu.
  • Closing the browser window does not ask the user if they wish to save their changes.
  • NIT: Most of the changeDetection: ChangeDetectionStrategy.Eager can be removed

<mat-tree #tree [dataSource]="nodes" [childrenAccessor]="childrenAccessor" class="mapTree">
<mat-tree-node *matTreeNodeDef="let node; when: isSection" class="mapTree-section" isExpandable>
<button class="section-header" matTreeNodeToggle>
<span class="section-name">{{ node.names[0] }}</span>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I would prefer to have an indication that this element is interactable, such as the expand_more and chevron_right icons.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it but didn't really like it. I think the hover effect + cursor: pointer is enough. What do you think?

image

Comment thread webapp/src/app/tests/test-helper.ts Resolved
@Vegita2

Vegita2 commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

This PR drops support for mod name coloring:

Added it back

Trying to add an entity via left clicking the map opens the browsers context menu.

I can't reproduce it

Closing the browser window does not ask the user if they wish to save their changes.

There is a warning that unsaved changes will be lost

NIT: Most of the changeDetection: ChangeDetectionStrategy.Eager can be removed

I'd like to do that together with moving to zoneless. There are still lots of components that need it.

@2767mr

2767mr commented Nov 18, 2026

Copy link
Copy Markdown
Member

Trying to add an entity via left clicking the map opens the browsers context menu.

I can't reproduce it

Sorry, I meant right clicking. Steps to reproduce:

image

There is a warning that unsaved changes will be lost

It does not show for me. Steps to reproduce:

@Vegita2

Vegita2 commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

What browser are you using? I don't have these issues with chrome on ubuntu

@2767mr

2767mr commented Nov 18, 2026

Copy link
Copy Markdown
Member

Chrome 157.0.8103.79 on Windows 11

@Vegita2

Vegita2 commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

I can't reproduce any of that. I also checked the code and made some small adjustments, don't know if any of that helps.

  • contextmenu is disabled for the game canvas, so the only way to actually show it would be clicking on something that is not part of the canvas. I updated it to use the function phaser provides, but I don't think it changes anything.
  • the unsaved dialog used a deprecated property so I updated it.

Comment on lines 489 to 492
private showAddEntityMenu() {

Globals.globalEventsService.showAddEntityMenu.next(Helper.getPointerPos(this.scene.input.activePointer));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe what is happening with the context menu is that the entity menu shows up so fast that the right click is executed on the entity menu and thus causes a context menu (as it is no longer the game canvas). Adding a setTimeout here worked for me:

private showAddEntityMenu() {
	setTimeout(() => {
		Globals.globalEventsService.showAddEntityMenu.next(Helper.getPointerPos(this.scene.input.activePointer));
	});
}

@2767mr

2767mr commented Nov 21, 2026

Copy link
Copy Markdown
Member

It turns out the usaved changes dialoge is an issue on my end. It seems to not happen on *.github.io domains. It works fine in a sandbox.

@Vegita2

Vegita2 commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

could you try disabling the context menu for the add entity menu?

@2767mr

2767mr commented Nov 22, 2026

Copy link
Copy Markdown
Member

could you try disabling the context menu for the add entity menu?

I messed around a bit and this also works. In list-search-overlay.component.ts:

Change transform: 'scale(0, 0)' to transform: 'scale(0.1, 0.1)' (so that there is an element to click on, and not the backdrop element from angular material)

Then add this to the @Component:

@Component({
	// ...
	host: {
		'(contextmenu)': '$event.preventDefault()'
	}
	// ...
});

@2767mr 2767mr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems to work now.

@Vegita2
Vegita2 enabled auto-merge November 24, 2026 15:58
@Vegita2
Vegita2 merged commit b201d1b into master Nov 24, 2026
7 of 8 checks passed
@Vegita2
Vegita2 deleted the file-system-api branch November 24, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants