File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed
src/brainbrowser/volume-viewer Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,13 @@ $(function() {
285285 } ) ;
286286 } ) ;
287287
288+ $ ( document ) . keypress ( function ( e ) {
289+ if ( e . keyCode === 114 ) {
290+ // Reset displays if user presses 'r' key.
291+ viewer . resetDisplays ( ) ;
292+ viewer . redrawVolumes ( ) ;
293+ }
294+ } ) ;
288295 //////////////////////////////////
289296 // Per volume UI hooks go in here.
290297 //////////////////////////////////
Original file line number Diff line number Diff line change 295295 * ```
296296 */
297297 reset : function ( ) {
298- panel . zoom = 1 ;
298+ panel . zoom = panel . default_zoom ;
299299 panel . image_center . x = panel . canvas . width / 2 ;
300300 panel . image_center . y = panel . canvas . height / 2 ;
301+ panel . updated = true ;
301302 } ,
302303
303304 /**
496497 }
497498
498499 if ( panel . volume ) {
499- setSlice ( panel , panel . volume . slice ( panel . axis ) ) ;
500- panel . zoom = panel . volume . getPreferredZoom ( panel . canvas . width , panel . canvas . height ) ;
500+ var volume = panel . volume ;
501+ setSlice ( panel , volume . slice ( panel . axis ) ) ;
502+ panel . default_zoom = volume . getPreferredZoom ( panel . canvas . width , panel . canvas . height ) ;
503+ panel . zoom = panel . default_zoom ;
501504 }
502505
503506 return panel ;
518521 var context = panel . context ;
519522 var cursor = panel . getCursorPosition ( ) ;
520523 var zoom = panel . zoom ;
521- var length = 8 * zoom ;
524+ var length = 8 * ( zoom / panel . default_zoom ) ;
522525 var x , y , space ;
523526 var distance ;
524527 var dx , dy ;
529532 context . strokeStyle = color ;
530533 context . fillStyle = color ;
531534
532- space = zoom ;
535+ space = 1 ;
533536 x = cursor . x ;
534537 y = cursor . y ;
535538
Original file line number Diff line number Diff line change @@ -646,7 +646,7 @@ BrainBrowser.VolumeViewer.modules.loading = function(viewer) {
646646
647647 last_touch_distance = null ;
648648 }
649-
649+
650650 canvas . addEventListener ( "mousedown" , function ( event ) {
651651 event . preventDefault ( ) ;
652652
@@ -696,7 +696,8 @@ BrainBrowser.VolumeViewer.modules.loading = function(viewer) {
696696 }
697697
698698 function zoom ( delta ) {
699- panel . zoom = Math . max ( panel . zoom + delta * 0.05 , 0.05 ) ;
699+ panel . zoom *= ( delta < 0 ) ? 1 / 1.05 : 1.05 ;
700+ panel . zoom = Math . max ( panel . zoom , 0.25 ) ;
700701 panel . updateVolumePosition ( ) ;
701702 panel . updateSlice ( ) ;
702703
You can’t perform that action at this time.
0 commit comments