@mark1russell7/room-view 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -282,7 +282,7 @@ import { createRoomViewer, DARK_THEME } from "@mark1russell7/room-view/three";
282
282
 
283
283
  const viewer = createRoomViewer(container, {
284
284
  scene: SAMPLE_SCENE,
285
- onSelect: (pick) => console.log(pick?.kind, pick?.source),
285
+ onSelect: (pick, mark) => console.log(pick?.kind, pick?.source, mark?.label),
286
286
  });
287
287
 
288
288
  viewer?.setTheme(DARK_THEME);
@@ -293,10 +293,12 @@ viewer?.setView("top");
293
293
  - The viewer fills its container, so give the container a size.
294
294
  - A drag turns the model. The wheel changes the distance only after a click in the picture, so the picture does not stop a page that scrolls.
295
295
  - The walls between the camera and the room become almost clear.
296
- - A click selects the record of a solid. `onSelect` gets the kind and the `id` of the record.
296
+ - A click selects the record of a solid or of a sign. `onSelect` gets the kind and the `id` of the record.
297
297
  - With the keyboard, the arrow keys turn the model, and `+` and `-` change the distance. `Home` shows the first view, and `T` shows the plan.
298
- - Each outlet has a marker with the color and the shape of the level of its circuit. A marker keeps its size in the picture.
299
- - A marker behind a wall or a machine stays in the picture, and it is less clear.
298
+ - The stage and the signs come from `@mark1russell7/visuals`. Thus each viewer on that package shows the same signs.
299
+ - Each outlet has a sign with the color and the shape of the level of its circuit. A sign keeps its size in the picture.
300
+ - A sign behind a wall or a machine stays in the picture, and it is less clear.
301
+ - The pointer finds a sign before each solid, also behind a solid. `onHover` and `onSelect` get its mark as their second parameter.
300
302
  - `highlight` and `select` mark records from your page: the outlets of a circuit, or the row of a table.
301
303
  - A marked outlet or object shows a line from the outlet to each object that takes its power from it.
302
304
  - The option `loads` has the options of `circuitStates`, for example the part of the limit where the level `near` starts.
@@ -305,6 +307,31 @@ viewer?.setView("top");
305
307
 
306
308
  `LIGHT_THEME` and `DARK_THEME` are the colors, and a theme is plain data. The field `levels` of a theme has the color of each level. `solidGeometry` gives the three.js geometry of one solid, for your own three.js scene.
307
309
 
310
+ ### The marks of the add-ons
311
+
312
+ The option `marks` gives the marks of a scene to the viewer. The viewer draws them in place of the signs of the outlets:
313
+
314
+ ```ts
315
+ import { layerMarks } from "@mark1russell7/room-view/marks";
316
+ import { createRoomViewer } from "@mark1russell7/room-view/three";
317
+
318
+ const marks = layerMarks(scene, addOns, addOnMarks);
319
+ const viewer = createRoomViewer(container, { scene, marks });
320
+
321
+ viewer?.highlight(["electrical/1:nook-2"]);
322
+ viewer?.showMarks((mark) => mark.kind === "outlet");
323
+ ```
324
+
325
+ - The marks are in the space of the scene: meters, with the z axis up.
326
+ - A point is a sign, a run is a round line, a link is a dashed line and a field is a grid of colors. A meter has no picture.
327
+ - The viewer draws no mark with a fault. `checkMarks` of `@mark1russell7/visuals/marks` tells each fault.
328
+ - `highlight` and `select` accept the record name of a mark, as `recordName` gives it.
329
+ - `solidRecord` of the root entry gives the record name of a solid. Thus a finding, a mark and a solid of one record have one name.
330
+ - `showMarks` shows only the marks that a test accepts, for example the marks of one kind.
331
+ - `setScene` takes the marks of the new scene as its second parameter.
332
+ - An empty list gives a picture with no sign.
333
+ - The fields `field` and `fieldOpacity` of a theme have the colors of a field mark.
334
+
308
335
  ## The plan
309
336
 
310
337
  `planShapes` gives the outline of each solid, as a camera above the room sees it. The list goes from the lowest top to the highest top, so a drawing in this sequence is correct.