aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-02-25 01:22:40 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-02-25 01:22:40 -0500
commit80a2f5540af2aae49685de09a2b94f216f10f0d7 (patch)
treeb9ed70d2d176e31e9d69312dd2587ed13165832f /src/Utils.ts
parent62e06a2c9ce5054777a7a790e5b03b96d3cd6425 (diff)
parent41ff4813ddd9e6094d7d609c5960e1a614e00d7f (diff)
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web into authentication
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;