alt zoom new method
parent
e3bfdd9534
commit
2309cc64eb
|
@ -660,7 +660,7 @@
|
||||||
changeZoom({value: .1});
|
changeZoom({value: .1});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (typeof animatedZoom != 'undefined') window.cancelAnimationFrame(animatedZoom)
|
||||||
//animate
|
//animate
|
||||||
var start = Date.now();
|
var start = Date.now();
|
||||||
var duration = 500;
|
var duration = 500;
|
||||||
|
@ -674,12 +674,12 @@
|
||||||
svgCanvas.setZoom(current_zoom + (diff*tick));
|
svgCanvas.setZoom(current_zoom + (diff*tick));
|
||||||
updateCanvas();
|
updateCanvas();
|
||||||
if (tick < 1) {
|
if (tick < 1) {
|
||||||
requestAnimationFrame(animateZoom)
|
window.animatedZoom = requestAnimationFrame(animateZoom)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#zoom").val(zoomlevel*100)
|
$("#zoom").val(parseInt(zoomlevel*100))
|
||||||
$("option", "#zoom_select").removeAttr("selected")
|
$("option", "#zoom_select").removeAttr("selected")
|
||||||
$("option[value="+ zoomlevel*100 +"]", "#zoom_select").attr("selected", "selected")
|
$("option[value="+ parseInt(zoomlevel*100) +"]", "#zoom_select").attr("selected", "selected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
animateZoom(Date.now())
|
animateZoom(Date.now())
|
||||||
|
@ -1892,19 +1892,13 @@
|
||||||
|
|
||||||
$('.menu_item').on('mousedown touchstart', function(e){blinker(e)});
|
$('.menu_item').on('mousedown touchstart', function(e){blinker(e)});
|
||||||
$("svg, body").on('mousedown touchstart', function(e){closer(e)});
|
$("svg, body").on('mousedown touchstart', function(e){closer(e)});
|
||||||
|
|
||||||
var accumulatedDelta = 0
|
var accumulatedDelta = 0
|
||||||
var zoomSteps = [6, 12, 16, 33, 50, 66, 100, 150, 200, 300, 400, 600, 800, 1200]
|
|
||||||
$('#workarea').on('mousewheel', function(e, delta, deltaX, deltaY){
|
$('#workarea').on('mousewheel', function(e, delta, deltaX, deltaY){
|
||||||
if (e.altKey) {
|
if (e.altKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var currentZoom = svgCanvas.getZoom()*100;
|
zoom = parseInt($("#zoom").val())
|
||||||
var arr_length = zoomSteps.length;
|
$("#zoom").val(parseInt(zoom + deltaY*10)).change()
|
||||||
for (i=0; i<arr_length; i++) {
|
|
||||||
var max = Math.min(arr_length, i+1);
|
|
||||||
if (deltaY > 0) zoom = (zoomSteps[i] <= currentZoom) ? zoomSteps[max] : zoom;
|
|
||||||
if (deltaY < 0) zoom = (zoomSteps[i] < currentZoom) ? zoomSteps[i] : zoom;
|
|
||||||
}
|
|
||||||
if (zoom) changeZoom({value: zoom});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$('.menu_title')
|
$('.menu_title')
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -660,7 +660,7 @@
|
||||||
changeZoom({value: .1});
|
changeZoom({value: .1});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (typeof animatedZoom != 'undefined') window.cancelAnimationFrame(animatedZoom)
|
||||||
//animate
|
//animate
|
||||||
var start = Date.now();
|
var start = Date.now();
|
||||||
var duration = 500;
|
var duration = 500;
|
||||||
|
@ -674,12 +674,12 @@
|
||||||
svgCanvas.setZoom(current_zoom + (diff*tick));
|
svgCanvas.setZoom(current_zoom + (diff*tick));
|
||||||
updateCanvas();
|
updateCanvas();
|
||||||
if (tick < 1) {
|
if (tick < 1) {
|
||||||
requestAnimationFrame(animateZoom)
|
window.animatedZoom = requestAnimationFrame(animateZoom)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#zoom").val(zoomlevel*100)
|
$("#zoom").val(parseInt(zoomlevel*100))
|
||||||
$("option", "#zoom_select").removeAttr("selected")
|
$("option", "#zoom_select").removeAttr("selected")
|
||||||
$("option[value="+ zoomlevel*100 +"]", "#zoom_select").attr("selected", "selected")
|
$("option[value="+ parseInt(zoomlevel*100) +"]", "#zoom_select").attr("selected", "selected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
animateZoom(Date.now())
|
animateZoom(Date.now())
|
||||||
|
@ -1892,19 +1892,13 @@
|
||||||
|
|
||||||
$('.menu_item').on('mousedown touchstart', function(e){blinker(e)});
|
$('.menu_item').on('mousedown touchstart', function(e){blinker(e)});
|
||||||
$("svg, body").on('mousedown touchstart', function(e){closer(e)});
|
$("svg, body").on('mousedown touchstart', function(e){closer(e)});
|
||||||
|
|
||||||
var accumulatedDelta = 0
|
var accumulatedDelta = 0
|
||||||
var zoomSteps = [6, 12, 16, 33, 50, 66, 100, 150, 200, 300, 400, 600, 800, 1200]
|
|
||||||
$('#workarea').on('mousewheel', function(e, delta, deltaX, deltaY){
|
$('#workarea').on('mousewheel', function(e, delta, deltaX, deltaY){
|
||||||
if (e.altKey) {
|
if (e.altKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var currentZoom = svgCanvas.getZoom()*100;
|
zoom = parseInt($("#zoom").val())
|
||||||
var arr_length = zoomSteps.length;
|
$("#zoom").val(parseInt(zoom + deltaY*10)).change()
|
||||||
for (i=0; i<arr_length; i++) {
|
|
||||||
var max = Math.min(arr_length, i+1);
|
|
||||||
if (deltaY > 0) zoom = (zoomSteps[i] <= currentZoom) ? zoomSteps[max] : zoom;
|
|
||||||
if (deltaY < 0) zoom = (zoomSteps[i] < currentZoom) ? zoomSteps[i] : zoom;
|
|
||||||
}
|
|
||||||
if (zoom) changeZoom({value: zoom});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$('.menu_title')
|
$('.menu_title')
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue