@mocanvas/editor · class
declare class ReadonlySharedStyleMapWhat the current selection has in common, style by style — the read-only half.
Editor.getSharedStyles() hands one of these back. It is read-only because
the answer is *derived*: writing to it would not change any shape, and a
caller that thought it had would be silently wrong. To change a style, call
setStyleForSelectedShapes.
A prop is absent when no selected shape has it, { type: "shared" } when
every shape agrees, and { type: "mixed" } when they do not — which is the
three-way answer a style panel needs in order to render a value, a blank, or
nothing at all.
Methods · 9
constructor(entries?: Iterable<[StyleProp<unknown>, SharedStyle<unknown>]>)entries(): IterableIterator<[StyleProp<unknown>, SharedStyle<unknown>]>equals(other: ReadonlySharedStyleMap): booleanWhether two maps say the same thing.
By value, not by identity: the map is rebuilt on every selection change, and a style panel that re-rendered whenever a *new* map arrived would re-render on every pointer move during a drag.
get<T>(prop: StyleProp<T>): SharedStyle<T> | undefinedgetAsKnownValue<T>(prop: StyleProp<T>): T | undefinedThe agreed value, or undefined when the selection is mixed or has none.
has(prop: StyleProp<unknown>): booleankeys(): IterableIterator<StyleProp<unknown>>get size(): numberHow many style props the selection has an answer for.
values(): IterableIterator<SharedStyle<unknown>>Properties · 1
protected readonly map: Map<StyleProp<unknown>, SharedStyle<unknown>>mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.