diff options
| author | bob <bcz@cs.brown.edu> | 2019-02-25 12:38:47 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2019-02-25 12:38:47 -0500 |
| commit | c439f11ba9695703697f7abc53a7cc2fd2d5c1a2 (patch) | |
| tree | d3977cb05f37ec77eadb782c65d4766777dc0e18 /src/fields | |
| parent | e57c8ed3944bf737afdb2f564d159a53f8a6b1c6 (diff) | |
fixes for dropping documents without a know height.
Diffstat (limited to 'src/fields')
| -rw-r--r-- | src/fields/Document.ts | 2 | ||||
| -rw-r--r-- | src/fields/Field.ts | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/fields/Document.ts b/src/fields/Document.ts index 0d7d357a0..4e68b3b4d 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -31,7 +31,7 @@ export class Document extends Field { } public Width = () => { return this.GetNumber(KeyStore.Width, 0) } - public Height = () => { return this.GetNumber(KeyStore.Height, 0) } + public Height = () => { return this.GetNumber(KeyStore.Height, this.GetNumber(KeyStore.NativeWidth, 0) ? this.GetNumber(KeyStore.NativeHeight, 0) / this.GetNumber(KeyStore.NativeWidth, 0) * this.GetNumber(KeyStore.Width, 0) : 0) } public Scale = () => { return this.GetNumber(KeyStore.Scale, 1) } @computed diff --git a/src/fields/Field.ts b/src/fields/Field.ts index c7e0232af..d48509a47 100644 --- a/src/fields/Field.ts +++ b/src/fields/Field.ts @@ -1,6 +1,7 @@ import { Utils } from "../Utils"; import { Types } from "../server/Message"; +import { computed } from "mobx"; export function Cast<T extends Field>(field: FieldValue<Field>, ctor: { new(): T }): Opt<T> { if (field) { @@ -25,6 +26,8 @@ export abstract class Field { } private id: FieldId; + + @computed get Id(): FieldId { return this.id; } |
