@fabwcie/free-drawing / components/toolbar/widgets/Note
components/toolbar/widgets/Note
Classes
NoteWidget
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:19
Note tool: a click adds a sticky note there (a square of a light color, its own, yellow by default) and writes in it at once; a click on a note writes in it. Validated, the selection tool comes back with the note selected (unless the tool is kept)
Extends
Constructors
Constructor
new NoteWidget(
drawer):NoteWidget
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:31
Create the note tool, shortcut N, with its overlay of colors
Parameters
drawer
Drawer of this widget
Returns
Overrides
Properties
$button
$button:
HTMLButtonElement
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:29
Button activating the widget, pressed while it is active, named by the title of the tool
Inherited from
$container
protectedreadonly$container:HTMLElement
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:21
Container of the button in toolbar (or menu of its group), with a class from widget id
Inherited from
actionOnly
readonlyactionOnly:boolean=false
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:27
Button runs an action (setActive(true)), the widget never becomes the active tool (e.g. image tool)
Inherited from
color
color:
ColorLike
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:22
Color of new notes, see noteColors
cursor
protectedcursor:string='crosshair'
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:25
Stage cursor while widget is active
Overrides
drawer
protecteddrawer:Drawer
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:61
Drawer of this widget
Inherited from
id
id:
AvailableTools
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:31
Id of the tool, key of the widget in toolbar (drawer.getWidget(id)) and namespace of its stage events
Inherited from
inAction
inAction:
boolean=false
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:39
Pointer action in progress (drawing, erasing, selecting...), see startAction / endAction
Inherited from
options
readonlyoptions:WidgetOptions
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:37
Widget options given with drawer widgets option
Inherited from
overlay
overlay:
NoteOverlay
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:20
Options of the tool (color, width...), shown while widget is active (see showOverlayOnActive)
Overrides
shortcut
shortcut:
string|undefined
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:33
Key activating the tool, lower case (shortcut widget option, else default of the widget), none if undefined
Inherited from
showOverlayOnActive
protectedshowOverlayOnActive:boolean=true
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:47
Show overlay while widget is active (false when overlay depends on something else, e.g. selection)
Inherited from
BaseWidget.showOverlayOnActive
Accessors
isDisabled
Get Signature
get isDisabled():
boolean
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:138
Widget can not be activated (see setDisabled)
Returns
boolean
Inherited from
Methods
_noteAt()
private_noteAt(target):Rect|null
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:107
Note clicked: the note or its text
Parameters
target
Node
Node under the pointer
Returns
Rect | null
Note, null when the click is elsewhere
_textWidget()
private_textWidget():TextWidget|undefined
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:98
Text tool, which edits texts of shapes
Returns
TextWidget | undefined
Text widget, undefined when the toolbar has none
_write()
private_write(note):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:118
Write in a note; once validated: tool kept (keepTool) with its options panel, else selection tool back with the note selected
Parameters
note
Rect
Note to write in
Returns
void
addNote()
addNote(
center?):Rect
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:85
New note centered on a point of the drawing, in the frame containing it
Parameters
center?
Vector2d = ...
Center of the note, in drawing coordinates (pointer by default)
Returns
Rect
The added note (a rectangle named rect and note)
addTo()
addTo(
parent):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:96
Internal
Adds the button of this widget (icon, shortcut letter) in its container, at the end of parent
Parameters
parent
HTMLElement
Element receiving the button container: toolbar root or menu of a group
Returns
void
Inherited from
afterDraw()
protectedafterDraw():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:320
Shape drawn with this tool: selection tool activated, nothing selected, unless tool is kept (keepTool preference)
Returns
void
Inherited from
cancelAction()
cancelAction():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:241
Pointer action cancelled (two finger gesture of the drawer: zoom and move of the view): its result is discarded (onCancel: shape being drawn removed...), then it ends without change
Returns
void
Inherited from
clearSelection()
clearSelection():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:313
Unselect shapes, with selection widget (implemented by it)
Returns
void
Inherited from
endAction()
protectedendAction():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:254
Pointer action ends (pointer up)
Returns
void
Inherited from
initEvents()
protectedinitEvents():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:43
Click on a note writes in it, elsewhere adds a note and writes in it (not right or middle button, nor the click whose press validated a text)
Returns
void
Overrides
onActive()
protectedonActive():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:67
Tool activated: no press ended an edit with it yet
Returns
void
Overrides
onCancel()?
protectedoptionalonCancel():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:249
Result of the pointer action discarded before it is cancelled (see cancelAction), also called without action
Returns
void
Inherited from
onConstrainChange()?
protectedoptionalonConstrainChange(constrain):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:218
Shift pressed or released during a pointer action (square, circle, straight line...), without pointer move
Parameters
constrain
boolean
Shift pressed
Returns
void
Inherited from
onDesactive()
protectedonDesactive():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/Note/Note.ts:76
Tool changed: no click to skip
Returns
void
Overrides
onStage()
protectedonStage(events,handler):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:150
Listen stage events while widget is active. Events are namespaced with widget id, so they are removed on deactivation without removing other listeners. One pointer at a time: during a pointer action, another press (second finger, other button) is ignored, and a touch action ends when its finger is lifted, where it is lifted. Touches of a two finger gesture are ignored.
Parameters
events
string
Space separated event names
handler
KonvaEventListener<Stage, any>
Konva listener called with the stage event
Returns
void
Inherited from
removeEvents()
protectedremoveEvents():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:192
Remove widget events, called on deactivation
Returns
void
Inherited from
setActive()
setActive(
active):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:353
Activate widget (nothing if disabled): previous widget deactivated, button pressed, then initEvents, updateCursor, overlay shown (if showOverlayOnActive), onActive and drawer focused. Deactivate it: pointer action ended, removeEvents, overlay hidden, onDesactive, button released.
Parameters
active
boolean
Activate (true) or deactivate (false) widget
Returns
void
Inherited from
setDisabled()
setDisabled(
disabled):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:123
Disable or enable widget: a disabled widget can not be activated and its button is disabled (also its group when all its widgets are). Drawing tools are disabled in read only.
Parameters
disabled
boolean
Disable widget
Returns
void
Inherited from
shareLive()
protectedshareLive(...shapes):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:306
Shapes being drawn shown to collaborators while drawing (final state is sent on change)
Parameters
shapes
...DrawingShape[]
Shapes in their current state, sent as a live change of the collaboration session
Returns
void
Inherited from
showToolOverlay()
showToolOverlay():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:210
Overlay shown again (selection cleared), only for a tool showing it while active (not the frame tool, sharing the overlay of shape tools: it would stay shown once the tool is changed)
Returns
void
Inherited from
startAction()
protectedstartAction():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:231
Pointer action starts (pointer down): shortcuts are disabled and UI (toolbar, overlays...) ignores pointer, pointer followed out of the canvas until it is released
Returns
void
Inherited from
toggleDisable()
toggleDisable():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:114
Disable / enable widget, a disabled widget can not be activated
Returns
void
Inherited from
updateCursor()
updateCursor():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/BaseWidget.ts:223
Set stage cursor to the cursor of widget: on activation, and to restore it after a temporary one (pan grabbing)
Returns
void