104 lines
16 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@model PlotLine.Models.MapsViewModel
@using System.Text.Json
@{
if (ViewData["DetachedWorkspace"] is true) Layout = "_WorkspaceLayout";
if (ViewData["SpatialRenderer"] is true) Layout = "_SpatialRendererLayout";
ViewData["Title"] = Model.Document?.Map.Name ?? "Maps";
ViewData["ProjectSection"] = "Maps";
ViewData["ShellClass"] = "plotline-shell-wide maps-shell";
}
@if (ViewData["DetachedWorkspace"] is not true) { <partial name="_ProjectSectionNav" model="Model.Project" /> }
<link rel="stylesheet" href="~/css/maps-workspace.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/workspace-surface.css" asp-append-version="true" />
<section id="mapsApp" class="maps-app" aria-label="Maps workspace">
<header class="maps-toolbar">
<h1>Maps <help-icon key="maps.workspace" /></h1>
<form id="mapsSelectorForm" data-pwa-context="Map" data-pwa-scope="Map"><label>Map <select id="mapsSelect" name="map" aria-label="Current map"><option value="">All maps</option>@foreach(var map in Model.Maps){<option value="@map.MapID" selected="@(map.MapID == Model.Document?.Map.MapID)">@map.Name @(map.ParentMapID.HasValue ? "↳" : "")</option>}</select></label></form>
<div data-pwa-context="Mode" data-pwa-essential="true" role="group" aria-label="Map mode"><button type="button" data-mode="create" aria-pressed="true">Create</button><button type="button" data-mode="explore" aria-pressed="false">Explore</button><button type="button" data-mode="story" aria-pressed="false">Story</button></div>
<form class="maps-find" id="mapsSearchForm" data-pwa-context="Search" data-pwa-scope="Search"><label>Find on map <input id="mapsFind" name="search" type="search" placeholder="Place or feature name" /></label></form>
<button type="button" id="mapsNew" data-pwa-context="Map" data-ribbon-icon="add">New map</button>
<button type="button" id="mapsSave" data-pwa-context="Map" data-ribbon-icon="save">Save</button>
<details data-pwa-context="Map actions" data-pwa-menu-icon="layout" data-pwa-compact="true"><summary>Map actions</summary><div class="maps-menu"><button type="button" id="mapsRename" data-ribbon-icon="writer">Rename map</button><button type="button" id="mapsDuplicate" data-ribbon-icon="copy">Duplicate map</button><button type="button" id="mapsDelete" data-ribbon-icon="remove">Delete map…</button></div></details>
<div data-pwa-context="Editing" class="maps-edit-tools"><button type="button" id="mapsUndo" data-ribbon-icon="undo">Undo</button><button type="button" id="mapsRedo" data-ribbon-icon="redo">Redo</button></div>
<button type="button" id="mapsGeographic" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Position geographically</button>
<button type="button" id="mapsArrange" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Arrange from relationships</button>
<button type="button" data-map-order="front" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Bring to front</button>
<button type="button" data-map-order="forward" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Bring forward</button>
<button type="button" data-map-order="backward" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Send backward</button>
<button type="button" data-map-order="back" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Send to back</button>
<button type="button" data-topology="join" data-pwa-context="Arrange" data-ribbon-icon="auto-arrange">Join boundaries</button>
<button type="button" data-topology="unjoin" data-pwa-context="Arrange" data-ribbon-icon="separate-window">Unjoin boundary</button>
<button type="button" id="mapsAppearance" data-pwa-context="Map appearance" data-ribbon-icon="settings">Map appearance</button>
<button type="button" id="mapsDetach" data-pwa-context="Workspace" data-ribbon-icon="separate-window">Open in separate window</button>
<button type="button" id="mapsMaximise" data-pwa-context="Workspace" data-pwa-essential="true" data-ribbon-icon="maximise" aria-pressed="false"><span data-workspace-caption>Maximise workspace</span></button>
</header>
<div id="mapsStoryToolbar" class="maps-story-toolbar" hidden>
<form data-pwa-context="Story lens" data-pwa-scope="Story lens"><label>Story lens <select id="mapStoryLens" aria-label="Story lens" name="lens"><option value="overview">Overview</option><option value="scene">Scene</option><option value="character">Character</option><option value="chapter">Chapter</option><option value="plot">Plot Line</option><option value="time">Time</option></select></label></form>
<form data-pwa-context="Story scope" data-pwa-scope="Story scope" data-pwa-compact="true"><label>Book <select id="mapStoryBook" aria-label="Story book" name="book"><option value="0">All books</option></select></label><label>Order <select id="mapStoryScenario" aria-label="Story order" name="scenario"><option value="0">Canonical manuscript</option></select></label></form>
<label id="mapStorySearchLabel" class="maps-story-web-search">Find scene <input id="mapStorySceneSearch" aria-label="Find scene" name="search" type="search" placeholder="Title or chapter" /></label><form data-pwa-context="Story scene" data-pwa-scope="Story scene"><label>Scene <select id="mapStoryScene" aria-label="Story scene" name="scene"></select></label></form>
<form data-pwa-context="Story characters" data-pwa-scope="Story characters" data-pwa-compact="true"><label>Character <select id="mapStoryCharacter1" aria-label="Character A" name="character1"></select></label><label>Compare <select id="mapStoryCharacter2" aria-label="Character B" name="character2"></select></label><label>Compare <select id="mapStoryCharacter3" aria-label="Character C" name="character3"></select></label></form>
<form data-pwa-context="Story chapter" data-pwa-scope="Story chapter"><label>Chapter <select id="mapStoryChapter" aria-label="Story chapter" name="chapter"></select></label></form>
<form data-pwa-context="Story plot" data-pwa-scope="Story plot" data-pwa-compact="true"><label>Plot Line <select id="mapStoryPlot1" aria-label="Plot Line A" name="plot1"></select></label><label>Compare <select id="mapStoryPlot2" aria-label="Plot Line B" name="plot2"></select></label><label>Compare <select id="mapStoryPlot3" aria-label="Plot Line C" name="plot3"></select></label></form>
<form data-pwa-context="Story time" data-pwa-scope="Story time"><label>Story date / time <select id="mapStoryTime" aria-label="Story date / time" name="time"></select></label></form>
<div data-pwa-context="Story navigation"><button type="button" id="mapStoryPrevious" data-ribbon-icon="previous">Previous scene</button><button type="button" id="mapStoryNext" data-ribbon-icon="next">Next scene</button></div>
<details data-pwa-context="Story view" data-pwa-scope="Story view" data-pwa-menu-icon="display" data-pwa-compact="true"><summary>Story view</summary><form id="mapStoryFilters"><label>Geography <select id="mapStoryMapping" aria-label="Story geography filter" name="mapping"><option value="all">All story geography</option><option value="mapped">On this map</option><option value="unmapped">Unmapped Locations</option><option value="missing">No Location assigned</option><option value="elsewhere">On another map level</option></select></label><label>Map status <select id="mapStoryPlanning" aria-label="Story planning filter" name="planning"><option value="all">Planning and established</option><option value="planning">Planning map pieces</option><option value="established">Established map pieces</option></select></label></form><button type="button" id="mapStoryLayer" aria-pressed="true">Story overlays</button><button type="button" id="mapStoryGaps">Unmapped / no Location</button><button type="button" id="mapStoryObservations">Travel observations</button><button type="button" id="mapStoryRefresh" data-ribbon-icon="refresh">Refresh story</button></details>
</div>
<p id="mapsStatus" class="maps-status" role="status" aria-live="polite">Rough first. Detail later. Visual placement is never a physical scale.</p>
<div class="maps-body">
<aside id="mapsLibrary" class="maps-library" aria-label="Map pieces">
<h2>Map pieces</h2><label>Find a piece <input id="mapsAssetSearch" type="search" placeholder="Try castle, forest, river…" /></label>
<label>Category <select id="mapsCategory"><option value="">All categories</option></select></label>
<p class="maps-hint">Pick a piece, then click the map. Or drag it onto the map.</p><button type="button" id="mapsDefine">Define a place first</button><div id="mapsAssets" class="maps-assets"></div>
<h2>Unplaced Locations</h2><label>Find a story Location <input id="mapsLocationSearch" type="search" /></label><div id="mapsLocations"></div>
<details><summary>Show map layers</summary><div id="mapsLayers"></div></details>
</aside>
<div class="maps-centre">
<nav id="mapsBreadcrumbs" aria-label="Map hierarchy"></nav>
<div id="mapsSearchResults" class="maps-search-results" aria-label="Map search results"></div>
<div id="mapsStory" hidden role="status" aria-live="polite">Loading manuscript geography…</div>
<div id="mapsWelcome" hidden><h2>Your story, in place</h2><p>Start with a few places, or build a landscape a piece at a time.</p><button type="button" id="mapsWelcomeNew">@(Model.Maps.Any() ? "Create new map" : "Create your first map")</button><div id="mapsList"></div></div>
<svg id="mapsCanvas" data-pd-context-web="true" viewBox="-600 -400 1200 800" tabindex="0" role="group" aria-label="Story map. Drag background to pan. Use zoom controls. Select pieces for details. Alt + click to cycle overlapping pieces.">
<defs>
<pattern id="map-forest" width="32" height="32" patternUnits="userSpaceOnUse"><rect width="32" height="32" fill="var(--maps-forest-fill,#c4d4af)"/><path d="M8 5l-6 12h12z M23 14l-6 12h12z" fill="#63845f"/></pattern>
<pattern id="map-mountains" width="48" height="36" patternUnits="userSpaceOnUse"><rect width="48" height="36" fill="var(--maps-mountains-fill,#d3cebd)"/><path d="M0 32L17 5l17 27 M24 36L40 12l16 24" fill="#aca895" stroke="#727a6e"/><path d="M12 13l5-8 6 10-6-3z" fill="#f8f7ef"/></pattern>
<pattern id="map-marsh" width="30" height="30" patternUnits="userSpaceOnUse"><rect width="30" height="30" fill="var(--maps-marsh-fill,#c2d3bc)"/><path d="M5 25h20M10 23v-9m0 5-4-4m4 2 4-5" fill="none" stroke="#718d7a"/></pattern>
<pattern id="map-hills" width="45" height="30" patternUnits="userSpaceOnUse"><rect width="45" height="30" fill="#d8d5b1"/><path d="M0 25q12-20 24 0m-2-10q12-18 24 0" fill="none" stroke="#9eaa80"/></pattern>
<pattern id="map-farmland" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(25)"><rect width="24" height="24" fill="#e1d39c"/><path d="M0 6h24M0 18h24" stroke="#b3ad73"/></pattern>
</defs><g id="mapsReferenceLayer"></g><g id="mapsScene"></g><g id="mapsStoryLayer" aria-label="Story overlays" hidden></g><g id="mapsHandles"></g>
</svg>
<div id="mapStoryScrubberRow" class="maps-scene-scrubber" hidden><label for="mapStoryScrubber">Scene <output id="mapStoryScrubberContext"></output></label><input id="mapStoryScrubber" type="range" min="0" max="0" value="0" aria-label="Scene in manuscript order" /><button type="button" id="mapStoryCoverage">Inspect unmapped Locations</button></div>
<div class="maps-canvas-tools"><button type="button" id="mapsZoomOut" aria-label="Zoom out">−</button><span id="mapsZoom">100%</span><button type="button" id="mapsZoomIn" aria-label="Zoom in">+</button><button type="button" id="mapsFit">Fit map</button><button type="button" id="mapsFitSelection">Fit selection</button><span>Not to scale · N ↑</span></div>
</div>
<aside id="mapsDetails" class="maps-details" aria-label="Details"><h2>Details</h2><div id="mapsDetailContent">Select something on the map to see its details.</div></aside>
</div>
<dialog id="mapsNewDialog"><form id="mapsNewForm"><h2>New map</h2><label>Name <input name="Name" maxlength="200" required autofocus /></label><label>What are you mapping? <select name="Kind">@foreach(var kind in PlotLine.Services.MapValidation.Kinds){<option>@kind</option>}</select></label><label>How would you like to begin? <select name="Starter"><option value="blank">Blank map</option><option value="land">Single land mass</option><option value="island">Large island</option><option value="islands">Island group</option><option value="two">Two land masses</option><option value="inland">Inland region</option><option value="local">City / local area</option></select></label><label>Parent map <select name="ParentMapID"><option value="">None</option>@foreach(var map in Model.Maps){<option value="@map.MapID">@map.Name</option>}</select></label><p>Starter layouts contain editable shapes only. You name and define your world.</p><div><button type="button" id="mapsNewCancel">Cancel</button><button type="submit">Create map</button></div></form></dialog>
<dialog id="mapsArrangeDialog"><h2>Arrange from relationships</h2><p>Preview an arrangement using directions and relative distances. Known distances never control spacing.</p><label><input type="checkbox" id="mapsOnlyNew" /> Arrange unplaced / new items only</label><p id="mapsArrangeWarnings"></p><button type="button" id="mapsArrangeCancel">Cancel</button><button type="button" id="mapsArrangeApply">Apply arrangement</button></dialog>
<dialog id="mapsGeographicDialog" aria-labelledby="mapsGeographicTitle">
<h2 id="mapsGeographicTitle">Position geographically</h2>
<p id="mapsGeographicMessage" role="status"></p>
<div id="mapsGeographicPreview" aria-label="Proposed geographical arrangement"></div>
<p>Preview only · North ↑ · One geographical scale in both directions. Coincident places overlap. Descendants retain their offsets; anchored curves follow their endpoints.</p>
<details id="mapsGeographicList"><summary>Movements, hierarchy and lookup status</summary><div id="mapsGeographicSummary"></div></details>
<p id="mapsGeographicRequestStatus" role="status"></p>
<div class="maps-geographic-actions"><button type="button" id="mapsGeographicRequest">Request missing lookups</button><button type="button" id="mapsGeographicRefresh">Refresh status</button><button type="button" id="mapsGeographicCancel">Cancel</button><button type="button" id="mapsGeographicApply">Apply positions</button></div>
<p>Apply closes this preview and adds one Undo step. Use Save to persist the map; you can drag markers afterwards.</p>
</dialog>
</section>
@Html.AntiForgeryToken()
<script id="mapsBootstrap" type="application/json">@Html.Raw(JsonSerializer.Serialize(new { projectId = Model.Project.ProjectID, maps = Model.Maps, locations = Model.Locations, floorPlans = Model.FloorPlans, referenceImages = Model.ReferenceImages, document = Model.Document }, new JsonSerializerOptions(JsonSerializerDefaults.Web)))</script>
@section Scripts {
<script src="~/js/workspace-surface.js" asp-append-version="true"></script>
<script src="~/js/maps-symbols.js" asp-append-version="true"></script>
<script src="~/js/maps-engine.js" asp-append-version="true"></script>
<script src="~/js/maps-topology-engine.js" asp-append-version="true"></script>
<script src="~/js/maps-appearance-engine.js" asp-append-version="true"></script>
<script src="~/js/maps-geography-engine.js" asp-append-version="true"></script>
<script src="~/js/maps-workspace.js" asp-append-version="true"></script>
<script src="~/js/maps-appearance.js" asp-append-version="true"></script>
@if(ViewData["SpatialRenderer"] is not true){
<script src="~/js/spatial-live-updates.js" asp-append-version="true"></script>
<script src="~/js/maps-story-engine.js" asp-append-version="true"></script>
<script src="~/js/maps-story.js" asp-append-version="true"></script>
}
}