Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113import { CrdtId, LwwValue } from './tagged-block-common.js';import { CrdtSequence } from './crdt-sequence.js';
export class SceneItem {}
export const PenColor = Object.freeze({ BLACK: 0, GRAY: 1, WHITE: 2, YELLOW: 3, GREEN: 4, PINK: 5, BLUE: 6, RED: 7, GRAY_OVERLAP: 8, HIGHLIGHT: 9, GREEN_2: 10, CYAN: 11, MAGENTA: 12, YELLOW_2: 13,});export const PenColorByValue = Object.fromEntries( Object.entries(PenColor).map(([k, v]) => [v, k]));
export const Pen = Object.freeze({ BALLPOINT_1: 2, BALLPOINT_2: 15, CALIGRAPHY: 21, ERASER: 6, ERASER_AREA: 8, FINELINER_1: 4, FINELINER_2: 17, HIGHLIGHTER_1: 5, HIGHLIGHTER_2: 18, MARKER_1: 3, MARKER_2: 16, MECHANICAL_PENCIL_1: 7, MECHANICAL_PENCIL_2: 13, PAINTBRUSH_1: 0, PAINTBRUSH_2: 12, PENCIL_1: 1, PENCIL_2: 14, SHADER: 23, isHighlighter (value) { return value === 5 || value === 18; },});export const PenByValue = Object.fromEntries( Object.entries(Pen).filter(([, v]) => typeof v === 'number').map(([k, v]) => [v, k]));
export const ParagraphStyle = Object.freeze({ BASIC: 0, PLAIN: 1, HEADING: 2, BOLD: 3, BULLET: 4, BULLET2: 5, CHECKBOX: 6, CHECKBOX_CHECKED: 7, // Value 10 observed in firmware 3.22+ files on sequential list items; // 3.22 release notes introduce numbered lists. Values 8-9 unobserved so far. NUMBERED: 10,});export const ParagraphStyleByValue = Object.fromEntries( Object.entries(ParagraphStyle).map(([k, v]) => [v, k]));
// Per-page typed-text column width (SceneInfo tag 9), firmware 3.14+.// Values correlate with RootTextBlock widths 740 / 936 / 1152.export const ColumnWidth = Object.freeze({ NARROW: 0, DEFAULT: 1, WIDE: 2 });export const ColumnWidthByValue = Object.fromEntries( Object.entries(ColumnWidth).map(([k, v]) => [v, k]));
export { END_MARKER } from './crdt-sequence.js';
export class Point extends SceneItem { constructor (x, y, speed, direction, width, pressure) { super(); this.x = x; this.y = y; this.speed = speed; this.direction = direction; this.width = width; this.pressure = pressure; }}
export class Line extends SceneItem { constructor (color, tool, points, thicknessScale, startingLength, moveId = null, colorRgba = null) { super(); this.color = color; this.tool = tool; this.points = points; this.thicknessScale = thicknessScale; this.startingLength = startingLength; this.moveId = moveId; this.colorRgba = colorRgba; }}
export class Group extends SceneItem { constructor ({ nodeId, children = null, label = null, visible = null, anchorId = null, anchorType = null, anchorThreshold = null, anchorOriginX = null, } = {}) { super(); this.nodeId = nodeId; this.children = children ?? new CrdtSequence(); this.label = label ?? new LwwValue(new CrdtId(0, 0), ''); this.visible = visible ?? new LwwValue(new CrdtId(0, 0), true); this.anchorId = anchorId; this.anchorType = anchorType; this.anchorThreshold = anchorThreshold; this.anchorOriginX = anchorOriginX; }}
export class Text extends SceneItem { constructor (items, styles, posX, posY, width, widthLww = null) { super(); this.items = items; this.styles = styles; this.posX = posX; this.posY = posY; this.width = width; // LwwValue<float> duplicating width, written by firmware 3.14+ when the // column width is changed (RootTextBlock tag 5, subfield 1). this.widthLww = widthLww; }}
export class Rectangle { constructor (x, y, w, h) { this.x = x; this.y = y; this.w = w; this.h = h; }}
export class GlyphRange extends SceneItem { constructor (start, length, text, color, rectangles, colorRgba = null) { super(); this.start = start; this.length = length; this.text = text; this.color = color; this.rectangles = rectangles; this.colorRgba = colorRgba; }}