aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-02-20 22:03:09 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-02-20 22:03:09 -0500
commit6ddf4bb781da22d0a350c6f84db002917af06bad (patch)
tree2463ab9db8fba178f207f828e88afaa95dd3bde3 /src/Utils.ts
parent51164063076532b07ec42965e866de9cbb5e51e5 (diff)
parenta4c6a84c12aee00340bc20b30fa7d19072d999ba (diff)
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index c9c006aa8..d4b7da52c 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -2,15 +2,6 @@ import v4 = require('uuid/v4');
import v5 = require("uuid/v5");
import { Socket } from 'socket.io';
import { Message, Types } from './server/Message';
-import { Field } from './fields/Field';
-import { TextField } from './fields/TextField';
-import { NumberField } from './fields/NumberField';
-import { RichTextField } from './fields/RichTextField';
-import { Key } from './fields/Key';
-import { ImageField } from './fields/ImageField';
-import { ListField } from './fields/ListField';
-import { Document } from './fields/Document';
-import { Server } from './client/Server';
export class Utils {
@@ -23,6 +14,9 @@ export class Utils {
}
public static GetScreenTransform(ele: HTMLElement): { scale: number, translateX: number, translateY: number } {
+ if (!ele) {
+ return { scale: 1, translateX: 1, translateY: 1 }
+ }
const rect = ele.getBoundingClientRect();
const scale = ele.offsetWidth == 0 && rect.width == 0 ? 1 : rect.width / ele.offsetWidth;
const translateX = rect.left;