Phase 1 — Fit-to-view zoom: - computeFitTransform() calculates bounding box and scales to fit all nodes - Replaces hardcoded scale=1 reset in animateZoomReset() and initCanvas() - Dim 1 no longer appears tiny after zooming out from dim 2 Phase 2 — Grid system: - Shared gridConstants.js (GRID=50, GRID_STEP_X=200, GRID_STEP_Y=150) - MapDataService snapToGrid() aligns all node positions server-side - Canvas renders subtle grid lines (shown on interaction only, with fade) - Line highlighting support via setHighlightedLine() for FAB hover Phase 3 — Branch handles: - Hover any station node → 3 "+" handles appear (0°/45°/315°) - 0° extends the current line, 45°/315° fork to create new branch - Ghost preview (dashed line + circle) on handle hover - Handles only show at unoccupied grid positions - Grid fades in during handle interaction, fades out after Phase 4 — Custom tracks database: - metro_lines table (project_id, naam, color, type, order) - metro_nodes table (metro_line_id, naam, status, x, y, order) - MetroLine + MetroNode models, controllers, routes - Project.metroLines() relationship added Phase 5+6 — FAB redesign + MetroMap wiring: - FAB shows "Nieuw thema (lijn)" at root, "Nieuwe lijn" in project dim - Track creation modal with retro-styled form - MetroMap handles create-node events from branch handles - Extend (0°) opens commitment/document form, fork opens track form - Canvas context menu replaced with "hover to branch" hint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\MetroNode;
|
|
use Illuminate\Http\Request;
|
|
|
|
class MetroNodeController extends Controller
|
|
{
|
|
public function store(Request $request)
|
|
{
|
|
$validated = $request->validate([
|
|
'metro_line_id' => 'required|exists:metro_lines,id',
|
|
'naam' => 'required|string|max:255',
|
|
'beschrijving' => 'nullable|string',
|
|
'x' => 'required|integer',
|
|
'y' => 'required|integer',
|
|
'eigenaar_id' => 'nullable|exists:users,id',
|
|
]);
|
|
|
|
$maxOrder = MetroNode::where('metro_line_id', $validated['metro_line_id'])->max('order') ?? 0;
|
|
$validated['order'] = $maxOrder + 1;
|
|
$validated['status'] = 'active';
|
|
|
|
$node = MetroNode::create($validated);
|
|
|
|
return back()->with('success', "Node '{$node->naam}' aangemaakt.");
|
|
}
|
|
|
|
public function update(Request $request, MetroNode $metroNode)
|
|
{
|
|
$validated = $request->validate([
|
|
'naam' => 'sometimes|string|max:255',
|
|
'beschrijving' => 'nullable|string',
|
|
'status' => 'sometimes|string|in:active,completed,parked',
|
|
'x' => 'sometimes|integer',
|
|
'y' => 'sometimes|integer',
|
|
]);
|
|
|
|
$metroNode->update($validated);
|
|
|
|
return back()->with('success', 'Node bijgewerkt.');
|
|
}
|
|
|
|
public function destroy(MetroNode $metroNode)
|
|
{
|
|
$metroNode->delete();
|
|
|
|
return back()->with('success', 'Node verwijderd.');
|
|
}
|
|
}
|