@tissuumaps/render 0.1.0-beta.1 → 0.1.0-beta.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @tissuumaps/render
2
2
 
3
+ ## 0.1.0-beta.3
4
+
5
+ ### Minor Changes
6
+
7
+ - [#306](https://github.com/TissUUmaps/TissUUmaps/pull/306) [`2603f6f`](https://github.com/TissUUmaps/TissUUmaps/commit/2603f6f2c48748c07d2ead3413fc95f4c1745675) Thanks [@jwindhager](https://github.com/jwindhager)! - Points, shapes, labels and images are each drawn as soon as their own data is ready, so a slow or failing object no longer holds back the other objects of its kind ([#269](https://github.com/TissUUmaps/TissUUmaps/issues/269)). The WebGL renderers' `synchronize` takes an `onChange` callback, which is called whenever a rendered object has been added, updated or dropped, and no longer resolves to whether anything changed.
8
+
9
+ - [#290](https://github.com/TissUUmaps/TissUUmaps/pull/290) [`cd0c14e`](https://github.com/TissUUmaps/TissUUmaps/commit/cd0c14e27ccb02645ab37d1da4c829ff3e56e0c2) Thanks [@cavenel](https://github.com/cavenel)! - `OpenSeadragonContext` applies `osOptions.viewerOptions.showNavigator` live, without rebuilding the viewer.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#307](https://github.com/TissUUmaps/TissUUmaps/pull/307) [`16e181e`](https://github.com/TissUUmaps/TissUUmaps/commit/16e181efd919f11a54b259c7e96231b724e628dd) Thanks [@jwindhager](https://github.com/jwindhager)! - Documentation links point to the new TissUUmaps website at https://tissuumaps.github.io/: the app's Docs link, and the packages' READMEs and homepages.
14
+ - Updated dependencies [[`75433b7`](https://github.com/TissUUmaps/TissUUmaps/commit/75433b7dfe6f553f6c7020fe7088a6b38e099790), [`9fc85a9`](https://github.com/TissUUmaps/TissUUmaps/commit/9fc85a9148be339aa0e419620253f03aace7041a), [`16e181e`](https://github.com/TissUUmaps/TissUUmaps/commit/16e181efd919f11a54b259c7e96231b724e628dd)]:
15
+ - @tissuumaps/core@0.1.0-beta.3
16
+
17
+ ## 0.1.0-beta.2
18
+
19
+ ### Patch Changes
20
+
21
+ - [#295](https://github.com/TissUUmaps/TissUUmaps/pull/295) [`67b9236`](https://github.com/TissUUmaps/TissUUmaps/commit/67b92362506385171c41b0b9356a23c463303d29) Thanks [@jwindhager](https://github.com/jwindhager)! - Plain images can be opened from a URL or path ([#274](https://github.com/TissUUmaps/TissUUmaps/issues/274)): an image data source's `source` with a PNG, JPEG or WebP file extension, or a `data:image/` URL, is opened as a plain image, also from the workspace; any other `source` is handed to OpenSeadragon as a tile source descriptor, which cannot be opened from the workspace. The data source `type` becomes `image` (was `openseadragon`) and its `tileSourceConfig` field becomes `tileSource`, which takes the URL of a descriptor or an inline tile source configuration and takes precedence over `source`. Inline tile source configurations taken from a project no longer fail to open because OpenSeadragon writes into them. Projects using `openseadragon` data sources have to be updated.
22
+ - Updated dependencies [[`15a214a`](https://github.com/TissUUmaps/TissUUmaps/commit/15a214a7950a1e9aa605ca5445cc4273b826ca2d)]:
23
+ - @tissuumaps/core@0.1.0-beta.2
24
+
3
25
  ## 0.1.0-beta.1
4
26
 
5
27
  ### Minor Changes
package/README.md CHANGED
@@ -20,6 +20,6 @@ Content Security Policy, allow it with `img-src data:`.
20
20
 
21
21
  ## Documentation
22
22
 
23
- - [API reference](https://tissuumaps.github.io/TissUUmaps/docs/docs/api/@tissuumaps/render/)
24
- - [Rendering](https://tissuumaps.github.io/TissUUmaps/docs/docs/development/rendering/)
25
- - [Code architecture](https://tissuumaps.github.io/TissUUmaps/docs/docs/development/code-architecture/)
23
+ - [API reference](https://tissuumaps.github.io/docs/api/@tissuumaps/render/)
24
+ - [Rendering](https://tissuumaps.github.io/docs/development/rendering/)
25
+ - [Code architecture](https://tissuumaps.github.io/docs/development/code-architecture/)
package/dist/index.d.ts CHANGED
@@ -198,7 +198,8 @@ export declare class OpenSeadragonContext {
198
198
  * Applies viewer options to the OpenSeadragon viewer and all existing tiled images
199
199
  *
200
200
  * For each option key, performs a shallow merge (one level deep) of nested objects
201
- * on both the viewer instance and every tiled image in the world.
201
+ * on both the viewer instance and every tiled image in the world. `showNavigator`
202
+ * shows or hides the navigator, as OpenSeadragon reads it only on construction.
202
203
  *
203
204
  * @param viewerOptions - Options to apply
204
205
  */
@@ -844,18 +845,20 @@ declare abstract class OpenSeadragonRendererBase<TObject extends Image_2 | Label
844
845
  /**
845
846
  * Synchronizes the viewer's tiled images with the current model
846
847
  *
847
- * Loads all objects assigned to the layers of the model set by
848
- * {@link setModel}, removes the tiled images that are no longer needed, and
849
- * creates or updates the remaining ones. Resolves once the tiled images have
850
- * actually been added to the world, i.e. once the viewer reflects the model
851
- * state that was read. The model may be set again while the synchronization
852
- * runs; it reads the model once, so it sees one consistent state, while the
853
- * properties it applies to the tiled images come from the current model (see
848
+ * Starts loading the objects on the layers of the model (see
849
+ * {@link setModel}), and right away removes the tiled images that are no
850
+ * longer needed (see {@link _cleanRenderedObjects}). Each object is then
851
+ * synchronized as soon as it has loaded, without waiting for the others: its
852
+ * tiled images are updated, or created at its position in the world (see
853
+ * {@link _synchronizeRenderedObject}).
854
+ *
855
+ * Resolves once the tiled images of all objects are in the world. The model
856
+ * is read once, so the synchronization sees one consistent state, but the
857
+ * properties applied to the tiled images come from the current model (see
854
858
  * {@link _updateRenderedObject}).
855
859
  *
856
- * Objects whose tiled images cannot be created, e.g. because their data
857
- * provides no tile sources, are logged and skipped, just like objects whose
858
- * data failed to load (see {@link _loadObjects}). A synchronization that
860
+ * Objects whose data fails to load, or whose tiled images cannot be created
861
+ * (e.g. without tile sources), are logged and dropped. A synchronization that
859
862
  * fails or is aborted leaves the model unsynchronized (see
860
863
  * {@link needsSynchronization}).
861
864
  *
@@ -949,13 +952,12 @@ declare abstract class OpenSeadragonRendererBase<TObject extends Image_2 | Label
949
952
  /**
950
953
  * Retains what was resolved for the given objects, and discards the rest
951
954
  *
952
- * Called by {@link synchronize} once all objects have loaded and the rendered
953
- * objects of all others have been deleted, with the objects that are about
954
- * to be displayed: those assigned to a rendered layer whose data loaded
955
- * successfully. Does nothing here; subclasses that keep
956
- * state per object (see {@link resolveObject} and
955
+ * Called by {@link synchronize} with the objects about to be displayed, i.e.
956
+ * those assigned to a rendered layer, once the rendered objects of all others
957
+ * have been deleted and before any object has loaded. Does nothing here;
958
+ * subclasses that keep state per object (see {@link resolveObject} and
957
959
  * {@link resolveTiledImageDataTransfer}) override this to drop the state of
958
- * every object that is not among the given ones.
960
+ * all other objects.
959
961
  *
960
962
  * @param _objects - The objects (images or labels) about to be displayed
961
963
  */
@@ -963,15 +965,15 @@ declare abstract class OpenSeadragonRendererBase<TObject extends Image_2 | Label
963
965
  /**
964
966
  * Resolves what a renderer derives from an object, once its data has loaded
965
967
  *
966
- * Called by {@link _loadObjects} for every object on one of the given layers,
967
- * concurrently, right after
968
- * its data has loaded and before its tiled images are created or updated. An
969
- * object that cannot be resolved is logged, but kept: its tiled images are
970
- * still created or updated, with whatever the synchronous hooks return for
971
- * it. Does nothing here; subclasses override this to resolve, from the
972
- * object, its data and the inputs of the synchronization, whatever their
973
- * synchronous hooks return later (see {@link resolveTiledImageDataTransfer}),
974
- * and to keep it for as long as its outcome would not change.
968
+ * Called by {@link _loadObjects} for each object, concurrently, once its data
969
+ * has loaded and before its tiled images are created or updated. An object
970
+ * that cannot be resolved is logged, but kept: its tiled images are still
971
+ * created or updated, with whatever the synchronous hooks return for it.
972
+ *
973
+ * Does nothing here. Subclasses override this to resolve what their
974
+ * synchronous hooks return later (see {@link resolveTiledImageDataTransfer})
975
+ * from the object, its data and the inputs of the synchronization, and to
976
+ * keep it for as long as its outcome would not change.
975
977
  *
976
978
  * @param _object - The object (image or labels) to resolve
977
979
  * @param _data - The loaded data of the object
@@ -1050,88 +1052,113 @@ declare abstract class OpenSeadragonRendererBase<TObject extends Image_2 | Label
1050
1052
  */
1051
1053
  protected resolveTiledImageDataTransfer(_ref: ObjectRef<TObject, TObjectData>, _index: number | null): DataTransfer_2 | undefined;
1052
1054
  /**
1053
- * Concurrently loads and resolves all objects assigned to the layers of the current model
1055
+ * Starts loading and resolving all objects assigned to the layers of the current model
1054
1056
  *
1055
- * Each object's data is loaded with the context's `loadObject`, and the object
1056
- * is then resolved (see {@link resolveObject}). The returned references are
1057
- * ordered by layer and then by object, which determines the order of the
1058
- * corresponding tiled images in the world. Objects whose data failed to load
1059
- * are logged and skipped; objects that could not be resolved are logged, but
1060
- * kept. The model is read once, before the first `await`, so one
1061
- * synchronization sees one consistent model state, however often the model
1062
- * is set while it runs.
1057
+ * Loads each object's data with the context's `loadObject`, then resolves the
1058
+ * object (see {@link resolveObject}). Returns right away, with one loading
1059
+ * per object, in world order: by layer, then by object. A loading rejects if
1060
+ * the object's data fails to load, which is logged. An object that cannot be
1061
+ * resolved is logged, but kept.
1062
+ *
1063
+ * The model is read once, right away, so one synchronization sees one
1064
+ * consistent model state.
1063
1065
  *
1064
1066
  * @param context - The inputs of the current synchronization
1065
1067
  * @param options - Optional abort signal
1066
- * @returns A promise that resolves to one object reference per successfully loaded object
1068
+ * @returns One loading per object, whose promise resolves to the object's
1069
+ * reference
1067
1070
  * @throws Error if no model has been set (see {@link setModel})
1068
1071
  */
1069
1072
  private _loadObjects;
1070
1073
  /**
1071
- * Retains the rendered objects that can be reused for the new object references, and deletes the rest
1074
+ * Keeps the rendered objects that can be reused for a synchronization, and deletes the rest
1072
1075
  *
1073
1076
  * A rendered object is matched by the layer and object it references.
1074
- * Unmatched rendered objects are deleted first, so that removing an object
1075
- * does not shift the world indices of the objects behind it. A matched
1076
- * rendered object is reusable if the data source it was loaded for is that of
1077
- * the reference, and if its backdrop, if any, and all of its tiled images
1078
- * already sit at the consecutive world indices expected for its position
1079
- * among the references, counted from the anchor. A partially misplaced object
1080
- * is not reusable. The other matched rendered objects are deleted as well,
1081
- * and are expected to be recreated by the caller via
1082
- * {@link _createRenderedObject}, which is also how the world is reordered.
1083
- *
1084
- * The expected indices account for every matched rendered object, reusable or
1085
- * not, by the world footprint it currently has: a matched object that is
1086
- * recreated, e.g. because its data source changed, is deleted and inserted at
1087
- * the same position, with possibly different tiled images, so the objects
1088
- * behind it keep their indices relative to it and stay reusable. Only the
1089
- * backdrop and tiled images assigned to it count, i.e. none for an object
1090
- * whose tiled images could not be added, which is thereby retried without
1091
- * recreating the objects behind it. The tiled images that an earlier
1092
- * synchronization is still adding are waited for first, so that each
1093
- * rendered object is either fully in the world or not at all. This does not
1094
- * delay the additions of this synchronization, which are queued behind them
1095
- * anyway (see {@link OpenSeadragonContext.addTiledImage}).
1096
- *
1097
- * @param newRefs - The new object references, in the intended world order
1077
+ * Unmatched ones are deleted first, so that their removal does not shift the
1078
+ * world indices of the objects behind them. Only the layers and objects of
1079
+ * the loadings are needed, not their data, so this runs before any of them
1080
+ * has loaded.
1081
+ *
1082
+ * A matched rendered object is reusable if it was loaded for its object's
1083
+ * data source, and if its backdrop, if any, and all of its tiled images sit
1084
+ * at the consecutive world indices expected for its position among the
1085
+ * loadings, counted from the anchor. All other matched rendered objects are
1086
+ * deleted as well, for the caller to recreate them (see
1087
+ * {@link _createRenderedObject}), which is also how the world is reordered.
1088
+ *
1089
+ * The expected indices count every matched rendered object, reusable or not,
1090
+ * by its current footprint. A matched object that is recreated, e.g. because
1091
+ * its data source changed, is reinserted at the same position, so the objects
1092
+ * behind it stay reusable. An object whose tiled images could not be added
1093
+ * has been forgotten (see {@link _createRenderedObject}), so it is created
1094
+ * anew, without recreating the objects behind it.
1095
+ *
1096
+ * The tiled images that an earlier synchronization is still adding are waited
1097
+ * for first, so that each rendered object is either fully in the world or not
1098
+ * at all. This does not delay the additions of this synchronization, which
1099
+ * are queued behind them anyway (see
1100
+ * {@link OpenSeadragonContext.addTiledImage}).
1101
+ *
1102
+ * @param loadings - The loadings of the synchronization (see
1103
+ * {@link _loadObjects}), in world order
1098
1104
  * @param options - Optional abort signal
1099
- * @returns A map of new object references to their reusable rendered objects
1105
+ * @returns A map of loadings to their reusable rendered objects
1100
1106
  * @throws Error if the renderer has no anchor, i.e. it is not initialized or
1101
1107
  * already destroyed
1102
1108
  */
1103
1109
  private _cleanRenderedObjects;
1110
+ /**
1111
+ * Synchronizes the rendered object of one object, once it has loaded
1112
+ *
1113
+ * A reusable rendered object (see {@link _cleanRenderedObjects}) is updated
1114
+ * with the new reference, or deleted if the object failed to load. Otherwise,
1115
+ * a rendered object is created behind those of the preceding loadings,
1116
+ * whether these are in the world already or still being added. Preceding
1117
+ * objects that arrive later are inserted in front of it, as world mutations
1118
+ * run in request order (see {@link OpenSeadragonContext.addTiledImage}).
1119
+ *
1120
+ * @param precedingLoadings - The loadings that precede the object's in world
1121
+ * order (see {@link _loadObjects})
1122
+ * @param newRefPromise - The promise of the object's reference, from its
1123
+ * loading
1124
+ * @param renderedObject - The object's reusable rendered object, if any
1125
+ * @param options - Optional abort signal
1126
+ * @returns A promise that resolves once the object's tiled images have been
1127
+ * updated, or their creation has been requested
1128
+ */
1129
+ private _synchronizeRenderedObject;
1104
1130
  /**
1105
1131
  * Creates a new rendered object for the given object reference and adds one TiledImage per channel, preceded by a backdrop where required, to the world
1106
1132
  *
1107
- * The TiledImages are inserted at consecutive indices, starting `offset` places
1108
- * after the anchor, which establishes the world layout that
1109
- * {@link _cleanRenderedObjects} expects. `offset` therefore counts TiledImages,
1110
- * not objects, and callers have to advance it by
1111
- * {@link RenderedObject.tileSourceCount} plus the object's backdrop, if it has
1112
- * one. The indices are resolved once each addition is executed, as the anchor
1113
- * may have been replaced, and world indices may have shifted, while it was
1114
- * enqueued.
1115
- *
1116
- * The tile sources are opened here, rather than by the additions themselves,
1117
- * so that the backdrop can be sized like the object's content, which is only
1118
- * known once one of them has been opened. The additions are all requested
1119
- * before this function returns, and in world order, so that the TiledImages of
1120
- * the object that the caller creates next end up behind them.
1121
- *
1122
- * Returns before the TiledImages exist: they are added asynchronously and only
1123
- * then assigned to the rendered object, transformed, and included in the anchor
1124
- * bounds, which is when {@link RenderedObject.tiledImagesPromise} resolves. The
1125
- * backdrop and TiledImages are removed again immediately after they were added
1126
- * if the rendered object is deleted or the operation is aborted in the
1127
- * meantime, or if any of them could not be added at all - a partially added
1128
- * object would shift the world indices of every object after it. For the same
1129
- * reason, a tile source that fails to open is replaced by a transparent
1130
- * placeholder rather than skipped: the indices of the objects created after
1131
- * this one are resolved against the full footprint of this one, so it has to
1132
- * take up all of its indices until it is removed again. If the context
1133
- * is destroyed, nothing is done at all, as the viewer tears down its world
1134
- * itself.
1133
+ * The TiledImages are inserted at consecutive indices, starting `offset`
1134
+ * places after the anchor, which is the world layout that
1135
+ * {@link _cleanRenderedObjects} expects. `offset` thus counts TiledImages,
1136
+ * not objects: the backdrops and TiledImages of the preceding rendered
1137
+ * objects, including those still being added. The indices are resolved when
1138
+ * each addition is executed, as the anchor may have been replaced, and world
1139
+ * indices may have shifted, in the meantime.
1140
+ *
1141
+ * The tile sources are opened here, rather than by the additions, so that the
1142
+ * backdrop can be sized like the object's content, which is only known once
1143
+ * one of them has opened. All additions are requested before this function
1144
+ * returns, in world order, so that the TiledImages of the object created next
1145
+ * end up behind them.
1146
+ *
1147
+ * Returns before the TiledImages exist: they are added asynchronously, and
1148
+ * only then assigned to the rendered object, transformed and included in the
1149
+ * anchor bounds, which is when {@link RenderedObject.tiledImagesPromise}
1150
+ * resolves.
1151
+ *
1152
+ * If the rendered object is deleted or the operation is aborted in the
1153
+ * meantime, or if any TiledImage could not be added, the added backdrop and
1154
+ * TiledImages are removed again right away: a partially added object would
1155
+ * shift the world indices of every object behind it. For the same reason, a
1156
+ * tile source that fails to open is replaced by a transparent placeholder
1157
+ * rather than skipped, as the objects created after this one are placed
1158
+ * against its full footprint. The rendered object is dropped from
1159
+ * {@link _renderedObjects} as its removals are queued, so that objects
1160
+ * created from then on are placed without it. If the context is destroyed,
1161
+ * nothing is done at all, as the viewer tears down its world itself.
1135
1162
  *
1136
1163
  * @param offset - The number of TiledImages between the anchor and the object's first new TiledImage
1137
1164
  * @param newRef - The object reference for which to create a rendered object
@@ -1307,9 +1334,8 @@ declare type PreparedShapes = {
1307
1334
  * Extended by the renderers with the GPU resources they own, and with a
1308
1335
  * snapshot of the object properties those were built from, which their change
1309
1336
  * detection compares against. Rendered objects are mutated in place across
1310
- * synchronizations:
1311
- * {@link WebGLRendererBase.matchOrDestroyRenderedObjects} replaces the
1312
- * reference of a matched object, and the renderers replace the bounds, the
1337
+ * synchronizations: {@link WebGLRendererBase.synchronize} replaces the
1338
+ * reference of a reused object, and the renderers replace the bounds, the
1313
1339
  * snapshot and the GPU resources of an object as they are rebuilt.
1314
1340
  */
1315
1341
  declare type RenderedObjectBase<TObject extends Points | Shapes, TObjectData extends PointsData | ShapesData> = {
@@ -1958,7 +1984,6 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
1958
1984
  viewport: Rect;
1959
1985
  private _model?;
1960
1986
  private _lastSyncState?;
1961
- private _hasUnreportedChanges;
1962
1987
  private readonly _renderedObjects;
1963
1988
  private readonly _layerItemsInfosCache;
1964
1989
  /**
@@ -2021,34 +2046,38 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
2021
2046
  /**
2022
2047
  * Synchronizes the rendered objects with the current model and render options
2023
2048
  *
2024
- * Loads the objects of the model (see {@link loadObjects}), drops the
2025
- * rendered objects that no longer match one (see
2026
- * {@link matchOrDestroyRenderedObjects}), and then creates or updates the
2027
- * rest in two passes. The first prepares every object (see
2028
- * {@link prepareRenderedObject}), issuing all requests before the first
2029
- * `await`: requests are shared with, and cancelled once abandoned by, a
2030
- * superseded synchronization, unless they are reclaimed within the same
2031
- * task. The second awaits the preparations in order and uploads each of them
2032
- * in one synchronous block (see {@link createRenderedObject} and
2033
- * {@link updateRenderedObject}), so a draw never sees a half-updated object.
2034
- *
2035
- * An object whose preparation fails, or finds nothing to render, is logged
2036
- * and dropped. A synchronization that fails or is aborted leaves the model
2037
- * unsynchronized (see {@link _discardSyncState}), and the changes it made
2038
- * before it stopped are reported by the next one that completes.
2049
+ * Starts loading the objects of the model (see {@link loadObjects}), and
2050
+ * right away drops the rendered objects that none of them addresses. Each
2051
+ * object is then synchronized on its own, as soon as its data has loaded: the
2052
+ * object is prepared (see {@link prepareRenderedObject}), and the preparation
2053
+ * is uploaded in one synchronous block, either into the reused rendered
2054
+ * object or into one that replaces it (see {@link createRenderedObject} and
2055
+ * {@link updateRenderedObject}). A draw thus never sees a half-updated
2056
+ * object, and a slow or failing object never holds back the others.
2057
+ *
2058
+ * An object issues its requests right after its data has loaded, without
2059
+ * awaiting in between. Requests are shared with a superseded synchronization,
2060
+ * and cancelled once it abandons them, unless they are reclaimed within the
2061
+ * same task. Data that has already loaded allows that.
2062
+ *
2063
+ * An object whose data or preparation fails, or that has nothing to render,
2064
+ * is logged and dropped. A synchronization that fails or is aborted leaves
2065
+ * the model unsynchronized (see {@link _discardSyncState}).
2039
2066
  *
2040
2067
  * @param syncContext - The inputs to synchronize with: the tables and
2041
- * group-to-value maps that the objects resolve their properties from, and
2042
- * the loaders for object and table data. It carries inputs only; what an
2043
- * object was resolved from is captured per object (see {@link ObjectRef})
2044
- * @param options - Optional abort signal
2045
- * @returns A promise that resolves to whether any rendered object changed
2046
- * since the last completed synchronization
2068
+ * group-to-value maps that the objects resolve their properties from, and the
2069
+ * loaders for object and table data. It carries inputs only; what an object
2070
+ * was resolved from is captured per object (see {@link ObjectRef})
2071
+ * @param options - Optional abort signal, and a callback that is called
2072
+ * synchronously whenever a rendered object is added, updated or dropped, so
2073
+ * that the caller can draw each object as soon as it is ready
2074
+ * @returns A promise that resolves once all objects have been synchronized
2047
2075
  * @throws Error if no model has been set (see {@link setModel})
2048
2076
  */
2049
2077
  synchronize(syncContext: TSyncContext, options?: {
2050
2078
  signal?: AbortSignal;
2051
- }): Promise<boolean>;
2079
+ onChange?: () => void;
2080
+ }): Promise<void>;
2052
2081
  /**
2053
2082
  * Returns the state of the current model and render options that a
2054
2083
  * synchronization depends on
@@ -2103,48 +2132,36 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
2103
2132
  */
2104
2133
  protected getRenderOptionsSyncState(): object | undefined;
2105
2134
  /**
2106
- * Concurrently loads the data of all objects to be rendered on the layers of the current model
2135
+ * Starts loading the data of all objects to be rendered on the layers of the current model
2107
2136
  *
2108
- * An object assigned to a layer by layer ID is loaded for that layer only, an
2137
+ * An object assigned to a layer by layer ID is loaded for that layer only. An
2109
2138
  * object assigned per item by a table column is loaded for every layer, with
2110
2139
  * the items on each layer resolved from the table (see
2111
2140
  * {@link _getLayerItemsInfos}). The data of an object, and of a table, is
2112
- * loaded once, no matter how many references it is shared by.
2141
+ * loaded once, however many references share it.
2113
2142
  *
2114
- * The returned references are ordered by layer and then by object. Objects
2115
- * whose data or table failed to load are logged and skipped, and so are
2116
- * objects whose items are assigned per item without a table to resolve the
2117
- * assignment from. Objects without items on a layer are skipped silently,
2118
- * which also covers empty objects and objects whose table is empty - those
2119
- * are legitimate states, not failures.
2143
+ * Returns right away, with one loading per object and layer, ordered by layer
2144
+ * and then by object. Each loading settles on its own. It rejects if the
2145
+ * object's data or table fails to load, which is logged. It resolves to
2146
+ * `null` if the object has no items on the layer, which is not logged: empty
2147
+ * objects and empty tables are legitimate states, not failures. An object
2148
+ * whose items are assigned per item, but that has no table to resolve the
2149
+ * assignment from, is logged and gets no loading.
2120
2150
  *
2121
2151
  * @param syncContext - The inputs of the current synchronization: the tables
2122
- * that the objects resolve their item layers from, and the loaders for
2123
- * object and table data
2152
+ * that the objects resolve their item layers from, and the loaders for object
2153
+ * and table data
2124
2154
  * @param options - Optional abort signal
2125
- * @returns A promise that resolves to one reference per loaded object and layer
2155
+ * @returns One loading per object and layer, whose promise resolves to the
2156
+ * object's reference, or to `null` if the object has no items on the layer
2126
2157
  * @throws Error if no model has been set (see {@link setModel})
2127
2158
  */
2128
2159
  protected loadObjects(syncContext: TSyncContext, options?: {
2129
2160
  signal?: AbortSignal;
2130
- }): Promise<ObjectRef_2<TObject, TObjectData>[]>;
2131
- /**
2132
- * Matches the rendered objects to a new set of references, and destroys the
2133
- * ones left over
2134
- *
2135
- * A rendered object is matched by the layer and object it is kept under, and
2136
- * kept if its contributed items and data source are those of the reference,
2137
- * which it then adopts and is returned for reuse with. Every other rendered
2138
- * object - one that no reference addresses, or one whose items or data source
2139
- * changed - is destroyed and dropped.
2140
- *
2141
- * @param newRefs - The object references to match against
2142
- * @returns One match per reference, in the order of the references, each with
2143
- * the rendered object to reuse for it, or `undefined` if it has none yet
2144
- */
2145
- protected matchOrDestroyRenderedObjects(newRefs: ObjectRef_2<TObject, TObjectData>[]): {
2146
- newRef: ObjectRef_2<TObject, TObjectData>;
2147
- renderedObject: TRenderedObject | undefined;
2161
+ }): {
2162
+ layerId: string;
2163
+ object: TObject;
2164
+ newRefPromise: Promise<ObjectRef_2<TObject, TObjectData> | null>;
2148
2165
  }[];
2149
2166
  /**
2150
2167
  * Adds a newly created rendered object under its layer and object
@@ -2165,14 +2182,14 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
2165
2182
  /**
2166
2183
  * Prepares everything that has to be uploaded for an object
2167
2184
  *
2168
- * Runs in the first pass of {@link synchronize}, which calls it synchronously
2169
- * for every object of a synchronization, one after the other: every request
2170
- * has to be issued before the first `await`. Decides, from the object's
2171
- * current rendered state, which of its GPU resources have to be rebuilt, and
2172
- * resolves only those.
2185
+ * Called by {@link synchronize} as soon as the object's data has loaded.
2186
+ * Every request has to be issued before the first `await` (see
2187
+ * {@link synchronize}). Decides, from the object's current rendered state,
2188
+ * which of its GPU resources have to be rebuilt, and resolves only those.
2173
2189
  *
2174
2190
  * @param newRef - The object to prepare
2175
- * @param renderedObject - The object's current rendered state, if it is reused
2191
+ * @param renderedObject - The object's current rendered state, if it is
2192
+ * reused
2176
2193
  * @param syncContext - The inputs of the current synchronization
2177
2194
  * @param options - Optional abort signal
2178
2195
  * @returns What {@link createRenderedObject} or {@link updateRenderedObject}
@@ -2185,7 +2202,8 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
2185
2202
  /**
2186
2203
  * Creates the rendered object, with its GPU resources, of a newly prepared object
2187
2204
  *
2188
- * Runs in the second pass of {@link synchronize}, synchronously.
2205
+ * Called synchronously by {@link synchronize} once the object has been
2206
+ * prepared.
2189
2207
  *
2190
2208
  * @param newRef - The object
2191
2209
  * @param prepared - Its preparation, made without a rendered object to reuse
@@ -2195,7 +2213,8 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
2195
2213
  /**
2196
2214
  * Updates the GPU resources of a rendered object from its preparation
2197
2215
  *
2198
- * Runs in the second pass of {@link synchronize}, synchronously.
2216
+ * Called synchronously by {@link synchronize} once the object has been
2217
+ * prepared.
2199
2218
  *
2200
2219
  * @param renderedObject - The rendered object to update in place
2201
2220
  * @param prepared - Its preparation, made with it as the rendered object to reuse
@@ -2293,18 +2312,39 @@ declare abstract class WebGLRendererBase<TObject extends Points | Shapes, TObjec
2293
2312
  */
2294
2313
  private _getLayerItemsInfos;
2295
2314
  /**
2296
- * Awaits the preparation of an object, dropping the object if it fails or
2297
- * finds nothing to render
2315
+ * Drops the rendered objects that none of the given loadings addresses
2298
2316
  *
2299
- * @param newRef - The prepared object
2300
- * @param renderedObject - The object's current rendered state, if any, which
2301
- * is removed if the object is dropped
2302
- * @param preparedPromise - The preparation, see {@link prepareRenderedObject}
2303
- * @param options - Optional abort signal
2304
- * @returns The preparation, or `undefined` if the object was dropped (which
2305
- * is logged)
2317
+ * Their layer or object has left the model, or the object has moved to
2318
+ * another layer, so they are no longer drawn (see {@link getRenderPasses}).
2319
+ * They are dropped right away, rather than once the remaining objects have
2320
+ * loaded. Whether the others can be reused is decided per object, once its
2321
+ * data has loaded (see {@link _synchronizeRenderedObject}).
2322
+ *
2323
+ * @param loadings - The loadings of the current synchronization (see
2324
+ * {@link loadObjects})
2325
+ * @returns Whether any rendered object was dropped
2326
+ */
2327
+ private _cleanRenderedObjects;
2328
+ /**
2329
+ * Synchronizes the rendered object of one object and layer, once its data has loaded
2330
+ *
2331
+ * The rendered object kept under the layer and object is reused if its items
2332
+ * and data source match the new reference, which it then adopts. The object
2333
+ * is then prepared and uploaded (see {@link synchronize}). A rendered object
2334
+ * that is not reused stays drawn until its replacement is uploaded, and is
2335
+ * then dropped in the same synchronous block. If the object's data failed to
2336
+ * load, or it has no items on the layer, it is only dropped. So is it if its
2337
+ * preparation fails or finds nothing to render, which is logged.
2338
+ *
2339
+ * @param layerId - The ID of the layer
2340
+ * @param objectId - The ID of the object
2341
+ * @param newRefPromise - The object's loading (see {@link loadObjects})
2342
+ * @param syncContext - The inputs of the current synchronization
2343
+ * @param options - Optional abort signal, and the callback to call whenever
2344
+ * the rendered object is added, updated or dropped
2345
+ * @returns A promise that resolves once the object has been synchronized
2306
2346
  */
2307
- private _settleRenderedObjectPreparation;
2347
+ private _synchronizeRenderedObject;
2308
2348
  /**
2309
2349
  * Creates the loader for the tables that an object resolves its properties
2310
2350
  * from