From b0ddf9b1c08d6e71ee748778826b2b5583edcf0e Mon Sep 17 00:00:00 2001 From: Jesse Dunietz Date: Wed, 22 Feb 2017 15:38:39 -0500 Subject: [PATCH] Fixed scroll-to-match for text searches --- client/src/visualizer.js | 6 +++--- client/src/visualizer_ui.js | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client/src/visualizer.js b/client/src/visualizer.js index 273be5e4f..14a58a614 100644 --- a/client/src/visualizer.js +++ b/client/src/visualizer.js @@ -2778,7 +2778,7 @@ Util.profileStart('rows'); var text; if (rtlmode) { text = svg.text(sentNumGroup, canvasWidth - sentNumMargin + Configuration.visual.margin.x, y - rowPadding, - '' + row.sentence, { 'data-sent': row.sentence }); + '' + row.sentence, { 'data-sent': row.sentence }); } else { text = svg.text(sentNumGroup, sentNumMargin - Configuration.visual.margin.x, y - rowPadding, '' + row.sentence, { 'data-sent': row.sentence }); @@ -2835,8 +2835,8 @@ Util.profileStart('chunkFinish'); var nextChunk = data.chunks[chunkNo + 1]; var nextSpace = nextChunk ? nextChunk.space : ''; if (rtlmode) { - // Render every text chunk as a SVG text so we maintain control over the layout. When - // rendering as a SVG span (as brat does), then the browser changes the layout on the + // Render every text chunk as a SVG text so we maintain control over the layout. When + // rendering as a SVG span (as brat does), then the browser changes the layout on the // X-axis as it likes in RTL mode. svg.text(textGroup, chunk.textX, chunk.row.textY, chunk.text + nextSpace, { 'data-chunk-id': chunk.index diff --git a/client/src/visualizer_ui.js b/client/src/visualizer_ui.js index 7727622ac..df5fb6dbf 100644 --- a/client/src/visualizer_ui.js +++ b/client/src/visualizer_ui.js @@ -699,6 +699,7 @@ var VisualizerUI = (function($, window, undefined) { width: 500 }); + /* XXX removed per #900 // insert the Save link var $fileBrowserButtonset = fileBrowser. @@ -1684,9 +1685,10 @@ var VisualizerUI = (function($, window, undefined) { // we may need to move to a different collection. var oldDocCmpts = selectorData.items[pos][2].rsplit('/', 1); if (newDocCmpts[0] != oldDocCmpts[0]) { - dispatcher.post('setCollection', [searchColl + newDocCmpts[0] + '/']); + dispatcher.post('setCollection', [searchColl + newDocCmpts[0] + '/', newDocCmpts[1], newDocArgs]); + } else { + dispatcher.post('setDocument', [newDocCmpts[1], newDocArgs]); } - dispatcher.post('setDocument', [newDocCmpts[1], newDocArgs]); } return false; }; @@ -1803,11 +1805,12 @@ var VisualizerUI = (function($, window, undefined) { var svgtop = $('svg').offset().top; var $inFocus = $('#svg animate[data-type="focus"]:first').parent(); if (!$inFocus.length && args.matchfocus) { - $inFocus = $('[data-span-id=' + args.matchfocus + ']'); + $inFocus = $('#svg animate[data-type="matchfocus"]').parent(); } if ($inFocus.length) { $('html,body'). - animate({ scrollTop: $inFocus.offset().top - svgtop - window.innerHeight / 2 }, { duration: 'slow', easing: 'swing'}); + animate({ scrollTop: $inFocus.offset().top - svgtop - window.innerHeight / 2 }, + { duration: 'slow', easing: 'swing' }); } } dispatcher.post('allowReloadByURL');