fractionalIndex as a byproduct or zIndex

This commit is contained in:
Ryan Di 2023-11-29 17:35:59 +08:00
parent c7ee46e7f8
commit 02dc00a47e
7 changed files with 128 additions and 24 deletions

View file

@ -55,6 +55,7 @@ export type ElementConstructorOpts = MarkOptional<
| "angle"
| "groupIds"
| "frameId"
| "fractionalIndex"
| "boundElements"
| "seed"
| "version"
@ -88,6 +89,8 @@ const _newElementBase = <T extends ExcalidrawElement>(
angle = 0,
groupIds = [],
frameId = null,
// TODO: think about this more
fractionalIndex = Infinity,
roundness = null,
boundElements = null,
link = null,
@ -113,6 +116,7 @@ const _newElementBase = <T extends ExcalidrawElement>(
opacity,
groupIds,
frameId,
fractionalIndex,
roundness,
seed: rest.seed ?? randomInteger(),
version: rest.version || 1,