Skip to content

Add province merge UI and merge logic#1433

Merged
Azgaar merged 3 commits into
Azgaar:masterfrom
Avengium:Merge-provinces
May 26, 2026
Merged

Add province merge UI and merge logic#1433
Azgaar merged 3 commits into
Azgaar:masterfrom
Avengium:Merge-provinces

Conversation

@Avengium

Copy link
Copy Markdown
Contributor

Added a "Merge provinces" button to the provinces toolbar. Implemented the merge behavior and the UI for the feature. When the button is clicked, a dialog opens. The new dialog lists provinces in the currently filtered state and lets the user pick a primary province (radio button) and select others provinces (checkboxes) inside that state.
FMG 1 122 Merge Provinces 2026-05-12 01

FMG 1 122 Merge Provinces 2026-05-12 02

Added a highlight province on hover like the one is already on "merge states" feature. Once the user decides and clicks "merge", a confirmation dialog appears. User can confirm the destructive merge.

FMG 1 122 Merge Provinces 2026-05-12 03

Implemented mergeProvinces(ids, primary) to move burgs and cell assignments to the primary province, mark merged provinces as removed, update the state's province list, and trigger a redraw when province layer is visible. Also harden provinceHighlightOff to handle missing targets and ensure highlight paths are removed when exiting.

Add a "Merge provinces" button to the provinces toolbar and implement the modal dialog and merge behavior. The new dialog lists provinces in the currently filtered state, lets the user pick a primary province (radio) and select others (checkboxes), highlights provinces on hover, and confirms the destructive merge. Implement mergeProvinces(ids, primary) to move burgs and cell assignments to the primary province, mark merged provinces as removed, update the state's province list, and trigger a redraw when province layer is visible. Also harden provinceHighlightOff to handle missing targets and ensure highlight paths are removed when exiting.
@netlify

netlify Bot commented May 12, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit ac9ace9
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a04a01ff728430008f7b630
😎 Deploy Preview https://deploy-preview-1433--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a “Merge provinces” capability to the Provinces Editor, aligning provinces tooling with the existing “merge states” workflow by introducing a merge dialog UI, hover highlighting, and underlying merge logic that consolidates selected provinces into a chosen primary province.

Changes:

  • Added a “Merge provinces” toolbar button to the Provinces Editor UI.
  • Implemented a merge dialog that lists provinces within the currently selected (filtered) state, supports choosing a primary province, and highlights provinces on hover.
  • Added mergeProvinces(ids, primary) logic to reassign burgs/cells and mark merged provinces as removed, plus a robustness update to provinceHighlightOff.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/index.html Adds the “Merge provinces” button to the provinces toolbar.
public/modules/ui/provinces-editor.js Wires up the button, implements merge dialog + hover highlighting, adjusts highlight cleanup, and adds province merge logic.

Comment thread public/modules/ui/provinces-editor.js Outdated
Comment thread public/modules/ui/provinces-editor.js Outdated
Comment thread public/modules/ui/provinces-editor.js Outdated
Avengium added 2 commits May 13, 2026 17:35
* calling drawProvinces() and then refreshing the editor UI.
* function cleanupMergedProvince for removed provinces.
* Single pass over pack.cells.province using a lookup  to remap all merged province ids at once.
* Borders: Province merging changes cell ownership, so borders must be redrawn.
* Statistics: Area and population calculations become invalid after merging.
* Poles: Used for province label positioning and COA placement.
* Fog/Debug: Prevents stale visual artifacts from remaining on the map.
@Azgaar Azgaar merged commit fdeb656 into Azgaar:master May 26, 2026
6 of 7 checks passed
@Avengium Avengium deleted the Merge-provinces branch May 28, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants