big cmap refactoring
This commit is contained in:
+27
-7
@@ -2,12 +2,32 @@
|
||||
|
||||
This directory contains the complete browser-side CMap component.
|
||||
|
||||
`cmap.js` is the drawing and hit-testing engine. It is based on the
|
||||
MIT-licensed ionstage/cmap 0.1.3 source and is now maintained as part of
|
||||
racket-wiki. Its public additions include `onSelection` on a map and
|
||||
`onActivation` and `onRendered` callbacks. Activation is recognized inside the
|
||||
same hit-test and drag lifecycle as selection, so it does not depend on a DOM
|
||||
`dblclick` event that may be suppressed by dragging.
|
||||
`cmap.js` is the ES-module entry point of the diagram engine. Its public
|
||||
`DiagramEngine`, `DiagramNode` and `DiagramLink` classes expose only the API
|
||||
used by the wiki editor: creating nodes and links, changing their presentation,
|
||||
connecting endpoints, zooming and receiving render, selection, activation and
|
||||
move events. The engine does not install a `window.Cmap` global.
|
||||
|
||||
The modules under `engine/` separate that API from the renderer internals.
|
||||
`diagram-engine.js` owns the surface and component lifetime;
|
||||
`diagram-node.js`, `diagram-link.js` and `diagram-component.js` define the
|
||||
public handles. The `drawing-*` modules contain DOM rendering, geometry,
|
||||
relations, hit testing and pointer interaction. That rendering core is based on
|
||||
the MIT-licensed ionstage/cmap 0.1.3 source and is maintained as part of
|
||||
racket-wiki. Activation is recognized inside the same hit-test and drag
|
||||
lifecycle as selection, so it does not depend on a DOM `dblclick` event that
|
||||
may be suppressed by dragging.
|
||||
|
||||
`diagram-group.js` adds the generic view-level `DiagramGroup` abstraction. A
|
||||
group contains nodes or nested groups, calculates a frame from their geometry,
|
||||
and can be expanded or collapsed. It deliberately knows nothing about CMaps,
|
||||
wiki pages or aspects. `DiagramEngine.setFilter` accepts an application policy
|
||||
for component visibility; the engine combines that policy with each component's
|
||||
own visibility and hides links whose endpoints are hidden. A wiki adapter can
|
||||
therefore translate submap membership or aspect matching into groups and
|
||||
filters without putting domain rules into the drawing engine. Proxy endpoints
|
||||
and boundary navigation remain application concerns until a generic endpoint
|
||||
projection API is introduced.
|
||||
|
||||
`model/concept-repository.js` owns shared concepts, semantic concept relations
|
||||
and concept ownership. `model/concept-map.js` owns one map's concept
|
||||
@@ -25,7 +45,7 @@ The repository objects keep only an in-memory session copy; the backend remains
|
||||
authoritative. None of these model modules contains DOM or drawing-engine
|
||||
objects, and CMap state is not persisted in browser storage.
|
||||
|
||||
`cmap-view.js` owns the canvas and the concrete `cmap.js` drawing instance.
|
||||
`cmap-view.js` owns the canvas and its concrete `DiagramEngine` instance.
|
||||
`view/appearance-editor.js` presents the appearance model in the concept dialog
|
||||
and coordinates explicit style and palette changes with its repository.
|
||||
The concrete dialog controllers live in `../js/wiki/cmap/dialogs/`. They own
|
||||
|
||||
Reference in New Issue
Block a user