diff options
Diffstat (limited to 'src/new_fields/InkField.ts')
| -rw-r--r-- | src/new_fields/InkField.ts | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/new_fields/InkField.ts b/src/new_fields/InkField.ts index d94834e91..4a44b4f55 100644 --- a/src/new_fields/InkField.ts +++ b/src/new_fields/InkField.ts @@ -1,30 +1,26 @@ import { Deserializable } from "../client/util/SerializationHelper"; import { serializable, custom, createSimpleSchema, list, object, map } from "serializr"; import { ObjectField } from "./ObjectField"; -import { Copy, ToScriptString } from "./FieldSymbols"; -import { DeepCopy } from "../Utils"; +import { Copy, ToScriptString, ToString } from "./FieldSymbols"; export enum InkTool { None, Pen, Highlighter, Eraser, - Scrubber + Scrubber, + Stamp } -export interface StrokeData { - pathData: Array<{ x: number, y: number }>; - color: string; - width: string; - tool: InkTool; - displayTimecode: number; - creationTime: number; +export interface PointData { + X: number; + Y: number; } -export type InkData = Map<string, StrokeData>; +export type InkData = Array<PointData>; const pointSchema = createSimpleSchema({ - x: true, y: true + X: true, Y: true }); const strokeDataSchema = createSimpleSchema({ @@ -34,19 +30,22 @@ const strokeDataSchema = createSimpleSchema({ @Deserializable("ink") export class InkField extends ObjectField { - @serializable(map(object(strokeDataSchema))) + @serializable(list(object(strokeDataSchema))) readonly inkData: InkData; - constructor(data?: InkData) { + constructor(data: InkData) { super(); - this.inkData = data || new Map; + this.inkData = data; } [Copy]() { - return new InkField(DeepCopy(this.inkData)); + return new InkField(this.inkData); } [ToScriptString]() { return "invalid"; } + [ToString]() { + return "InkField"; + } } |
