Added map-bounds clipping options for tile/image/object rendering with map-level clipRect override#4351
Added map-bounds clipping options for tile/image/object rendering with map-level clipRect override#4351JustJ01 wants to merge 4 commits intomapeditor:masterfrom
Conversation
|
Hi @bjorn , I've implemented core View clipping for Tile + Image layers, plus object modes (Show All / Clip / Hide Out of Bounds) , persistent preferences and view menu wiring , map-level custom clipping rectangle property (clipRect). Please review the changes whenever possible. Items like per-map background fill behavior in World view, world background draw-order policy (mentioned by @eishiya) are not included in this PR. I'm also considering adding dedicated first class UI fields in map properties for clipRect in a follow up. If the current scope and implementation looks good, I can proceed with those additional features that @eishiya mentioned |
|
@JustJ01 In light of the discussions with @eishiya and after my previous code review, I'd like to see the following changes:
This should simplify the implementation, avoid performance concerns and I think it's also a little more intuitive. The following options should not be handled for now, I'd rather see them considered for future changes:
|
Should I open a separate issue for this, or would it suffice to leave the existing one open? Edit: Perhaps the middle option should be "Clip All Maps to Bounds", for clarity? |
I think it would be better to create a new issue for that specific option, and it would indeed be good to see some screenshots to illustrate this need.
It could get a little strange for this menu to change based on that context, especially since one could officially still have it set to "Clip Other Maps to Bounds" but with the world unloaded. |
|
Hi @bjorn , I have made the changes as per you requested. Features implemented:
Screen.Recording.2026-04-03.090619.mp4Screen.Recording.2026-04-03.095004.mp4 |
Fixes #4153
Description:
This PR adds editor-side clipping controls to keep map visuals constrained, useful for world context maps and oversized/repeating content.
Features implemented:
1. View Toggle: Clip Map to Bounds
Adds a new toggle: View → Clip Map to Bounds
Tile Layer and Image Layer rendering now respect clipping when this option is enabled.
2. View Submenu: Object Bounds
Adds a new submenu: View → Object Bounds
This controls how objects behave when they are near or outside the map bounds.
Show All
Old behavior. All objects remain visible, including those fully outside the map.
Clip to Map Bounds
Objects remain visible, but any portion outside the map bounds is visually clipped.
Hide Out-of-Bounds
Objects fully outside the map are hidden.
Objects touching or crossing the map boundary remain visible.
Object rendering and visibility now follow the selected mode.
3. Map-Level Clipping Override (Custom Clipping)
Adds support for a custom map property:
clipRectThis allows defining a custom clipping rectangle instead of using the full map bounds.
Primary property name:
clipRectAccepted formats:
x, y, width, height"hello"), clipping automatically falls back to the normal map bounds.4. Unified Clipping Logic
Tile, image, and object rendering paths now use the same effective clipping bounds, ensuring consistent behavior across all layer types.
How to use:
1) Clip Map to Bounds ( Tile + Image layers)
toggle_clipping.mp4
2) Object Bounds Mode
object_modes.mp4
3) Custom Clipping rectangel (clipRect)
Name: clipRect
Type: string
value: (Valid format string mentioned above)
clipRect_override.mp4