Skip to content

Commit 8afe05c

Browse files
author
Jared Deckard
committed
Added screen size to localStorage.screens
1 parent 72c99be commit 8afe05c

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

Leap.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,20 +1239,23 @@ Leap.ToolList.prototype.append = function(other){
12391239
for(i=0; i<other.length; i++) this.push(new Leap.Tool(other[i]));
12401240
};
12411241

1242-
Leap.Screen = function(data){
1242+
Leap.Screen = function(data, width, height){
12431243

12441244
this._data = data;
12451245

12461246
if(data){
1247-
1247+
1248+
if(!("3" in data)) this._data[3] = window.innerWidth;
1249+
if(!("4" in data)) this._data[4] = window.innerHeight;
1250+
12481251
this._plane = new Leap.Plane(data[0],data[1],data[2]);
12491252
this._center = data[0].plus(data[2]).dividedBy(2);
12501253
this._origin = data[1].plus(data[1].minus(this._center));
12511254

12521255
var xv = data[2].minus(data[0]);
12531256
var yv = data[0].minus(data[1]);
1254-
var xscale = 2*xv.magnitude()/window.innerWidth;
1255-
var yscale = 4*yv.magnitude()/window.innerHeight;
1257+
var xscale = 2*xv.magnitude()/this._data[3];
1258+
var yscale = 4*yv.magnitude()/this._data[4];
12561259
this._xspan = xv.normalized().dividedBy(xscale);
12571260
this._yspan = yv.normalized().dividedBy(yscale);
12581261

@@ -1330,7 +1333,7 @@ Leap.ScreenList = function(){
13301333
var screens = JSON.parse(localStorage.screens);
13311334
for(var id in screens){
13321335
var screen = screens[id];
1333-
var data = [new Leap.Vector(screen[0]), new Leap.Vector(screen[1]), new Leap.Vector(screen[2])];
1336+
var data = [new Leap.Vector(screen[0]), new Leap.Vector(screen[1]), new Leap.Vector(screen[2]), screen[3], screen[4]];
13341337
this.push(new Leap.Screen(data));
13351338
}
13361339
}

0 commit comments

Comments
 (0)