Limit panning

This commit is contained in:
Roland Rytz 2017-04-10 16:28:22 +02:00
parent dcc6795517
commit 5f35484eb5
5 changed files with 26 additions and 7 deletions

View file

@ -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();
}

View file

@ -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

View file

@ -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

View file

@ -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>