From 66dc0aefa9972071a8d3f5163048867071dd2b59 Mon Sep 17 00:00:00 2001 From: Tyler Schicke Date: Mon, 18 Mar 2019 16:10:06 -0400 Subject: Fixes for ink --- src/client/views/InkingCanvas.tsx | 2 +- src/fields/Document.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/InkingCanvas.tsx b/src/client/views/InkingCanvas.tsx index d7b8bf3c3..8d0121035 100644 --- a/src/client/views/InkingCanvas.tsx +++ b/src/client/views/InkingCanvas.tsx @@ -46,7 +46,7 @@ export class InkingCanvas extends React.Component { } set inkData(value: StrokeMap) { - this.props.Document.SetOnPrototype(KeyStore.Ink, new InkField(value)); + this.props.Document.SetDataOnPrototype(KeyStore.Ink, value, InkField); } componentDidMount() { diff --git a/src/fields/Document.ts b/src/fields/Document.ts index be0137128..b6439364a 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -248,6 +248,13 @@ export class Document extends Field { } } + @action + SetDataOnPrototype(key: Key, value: T, ctor: { new(): U }, replaceWrongType = true) { + this.GetAsync(KeyStore.Prototype, (f: Field) => { + (f as Document).SetData(key, value, ctor) + }) + } + @action SetData(key: Key, value: T, ctor: { new(): U }, replaceWrongType = true) { -- cgit v1.2.3-70-g09d2