diff options
author | ab <abdullah_ahmed@brown.edu> | 2020-02-09 18:11:32 -0500 |
---|---|---|
committer | ab <abdullah_ahmed@brown.edu> | 2020-02-09 18:11:32 -0500 |
commit | 9953433d0019f53474f3a50fe96f04a1e7af543f (patch) | |
tree | 562abe2aadb6ecb443165b69a3691cb7a2915900 /src/new_fields/Doc.ts | |
parent | cb140cb5387836de1e2287ed9519a132f0f9d28f (diff) | |
parent | 45a8133bfaf4e3722db5da833ade42220d303126 (diff) |
Merge branch 'monika_animation' of https://github.com/browngraphicslab/Dash-Web into monika_animation
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r-- | src/new_fields/Doc.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index f230abaf4..216005697 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -255,6 +255,25 @@ export namespace Doc { // return Cast(field, ctor); // }); // } + + export function resetView(doc: Doc) { + doc._panX = doc._customOriginX ?? 0; + doc._panY = doc._customOriginY ?? 0; + doc.scale = doc._customOriginScale ?? 1; + } + + export function resetViewToOrigin(doc: Doc) { + doc._panX = 0; + doc._panY = 0; + doc.scale = 1; + } + + export function setView(doc: Doc) { + doc._customOriginX = doc._panX; + doc._customOriginY = doc._panY; + doc._customOriginScale = doc.scale; + } + export function RunCachedUpdate(doc: Doc, field: string) { const update = doc[CachedUpdates][field]; if (update) { |