import { Deserializable } from "../client/util/SerializationHelper"; import { serializable, custom, createSimpleSchema, list, object, map } from "serializr"; import { ObjectField } from "./ObjectField"; import { Copy, ToScriptString, ToString } from "./FieldSymbols"; export enum InkTool { None, Pen, Highlighter, Eraser, Stamp } export interface PointData { X: number; Y: number; } export type InkData = Array; const pointSchema = createSimpleSchema({ X: true, Y: true }); const strokeDataSchema = createSimpleSchema({ pathData: list(object(pointSchema)), "*": true }); @Deserializable("ink") export class InkField extends ObjectField { @serializable(list(object(strokeDataSchema))) readonly inkData: InkData; constructor(data: InkData) { super(); this.inkData = data; } [Copy]() { return new InkField(this.inkData); } [ToScriptString]() { return "invalid"; } [ToString]() { return "InkField"; } }