From 30f84d4f090a47683c5b9e7922d6f57da561fac3 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sat, 5 Jan 2013 23:03:05 -0500 Subject: [PATCH] set limits on scaling --- app/assets/javascripts/Jit/jit2.0.0.js | 17 ++++++++++++++++- app/assets/javascripts/application.js | 12 ++++++++++++ app/views/maps/realtime.js.erb | 2 +- app/views/maps/savelayout.js.erb | 5 +++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/Jit/jit2.0.0.js b/app/assets/javascripts/Jit/jit2.0.0.js index 713a5543..7e15717b 100644 --- a/app/assets/javascripts/Jit/jit2.0.0.js +++ b/app/assets/javascripts/Jit/jit2.0.0.js @@ -2591,7 +2591,22 @@ Extras.Classes.Navigation = new Class({ $.event.stop($.event.get(e, win)); var val = this.config.zooming / 1000, ans = 1 + scroll * val; - this.canvas.scale(ans, ans); + if (ans > 1) { + if (5 >= this.canvas.scaleOffsetX) { + this.canvas.scale(ans, ans); + } + } + else if (ans < 1) { + if (this.canvas.scaleOffsetX >= 0.2) { + this.canvas.scale(ans, ans); + } + } + if (this.canvas.scaleOffsetX < 0.5) { + this.canvas.viz.labels.hideLabels(true); + } + else if (this.canvas.scaleOffsetX > 0.5) { + this.canvas.viz.labels.hideLabels(false); + } }, onMouseDown: function(e, win, eventInfo) { diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 53acef8f..04a56c6c 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -158,6 +158,18 @@ function addMetacode() { } } +function MconsoleReset() { + + var tX = Mconsole.canvas.translateOffsetX; + var tY = Mconsole.canvas.translateOffsetY; + Mconsole.canvas.translate(-tX,-tY); + + var mX = Mconsole.canvas.scaleOffsetX; + var mY = Mconsole.canvas.scaleOffsetY; + Mconsole.canvas.scale((1/mX),(1/mY)); + +} + diff --git a/app/views/maps/realtime.js.erb b/app/views/maps/realtime.js.erb index dba4f7d8..e5b814e9 100644 --- a/app/views/maps/realtime.js.erb +++ b/app/views/maps/realtime.js.erb @@ -84,6 +84,6 @@ var tempForT, tempForS, tempForM; Mconsole.fx.animate({ modes: ['linear','node-property:dim','edge-property:lineWidth'], transition: $jit.Trans.Quad.easeInOut, - duration: 3000 + duration: 500 }); <% end %> \ No newline at end of file diff --git a/app/views/maps/savelayout.js.erb b/app/views/maps/savelayout.js.erb index b6981d62..e3e3f7fd 100644 --- a/app/views/maps/savelayout.js.erb +++ b/app/views/maps/savelayout.js.erb @@ -1,2 +1,3 @@ -$('.focusleft').append('
Saved!
'); -$('#saveNotify').delay(1500).fadeOut('fast', function(){$('#saveNotify').remove()}); \ No newline at end of file +$('.saveNotify').remove(); +$('.focusleft').append('
Saved!
'); +$('.saveNotify').delay(1500).fadeOut('fast', function(){$('.saveNotify').remove()}); \ No newline at end of file