Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PatWie/drafft-ink
/ functions
Functions
1,090 in github.com/PatWie/drafft-ink
⨍
Functions
1,090
◇
Types & classes
146
↓ 5 callers
Method
handle_drag
Handle a move event while dragging. `grid_snap_enabled` controls whether points should snap to grid. `smart_snap_enabled` enables smart guide alignmen
crates/drafftink-app/src/event_handler.rs:862
↓ 5 callers
Function
hit_test_handles
Find which handle (if any) is hit at the given point. Returns the handle kind if hit.
crates/drafftink-core/src/selection.rs:217
↓ 5 callers
Function
keyword
If `line` begins with `word` followed by whitespace, return the remainder.
crates/drafftink-core/src/mermaid/sequence.rs:163
↓ 5 callers
Method
load
Load a document by ID.
crates/drafftink-core/src/storage/autosave.rs:119
↓ 5 callers
Method
next
Cycle to the next grid style.
crates/drafftink-render/src/renderer.rs:43
↓ 5 callers
Method
regenerate_id
Regenerate the shape's ID with a new unique identifier. This is used when duplicating or pasting shapes to ensure they have unique IDs.
crates/drafftink-core/src/shapes/mod.rs:479
↓ 5 callers
Function
render_scene_to_png
( device: &vello::wgpu::Device, queue: &vello::wgpu::Queue, vello_renderer: &mut vello::Renderer,
crates/drafftink-app/src/app.rs:1131
↓ 5 callers
Method
save
(&self, id: &str, document: &CanvasDocument)
crates/drafftink-core/src/storage/file.rs:65
↓ 5 callers
Method
save
(&self, id: &str, document: &CanvasDocument)
crates/drafftink-core/src/storage/memory.rs:22
↓ 5 callers
Method
set_state
Set the state of a shape.
crates/drafftink-core/src/widget/manager.rs:42
↓ 5 callers
Method
shapes_ordered
Get shapes in z-order (back to front).
crates/drafftink-core/src/canvas.rs:162
↓ 5 callers
Function
skip_ws
Skip whitespace starting at `start`, returning the next non-space index.
crates/drafftink-core/src/mermaid/flowchart.rs:353
↓ 5 callers
Function
spawn_png_export_async
( device: &vello::wgpu::Device, queue: &vello::wgpu::Queue, scene: Scene, width: u32, heig
crates/drafftink-app/src/app.rs:1254
↓ 5 callers
Method
z_order
Get the z-order as a list of shape IDs.
crates/drafftink-core/src/crdt/schema.rs:74
↓ 4 callers
Method
as_rect
Get the rectangle as a kurbo Rect.
crates/drafftink-core/src/shapes/rectangle.rs:81
↓ 4 callers
Method
bounds
(&self)
crates/drafftink-core/src/shapes/text.rs:332
↓ 4 callers
Function
build
Parse `body` and build the shapes for a sequence diagram. Returns an empty vector if there is nothing drawable.
crates/drafftink-core/src/mermaid/sequence.rs:111
↓ 4 callers
Method
children
Get the children of this group.
crates/drafftink-core/src/shapes/group.rs:44
↓ 4 callers
Method
clone
(&self)
crates/drafftink-core/src/crdt/schema.rs:427
↓ 4 callers
Function
collect_snap_candidates
Collect snap candidate bounds with viewport culling, proximity filtering, and limit. `exclude_ids` - shape IDs to exclude (e.g., the shape being dragg
crates/drafftink-app/src/event_handler.rs:45
↓ 4 callers
Function
color_swatch_selectable
Color swatch circle that can show selection state with black inner offset - uses drafftink_widgets.
crates/drafftink-app/src/ui.rs:1200
↓ 4 callers
Function
colors_match
Check if two colors match (for selection highlighting).
crates/drafftink-widgets/src/colors.rs:985
↓ 4 callers
Function
copy_png_to_clipboard
Copy PNG to clipboard.
crates/drafftink-app/src/app.rs:170
↓ 4 callers
Method
curve_to
(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x: f32, y: f32)
crates/drafftink-render/src/rex_backend.rs:116
↓ 4 callers
Method
direction
Get the direction vector (normalized).
crates/drafftink-core/src/shapes/arrow.rs:100
↓ 4 callers
Method
document_path
Get the file path for a document ID.
crates/drafftink-core/src/storage/file.rs:43
↓ 4 callers
Method
end
End the current interaction and return any created shape.
crates/drafftink-core/src/tools/mod.rs:243
↓ 4 callers
Method
exists
(&self, id: &str)
crates/drafftink-core/src/storage/file.rs:143
↓ 4 callers
Method
grid
Grid swatch (smaller, for color grids)
crates/drafftink-widgets/src/colors.rs:497
↓ 4 callers
Method
grid_bounds
Calculate grid bounds from viewport and transform.
crates/drafftink-render/src/vello_impl.rs:2208
↓ 4 callers
Method
handle_press
Handle a press event (mouse down). `grid_snap_enabled` controls whether the start point should snap to grid.
crates/drafftink-app/src/event_handler.rs:353
↓ 4 callers
Method
import
Import updates from another document.
crates/drafftink-core/src/crdt/schema.rs:307
↓ 4 callers
Function
input_text
Single-line text input with modern styling.
crates/drafftink-widgets/src/common.rs:41
↓ 4 callers
Function
intern_participant
Find or create a participant by id, optionally setting an explicit label. Returns the participant's column index.
crates/drafftink-core/src/mermaid/sequence.rs:190
↓ 4 callers
Method
length
Get the length of the line.
crates/drafftink-core/src/shapes/line.rs:111
↓ 4 callers
Function
line_shape
Create a straight connector line between two points with the given stroke style (solid/dashed/dotted).
crates/drafftink-core/src/mermaid/mod.rs:245
↓ 4 callers
Function
load_document
Load document from a JSON file using native file dialog (async, non-blocking). Use `take_pending_document()` to retrieve the result.
crates/drafftink-app/src/app.rs:68
↓ 4 callers
Method
mark_dirty
Mark the document as having unsaved changes.
crates/drafftink-core/src/storage/autosave.rs:58
↓ 4 callers
Method
name
Get display name for this grid style.
crates/drafftink-render/src/renderer.rs:54
↓ 4 callers
Function
primary_btn
Primary button (blue background, white text).
crates/drafftink-widgets/src/common.rs:6
↓ 4 callers
Method
render_math_error
Render error placeholder for math that couldn't be rendered.
crates/drafftink-render/src/vello_impl.rs:1172
↓ 4 callers
Method
render_shape
(&mut self, shape: &Shape, transform: Affine, selected: bool)
crates/drafftink-render/src/vello_impl.rs:2392
↓ 4 callers
Method
run
Run the application, optionally auto-connecting to `server` and auto-joining `room` on startup (native CLI args; `None` on the web).
crates/drafftink-app/src/app.rs:1805
↓ 4 callers
Method
set_cached_size
Set the cached layout size (computed by the renderer). Uses interior mutability so this can be called during rendering.
crates/drafftink-core/src/shapes/text.rs:154
↓ 4 callers
Function
set_pending_document
(doc: CanvasDocument)
crates/drafftink-app/src/app.rs:471
↓ 4 callers
Method
set_room
Set the current room (called when server confirms join).
crates/drafftink-core/src/collaboration.rs:246
↓ 4 callers
Method
set_rotation
Set the rotation angle in radians.
crates/drafftink-core/src/shapes/mod.rs:521
↓ 4 callers
Method
set_tool
Set the current tool.
crates/drafftink-core/src/tools/mod.rs:127
↓ 4 callers
Function
snap_line_endpoint
Snap a line endpoint to angle increments from a start point. This snaps the angle while preserving the distance from start.
crates/drafftink-core/src/snap.rs:501
↓ 4 callers
Function
snap_ray_to_grid_lines
Find where a ray from origin at a given angle intersects with grid lines. Returns the nearest intersection point to the target point. This snaps to w
crates/drafftink-core/src/snap.rs:589
↓ 4 callers
Method
sync_char_colors_after_edit
Sync char_colors with content after text edit. `edit_char_pos` is the character index where the edit occurred. `old_char_count` is the character count
crates/drafftink-core/src/shapes/text.rs:186
↓ 4 callers
Method
sync_to_crdt
Sync local document state to CRDT. This should be called after local operations to propagate changes.
crates/drafftink-core/src/collaboration.rs:94
↓ 4 callers
Function
to_grid
(v: f64)
crates/drafftink-core/src/elbow.rs:11
↓ 3 callers
Method
all_points
Get all points including start, intermediate, and end.
crates/drafftink-core/src/shapes/arrow.rs:92
↓ 3 callers
Function
apply_hand_drawn_effect
Apply hand-drawn effect to a path based on roughness level. This mimics the Excalidraw/rough.js algorithm: - Endpoints are randomly offset (lines over
crates/drafftink-render/src/vello_impl.rs:130
↓ 3 callers
Method
as_rect
Get the bounding rectangle.
crates/drafftink-core/src/shapes/image.rs:182
↓ 3 callers
Function
base64_encode
Base64 encoding
crates/drafftink-core/src/sync.rs:153
↓ 3 callers
Method
bring_to_front
Bring a shape to the front (topmost).
crates/drafftink-core/src/canvas.rs:167
↓ 3 callers
Method
broadcast_sync
Queue a sync broadcast with current CRDT state.
crates/drafftink-core/src/collaboration.rs:325
↓ 3 callers
Function
build
Parse `body` and build the shapes for a flowchart. Returns an empty vector if there is nothing drawable.
crates/drafftink-core/src/mermaid/flowchart.rs:148
↓ 3 callers
Function
color_swatch_current
Current color swatch with hue wheel background (color picker button) - uses drafftink_widgets.
crates/drafftink-app/src/ui.rs:1206
↓ 3 callers
Method
connect
Connect to a WebSocket server.
crates/drafftink-core/src/sync.rs:224
↓ 3 callers
Method
editor
Get a reference to the PlainEditor.
crates/drafftink-render/src/text_editor.rs:116
↓ 3 callers
Function
element_to_shape
Convert a single Excalidraw element into a native shape, or `None` if it is deleted or of an unsupported type.
crates/drafftink-core/src/excalidraw.rs:243
↓ 3 callers
Function
encode_png
Encode RGBA pixel data to PNG bytes with optional embedded scene JSON.
crates/drafftink-app/src/app.rs:1438
↓ 3 callers
Method
enter_text_edit
Enter text editing mode for a shape. This updates both the local state and the Canvas's WidgetManager. Stores the top-left handle position and size to
crates/drafftink-app/src/event_handler.rs:234
↓ 3 callers
Method
exit_text_edit
Exit text editing mode. This updates both the local state and the Canvas's WidgetManager. If the text is empty, the shape is deleted. Preserves top-le
crates/drafftink-app/src/event_handler.rs:253
↓ 3 callers
Function
export_png
Export PNG to file using native file dialog (async, non-blocking).
crates/drafftink-app/src/app.rs:150
↓ 3 callers
Function
find_arrow
Locate the leftmost message-arrow token in `s`. Returns its byte offset, its length, and whether it is a dashed (return) arrow.
crates/drafftink-core/src/mermaid/sequence.rs:266
↓ 3 callers
Function
find_subsequence
Find the next occurrence of `needle` within `chars` at or after `from`.
crates/drafftink-core/src/mermaid/flowchart.rs:429
↓ 3 callers
Method
get_cached_hand_drawn
Get or compute a cached hand-drawn path.
crates/drafftink-render/src/vello_impl.rs:506
↓ 3 callers
Function
get_url_params
Parse URL query parameters for room and server. Supports formats like `?room=abc123&server=localhost:3030`
crates/drafftink-app/src/web.rs:15
↓ 3 callers
Method
handle_release
Handle a release event (mouse up). `grid_snap_enabled` controls whether the end point should snap to grid. `angle_snap_enabled` enables 15° angle snap
crates/drafftink-app/src/event_handler.rs:597
↓ 3 callers
Method
hit_test
Check if a point (in world coordinates) hits this handle. `tolerance` should be adjusted for camera zoom.
crates/drafftink-core/src/selection.rs:64
↓ 3 callers
Method
id
(&self)
crates/drafftink-core/src/shapes/group.rs:103
↓ 3 callers
Function
intern_node
Find or create a node by id. An explicit label/shape upgrades a node that was previously only referenced. A brand-new node is assigned to `parent`. Re
crates/drafftink-core/src/mermaid/flowchart.rs:331
↓ 3 callers
Method
is_selected
Check if a shape is selected.
crates/drafftink-core/src/canvas.rs:485
↓ 3 callers
Method
is_snapped
Check if any snapping occurred.
crates/drafftink-core/src/snap.rs:442
↓ 3 callers
Method
join_room
Request to join a room. Queues the join message.
crates/drafftink-core/src/collaboration.rs:254
↓ 3 callers
Function
keyword
If `line` begins with `word` on a word boundary, return the trimmed remainder.
crates/drafftink-core/src/mermaid/flowchart.rs:221
↓ 3 callers
Method
list
(&self)
crates/drafftink-core/src/storage/file.rs:112
↓ 3 callers
Method
load
(&self, id: &str)
crates/drafftink-core/src/storage/file.rs:80
↓ 3 callers
Function
load_document_async
Load document from IndexedDB - triggers async load. Use `take_pending_document()` to retrieve the loaded document.
crates/drafftink-app/src/app.rs:373
↓ 3 callers
Function
load_tab_into_canvas
Load the tab at `index` into the live canvas.
crates/drafftink-app/src/app.rs:1716
↓ 3 callers
Method
next
Cycle to the next sloppiness level.
crates/drafftink-core/src/shapes/mod.rs:100
↓ 3 callers
Function
parse_iso8601_utc
Parse a crates.io timestamp into a UTC datetime. crates.io returns values like `2026-06-12T12:22:39.813180Z`. We extract the calendar fields
utils/quarantine_check.py:289
↓ 3 callers
Function
parse_node
Parse a node token at `start`. Returns the parsed node and the index just past it, or `None` if no identifier is present.
crates/drafftink-core/src/mermaid/flowchart.rs:368
↓ 3 callers
Function
points_from_loro
(map: &LoroMapValue, key: &str)
crates/drafftink-core/src/crdt/convert.rs:433
↓ 3 callers
Method
queue_awareness
Queue awareness broadcast.
crates/drafftink-core/src/collaboration.rs:310
↓ 3 callers
Function
read_clipboard_text_async
()
crates/drafftink-app/src/app.rs:310
↓ 3 callers
Function
read_points
Read a `points` array of `[dx, dy]` pairs, translated by the element origin.
crates/drafftink-core/src/excalidraw.rs:354
↓ 3 callers
Method
redo
Redo the last undone change. Returns true if redo was performed, false if nothing to redo.
crates/drafftink-core/src/canvas.rs:106
↓ 3 callers
Method
render_path_cached
Render a shape path with the given style (with caching).
crates/drafftink-render/src/vello_impl.rs:580
↓ 3 callers
Method
render_stroke_only
Render a path with stroke only (no fill) - used for lines and arrows.
crates/drafftink-render/src/vello_impl.rs:661
↓ 3 callers
Method
send_to_back
Send a shape to the back (bottommost).
crates/drafftink-core/src/canvas.rs:173
↓ 3 callers
Method
set_cursor
Update local cursor position.
crates/drafftink-core/src/collaboration.rs:287
↓ 3 callers
Method
set_text
Set the text content.
crates/drafftink-render/src/text_editor.rs:135
↓ 3 callers
Function
shapes_from_mermaid
Try to parse clipboard text as a supported Mermaid diagram, returning a single-element vector holding one [`Shape::Group`] that contains every drawabl
crates/drafftink-core/src/mermaid/mod.rs:121
↓ 3 callers
Method
simplify
Simplify the path by removing redundant points.
crates/drafftink-core/src/shapes/freehand.rs:106
↓ 3 callers
Function
snap_angle
Snap an angle to the nearest increment. Returns the snapped angle in degrees (0-360).
crates/drafftink-core/src/snap.rs:487
← previous
next →
101–200 of 1,090, ranked by callers