mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-24 18:34:23 +01:00
Limit panning
This commit is contained in:
parent
dcc6795517
commit
5f35484eb5
5 changed files with 26 additions and 7 deletions
14
combined.js
14
combined.js
|
@ -86832,6 +86832,9 @@ var linesCanvas = document.getElementById("linesCanvas");
|
|||
var linesContext = linesCanvas.getContext("2d");
|
||||
var hovered = [];
|
||||
|
||||
var previousZoomOrigin = [0, 0];
|
||||
var previousScaleZoomOrigin = [0, 0];
|
||||
|
||||
function updateLines(){
|
||||
|
||||
linesCanvas.width = linesCanvas.clientWidth;
|
||||
|
@ -86915,8 +86918,6 @@ function initView(){
|
|||
document.getElementById("sort").value = defaultSort;
|
||||
|
||||
var lastPos = [0, 0];
|
||||
var previousZoomOrigin = [0, 0];
|
||||
var previousScaleZoomOrigin = [0, 0];
|
||||
|
||||
var fixed = false; // Fix hovered items in place, so that clicking on links is possible
|
||||
|
||||
|
@ -87995,6 +87996,12 @@ var viewportSize = [0, 0];
|
|||
function applyView(){
|
||||
|
||||
//console.log(zoomOrigin, scaleZoomOrigin);
|
||||
//console.log(scaleZoomOrigin[0]);
|
||||
|
||||
scaleZoomOrigin[0] = Math.max(-500, Math.min(500, scaleZoomOrigin[0]));
|
||||
scaleZoomOrigin[1] = Math.max(-500, Math.min(500, scaleZoomOrigin[1]));
|
||||
|
||||
zoomOrigin = [scaleZoomOrigin[0]*zoom, scaleZoomOrigin[1]*zoom];
|
||||
|
||||
innerContainer.style.height = (~~(zoom*1000))+"px";
|
||||
innerContainer.style.width = (~~(zoom*1000))+"px";
|
||||
|
@ -88247,6 +88254,9 @@ function init(){
|
|||
scaleZoomOrigin[0] += deltaX/zoom;
|
||||
scaleZoomOrigin[1] += deltaY/zoom;
|
||||
|
||||
previousZoomOrigin = [zoomOrigin[0], zoomOrigin[1]];
|
||||
previousScaleZoomOrigin = [scaleZoomOrigin[0], scaleZoomOrigin[1]];
|
||||
|
||||
updateLines();
|
||||
applyView();
|
||||
}
|
||||
|
|
|
@ -49,6 +49,12 @@ var viewportSize = [0, 0];
|
|||
function applyView(){
|
||||
|
||||
//console.log(zoomOrigin, scaleZoomOrigin);
|
||||
//console.log(scaleZoomOrigin[0]);
|
||||
|
||||
scaleZoomOrigin[0] = Math.max(-500, Math.min(500, scaleZoomOrigin[0]));
|
||||
scaleZoomOrigin[1] = Math.max(-500, Math.min(500, scaleZoomOrigin[1]));
|
||||
|
||||
zoomOrigin = [scaleZoomOrigin[0]*zoom, scaleZoomOrigin[1]*zoom];
|
||||
|
||||
innerContainer.style.height = (~~(zoom*1000))+"px";
|
||||
innerContainer.style.width = (~~(zoom*1000))+"px";
|
||||
|
@ -301,6 +307,9 @@ function init(){
|
|||
scaleZoomOrigin[0] += deltaX/zoom;
|
||||
scaleZoomOrigin[1] += deltaY/zoom;
|
||||
|
||||
previousZoomOrigin = [zoomOrigin[0], zoomOrigin[1]];
|
||||
previousScaleZoomOrigin = [scaleZoomOrigin[0], scaleZoomOrigin[1]];
|
||||
|
||||
updateLines();
|
||||
applyView();
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -26,6 +26,9 @@ var linesCanvas = document.getElementById("linesCanvas");
|
|||
var linesContext = linesCanvas.getContext("2d");
|
||||
var hovered = [];
|
||||
|
||||
var previousZoomOrigin = [0, 0];
|
||||
var previousScaleZoomOrigin = [0, 0];
|
||||
|
||||
function updateLines(){
|
||||
|
||||
linesCanvas.width = linesCanvas.clientWidth;
|
||||
|
@ -109,8 +112,6 @@ function initView(){
|
|||
document.getElementById("sort").value = defaultSort;
|
||||
|
||||
var lastPos = [0, 0];
|
||||
var previousZoomOrigin = [0, 0];
|
||||
var previousScaleZoomOrigin = [0, 0];
|
||||
|
||||
var fixed = false; // Fix hovered items in place, so that clicking on links is possible
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ <h2>Tux</h2>
|
|||
<script type="text/javascript" src="./_js/main.js?version=1.0.3"></script>
|
||||
-->
|
||||
|
||||
<script type="text/javascript" src="./_js/minified.js?version=1.0.80"></script>
|
||||
<script type="text/javascript" src="./_js/minified.js?version=1.0.81"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue