xpict 0.3.3 → 0.3.4
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.
|
@@ -5,9 +5,14 @@ export type EachOptions<Data> = {
|
|
|
5
5
|
index: number;
|
|
6
6
|
};
|
|
7
7
|
export type EachFunction<Data, Item> = (options: EachOptions<Data>) => Item[];
|
|
8
|
+
export type LayerFunctionOptions = {
|
|
9
|
+
index: number;
|
|
10
|
+
length: number;
|
|
11
|
+
};
|
|
12
|
+
export type LayerFunction<Data, Item> = (item: Item, options: LayerFunctionOptions) => Layer<Data>;
|
|
8
13
|
export type RepeatLayerOptions<Data, Item> = {
|
|
9
14
|
each: EachFunction<Data, Item>;
|
|
10
|
-
layer:
|
|
15
|
+
layer: LayerFunction<Data, Item>;
|
|
11
16
|
when?: WhenFunction<Data>;
|
|
12
17
|
x: Axis<Data>;
|
|
13
18
|
y: Axis<Data>;
|
|
@@ -31,7 +31,7 @@ class RepeatLayer extends layer_1.Layer {
|
|
|
31
31
|
const prevY = ctx.offsetY;
|
|
32
32
|
ctx.offsetX += dx;
|
|
33
33
|
ctx.offsetY += dy;
|
|
34
|
-
const layer = this.options.layer(item, index);
|
|
34
|
+
const layer = this.options.layer(item, { index: index, length: items.length });
|
|
35
35
|
await layer.render({
|
|
36
36
|
context: ctx,
|
|
37
37
|
data: data,
|
package/package.json
CHANGED