EntityLayer class
Overlay-entity layer: TextEntity instances in source-image space.
The layer needs the source image only for its metrics — the
TextEntity.displayFontSize reference and exportSize — so it is
constructed with imageSize and holds no ui.Image.
- Mixed-in types
- Available extensions
Constructors
- EntityLayer({required Size imageSize})
-
A layer over a source image of
imageSize.
Properties
- activeAlign → TextAlign
-
The selected entity's alignment, or the pending one.
no setter
- activeColour → Color
-
The selected entity's colour, or the pending one.
no setter
- activeFontSize → double
-
The selected entity's font size, or the pending one.
no setter
- activeStyle → TextEntityStyle
-
The selected entity's attributes, or the pending ones the next insert
takes.
no setter
- disposed → bool
-
Whether dispose has already run.
no setterinherited
- editing ↔ String?
-
Id of the entity under keyboard edit. paintEntitiesOnly skips it, so
the live overlay is that string's only rendering.
getter/setter pair
- editingEntity → TextEntity?
-
The entity under keyboard edit.
no setter
-
entities
→ List<
TextEntity> -
The overlays, bottom to top.
final
- exportSize → Size
-
This layer's intrinsic export size — typically the source image's
natural dimensions.
no setteroverride
- hasAppliedEdits → bool
-
Whether the layer holds any entity.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether there is at least one active listener.
no setterinherited
- imageSize → Size
-
The source image's size in pixels.
final
- pendingAlign ↔ TextAlign
-
The alignment the next insert takes.
getter/setter pair
- pendingColour ↔ Color
-
The colour the next insert takes.
getter/setter pair
- pendingFontSize ↔ double
-
The font size the next insert takes.
getter/setter pair
- pendingStyle ↔ TextEntityStyle
-
The style the next insert takes.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selected → String?
-
Id of the entity hitTestSelection tests its chrome against.
no setter
- selectedEntity → TextEntity?
-
The selected entity.
no setter
Methods
-
add(
TextEntity entity) → void -
Adds
entityon top. -
addDispose(
VoidCallback callback) → void -
Registers a disposal
callback. Ignored if already disposed.inherited -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object notifies its listeners.
inherited
-
beginEdit(
String id) → void -
Open the keyboard editor on the existing entity
idand select it. cancelEdit restores the copy taken here. -
byId(
String? id) → TextEntity? -
The entity with
id; absent when none has it. -
cancelEdit(
) → void - Close the editor, restoring the copy beginEdit took or removing the entity insertAndEdit created.
-
cycleStyle(
) → void - Moves the selected entity, or the pending style, to the next style.
-
deselect(
) → void - Clears the selection.
-
dispose(
) → void -
Releases whatever this object holds. Calling it twice is an error.
inherited
-
disposeBy(
Dispose disposer) → void -
Available on Disposable, provided by the DisposableDisposerExtension extension
Adds this object's dispose to another Dispose collector. -
endEdit(
) → void - Close the editor keeping what was typed. An empty string removes the entity; anything else stays selected.
-
hitTest(
Offset sourcePoint) → TextEntity? -
The topmost entity whose rotated + scaled layout bounds contain
sourcePoint. -
hitTestSelection(
Offset sourcePoint, {required double cameraScale}) → EntitySelectionHit? -
The chrome region of the selected entity under
sourcePoint, or null when nothing is selected or the point misses. Outset and handle targets are screen points divided bycameraScale— the product of the viewer and host camera scales — so they cover a constant on-screen area at any zoom. -
insertAndEdit(
TextEntity entity) → void -
Add
entity, select it and open the keyboard editor on it. cancelEdit removes it again. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Notifies all registered listeners.
inherited
-
paintEntitiesOnly(
Canvas canvas, Size reference) → void -
Paint committed entities — glyphs and pills, no selection chrome — into
a canvas whose coordinates are source-image pixels of size
reference. Skips editing. -
paintExport(
Canvas canvas, Size size) → void -
Paint into the export canvas.
sizeis the editor-wide export size (max over all exporters), so layers must position themselves accordingly.override -
paintViewport(
Canvas canvas, Size size, {required Matrix4 camera}) → void -
Paints the layer into a viewport of
sizethroughcamera.override -
remove(
String id) → void -
Removes the entity with
id, with its selection and edit. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
restoreSnapshot(
) → void - Restore the layer to the last saveSnapshot. No-op if none saved.
-
saveSnapshot(
) → void - Capture current state for later restoreSnapshot. Entities are copied by value — they stay mutable while the tool is open.
-
select(
String id) → void -
Selects the entity with
id. -
setColour(
Color colour) → void - Sets the selected entity's colour, or the pending one.
-
setFontSize(
double fontSize) → void - Sets the selected entity's font size, or the pending one.
-
subscribe(
VoidCallback callback) → VoidCallback -
Available on Listenable, provided by the ListenableExtension extension
Addscallbackas listener and returns a function to remove it. -
toggleAlignment(
) → void - Moves the selected entity, or the pending alignment, left to centre to right and around.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
String id, void change(TextEntity entity)) → void -
Apply
changeto the entity withidand emit.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultAlign → const TextAlign
- The alignment a fresh layer's next insert takes.
- defaultColour → const Color
- The colour a fresh layer's next insert takes.
- defaultFontSize → const double
- The font size a fresh layer's next insert takes.
- defaultStyle → const TextEntityStyle
- The style a fresh layer's next insert takes.