Skip to content

Commit

Permalink
reverting viewport margin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Marsch committed Mar 3, 2014
1 parent 3944fec commit 059aed3
Show file tree
Hide file tree
Showing 12 changed files with 527 additions and 122 deletions.
23 changes: 11 additions & 12 deletions dist/OSMBuildings-Leaflet.debug.js
Expand Up @@ -1040,7 +1040,6 @@ function getTangents(c1, r1, c2, r2) {
var
WIDTH = 0, HEIGHT = 0, // though this looks like a constant it's needed for distinguishing from local vars
CENTER_X = 0, CENTER_Y = 0,
MARGIN = 200,
originX = 0, originY = 0,
zoom, size,

Expand Down Expand Up @@ -2034,8 +2033,8 @@ var Layers = {
i, il,
item;

canvas.width = WIDTH - 2*MARGIN;
canvas.height = HEIGHT - 2*MARGIN;
canvas.width = WIDTH;
canvas.height = HEIGHT;

// end fade in
clearInterval(animTimer);
Expand All @@ -2053,7 +2052,7 @@ var Layers = {
if (item.style.opacity !== '') {
context.globalAlpha = parseFloat(item.style.opacity);
}
context.drawImage(item, -MARGIN, -MARGIN);
context.drawImage(item, 0, 0);
context.globalAlpha = 1;
}

Expand All @@ -2062,8 +2061,8 @@ var Layers = {

// usually called after move: container jumps by move delta, cam is reset
setPosition: function(x, y) {
this.container.style.left = (x-MARGIN) +'px';
this.container.style.top = (y-MARGIN) +'px';
this.container.style.left = x +'px';
this.container.style.top = y +'px';
}
};

Expand All @@ -2090,23 +2089,23 @@ Layers.init();
//****** file: adapter.js ******

function setOrigin(origin) {
originX = origin.x-MARGIN;
originY = origin.y-MARGIN;
originX = origin.x;
originY = origin.y;
}

function setCamOffset(offset) {
camX = CENTER_X + offset.x;
camY = HEIGHT - MARGIN + offset.y;
camY = HEIGHT + offset.y;
}

function setSize(size) {
WIDTH = size.w + 2*MARGIN;
HEIGHT = size.h + 2*MARGIN;
WIDTH = size.w;
HEIGHT = size.h;
CENTER_X = WIDTH /2 <<0;
CENTER_Y = HEIGHT/2 <<0;

camX = CENTER_X;
camY = HEIGHT-MARGIN;
camY = HEIGHT;

Layers.setSize(WIDTH, HEIGHT);
maxHeight = camZ-50;
Expand Down
92 changes: 46 additions & 46 deletions dist/OSMBuildings-Leaflet.js

Large diffs are not rendered by default.

Binary file modified dist/OSMBuildings-Leaflet.js.gz
Binary file not shown.
23 changes: 11 additions & 12 deletions dist/OSMBuildings-OpenLayers.debug.js
Expand Up @@ -1040,7 +1040,6 @@ function getTangents(c1, r1, c2, r2) {
var
WIDTH = 0, HEIGHT = 0, // though this looks like a constant it's needed for distinguishing from local vars
CENTER_X = 0, CENTER_Y = 0,
MARGIN = 200,
originX = 0, originY = 0,
zoom, size,

Expand Down Expand Up @@ -2034,8 +2033,8 @@ var Layers = {
i, il,
item;

canvas.width = WIDTH - 2*MARGIN;
canvas.height = HEIGHT - 2*MARGIN;
canvas.width = WIDTH;
canvas.height = HEIGHT;

// end fade in
clearInterval(animTimer);
Expand All @@ -2053,7 +2052,7 @@ var Layers = {
if (item.style.opacity !== '') {
context.globalAlpha = parseFloat(item.style.opacity);
}
context.drawImage(item, -MARGIN, -MARGIN);
context.drawImage(item, 0, 0);
context.globalAlpha = 1;
}

Expand All @@ -2062,8 +2061,8 @@ var Layers = {

// usually called after move: container jumps by move delta, cam is reset
setPosition: function(x, y) {
this.container.style.left = (x-MARGIN) +'px';
this.container.style.top = (y-MARGIN) +'px';
this.container.style.left = x +'px';
this.container.style.top = y +'px';
}
};

Expand All @@ -2090,23 +2089,23 @@ Layers.init();
//****** file: adapter.js ******

function setOrigin(origin) {
originX = origin.x-MARGIN;
originY = origin.y-MARGIN;
originX = origin.x;
originY = origin.y;
}

function setCamOffset(offset) {
camX = CENTER_X + offset.x;
camY = HEIGHT - MARGIN + offset.y;
camY = HEIGHT + offset.y;
}

function setSize(size) {
WIDTH = size.w + 2*MARGIN;
HEIGHT = size.h + 2*MARGIN;
WIDTH = size.w;
HEIGHT = size.h;
CENTER_X = WIDTH /2 <<0;
CENTER_Y = HEIGHT/2 <<0;

camX = CENTER_X;
camY = HEIGHT-MARGIN;
camY = HEIGHT;

Layers.setSize(WIDTH, HEIGHT);
maxHeight = camZ-50;
Expand Down
80 changes: 40 additions & 40 deletions dist/OSMBuildings-OpenLayers.js

Large diffs are not rendered by default.

Binary file modified dist/OSMBuildings-OpenLayers.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions lib/suncalc
Submodule suncalc added at c10cbd
10 changes: 5 additions & 5 deletions src/Layers.js
Expand Up @@ -93,8 +93,8 @@ var Layers = {
i, il,
item;

canvas.width = WIDTH - 2*MARGIN;
canvas.height = HEIGHT - 2*MARGIN;
canvas.width = WIDTH;
canvas.height = HEIGHT;

// end fade in
clearInterval(animTimer);
Expand All @@ -112,7 +112,7 @@ var Layers = {
if (item.style.opacity !== '') {
context.globalAlpha = parseFloat(item.style.opacity);
}
context.drawImage(item, -MARGIN, -MARGIN);
context.drawImage(item, 0, 0);
context.globalAlpha = 1;
}

Expand All @@ -121,8 +121,8 @@ var Layers = {

// usually called after move: container jumps by move delta, cam is reset
setPosition: function(x, y) {
this.container.style.left = (x-MARGIN) +'px';
this.container.style.top = (y-MARGIN) +'px';
this.container.style.left = x +'px';
this.container.style.top = y +'px';
}
};

Expand Down
12 changes: 6 additions & 6 deletions src/adapter.js
@@ -1,21 +1,21 @@
function setOrigin(origin) {
originX = origin.x-MARGIN;
originY = origin.y-MARGIN;
originX = origin.x;
originY = origin.y;
}

function setCamOffset(offset) {
camX = CENTER_X + offset.x;
camY = HEIGHT - MARGIN + offset.y;
camY = HEIGHT + offset.y;
}

function setSize(size) {
WIDTH = size.w + 2*MARGIN;
HEIGHT = size.h + 2*MARGIN;
WIDTH = size.w;
HEIGHT = size.h;
CENTER_X = WIDTH /2 <<0;
CENTER_Y = HEIGHT/2 <<0;

camX = CENTER_X;
camY = HEIGHT-MARGIN;
camY = HEIGHT;

Layers.setSize(WIDTH, HEIGHT);
maxHeight = camZ-50;
Expand Down

0 comments on commit 059aed3

Please sign in to comment.