@mark1russell7/room-view 0.2.0 → 0.2.2

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
@@ -264,7 +264,27 @@ const marks = layerMarks(scene, addOns, addOnMarks);
264
264
  - A layer with a fault of its form gives no marks, and `checkLayers` tells the fault.
265
265
  - A mark is plain data in meters, with the z axis up. It has no shape and no color.
266
266
 
267
- `ANCHOR_CODES` and `LAYER_CODES` have the codes of the core. The design of the add-ons is in `docs/ADD-ONS.md` of the repository.
267
+ An add-on can give the form of its layer as data, a `LayerForm` value. It has the collections of the records and the fields of each record. A page makes its inputs from this data, so the page has no code of a topic:
268
+
269
+ ```ts
270
+ import { formLayer, formRecords } from "@mark1russell7/room-view";
271
+
272
+ // The layer of the records that a person typed, with the usual values of a home with feet and inches:
273
+ const layer = formLayer(form, records, { system: "imperial" });
274
+ // The records of a layer, for the inputs of a page:
275
+ const read = formRecords(form, layer);
276
+ ```
277
+
278
+ - A field is a text, a number in a fixed unit, or the `id` of a record or of a placed object.
279
+ - The record of a field is in the same layer.
280
+ - A collection with surfaces has records with an anchor. A collection with an owner has the records of a placed object or of a different record.
281
+ - `formLayer` is total. A record with a value that is not valid, or with no value of a necessary field, is not in the layer.
282
+ - A number with no value gets the usual value of its field for the system of units, `metric` or `imperial`.
283
+ - `formRecords` gives `more: true` when the layer has data that the form does not keep. Thus a page can tell that an edit loses data.
284
+ - `readFormRecord` gives the first field that stops a record, so a page can show the fault at its input.
285
+ - `checkForm` gives the faults of a form. An add-on examines its form with this function in a test.
286
+
287
+ `ANCHOR_CODES`, `LAYER_CODES` and `FORM_CODES` have the codes of the core. The design of the add-ons is in `docs/ADD-ONS.md` of the repository.
268
288
 
269
289
  ## The loads of the circuits
270
290
 
@@ -282,7 +302,7 @@ import { createRoomViewer, DARK_THEME } from "@mark1russell7/room-view/three";
282
302
 
283
303
  const viewer = createRoomViewer(container, {
284
304
  scene: SAMPLE_SCENE,
285
- onSelect: (pick) => console.log(pick?.kind, pick?.source),
305
+ onSelect: (pick, mark) => console.log(pick?.kind, pick?.source, mark?.label),
286
306
  });
287
307
 
288
308
  viewer?.setTheme(DARK_THEME);
@@ -293,10 +313,12 @@ viewer?.setView("top");
293
313
  - The viewer fills its container, so give the container a size.
294
314
  - 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
315
  - 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.
316
+ - A click selects the record of a solid or of a sign. `onSelect` gets the kind and the `id` of the record.
297
317
  - 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.
318
+ - The stage and the signs come from `@mark1russell7/visuals`. Thus each viewer on that package shows the same signs.
319
+ - 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.
320
+ - A sign behind a wall or a machine stays in the picture, and it is less clear.
321
+ - The pointer finds a sign before each solid, also behind a solid. `onHover` and `onSelect` get its mark as their second parameter.
300
322
  - `highlight` and `select` mark records from your page: the outlets of a circuit, or the row of a table.
301
323
  - A marked outlet or object shows a line from the outlet to each object that takes its power from it.
302
324
  - The option `loads` has the options of `circuitStates`, for example the part of the limit where the level `near` starts.
@@ -305,6 +327,31 @@ viewer?.setView("top");
305
327
 
306
328
  `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
329
 
330
+ ### The marks of the add-ons
331
+
332
+ The option `marks` gives the marks of a scene to the viewer. The viewer draws them in place of the signs of the outlets:
333
+
334
+ ```ts
335
+ import { layerMarks } from "@mark1russell7/room-view/marks";
336
+ import { createRoomViewer } from "@mark1russell7/room-view/three";
337
+
338
+ const marks = layerMarks(scene, addOns, addOnMarks);
339
+ const viewer = createRoomViewer(container, { scene, marks });
340
+
341
+ viewer?.highlight(["electrical/1:nook-2"]);
342
+ viewer?.showMarks((mark) => mark.kind === "outlet");
343
+ ```
344
+
345
+ - The marks are in the space of the scene: meters, with the z axis up.
346
+ - 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.
347
+ - The viewer draws no mark with a fault. `checkMarks` of `@mark1russell7/visuals/marks` tells each fault.
348
+ - `highlight` and `select` accept the record name of a mark, as `recordName` gives it.
349
+ - `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.
350
+ - `showMarks` shows only the marks that a test accepts, for example the marks of one kind.
351
+ - `setScene` takes the marks of the new scene as its second parameter.
352
+ - An empty list gives a picture with no sign.
353
+ - The fields `field` and `fieldOpacity` of a theme have the colors of a field mark.
354
+
308
355
  ## The plan
309
356
 
310
357
  `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.