Skip to content

Commit 8ee8593

Browse files
committed
Fixed scroll-to-match for text searches
1 parent 2974c57 commit 8ee8593

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

client/src/visualizer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,7 @@ Util.profileStart('rows');
27782778
var text;
27792779
if (rtlmode) {
27802780
text = svg.text(sentNumGroup, canvasWidth - sentNumMargin + Configuration.visual.margin.x, y - rowPadding,
2781-
'' + row.sentence, { 'data-sent': row.sentence });
2781+
'' + row.sentence, { 'data-sent': row.sentence });
27822782
} else {
27832783
text = svg.text(sentNumGroup, sentNumMargin - Configuration.visual.margin.x, y - rowPadding,
27842784
'' + row.sentence, { 'data-sent': row.sentence });
@@ -2835,8 +2835,8 @@ Util.profileStart('chunkFinish');
28352835
var nextChunk = data.chunks[chunkNo + 1];
28362836
var nextSpace = nextChunk ? nextChunk.space : '';
28372837
if (rtlmode) {
2838-
// Render every text chunk as a SVG text so we maintain control over the layout. When
2839-
// rendering as a SVG span (as brat does), then the browser changes the layout on the
2838+
// Render every text chunk as a SVG text so we maintain control over the layout. When
2839+
// rendering as a SVG span (as brat does), then the browser changes the layout on the
28402840
// X-axis as it likes in RTL mode.
28412841
svg.text(textGroup, chunk.textX, chunk.row.textY, chunk.text + nextSpace, {
28422842
'data-chunk-id': chunk.index

client/src/visualizer_ui.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ var VisualizerUI = (function($, window, undefined) {
699699
width: 500
700700
});
701701

702+
702703
/* XXX removed per #900
703704
// insert the Save link
704705
var $fileBrowserButtonset = fileBrowser.
@@ -1684,9 +1685,10 @@ var VisualizerUI = (function($, window, undefined) {
16841685
// we may need to move to a different collection.
16851686
var oldDocCmpts = selectorData.items[pos][2].rsplit('/', 1);
16861687
if (newDocCmpts[0] != oldDocCmpts[0]) {
1687-
dispatcher.post('setCollection', [searchColl + newDocCmpts[0] + '/']);
1688+
dispatcher.post('setCollection', [searchColl + newDocCmpts[0] + '/', newDocCmpts[1], newDocArgs]);
1689+
} else {
1690+
dispatcher.post('setDocument', [newDocCmpts[1], newDocArgs]);
16881691
}
1689-
dispatcher.post('setDocument', [newDocCmpts[1], newDocArgs]);
16901692
}
16911693
return false;
16921694
};
@@ -1803,11 +1805,12 @@ var VisualizerUI = (function($, window, undefined) {
18031805
var svgtop = $('svg').offset().top;
18041806
var $inFocus = $('#svg animate[data-type="focus"]:first').parent();
18051807
if (!$inFocus.length && args.matchfocus) {
1806-
$inFocus = $('[data-span-id=' + args.matchfocus + ']');
1808+
$inFocus = $('#svg animate[data-type="matchfocus"]').parent();
18071809
}
18081810
if ($inFocus.length) {
18091811
$('html,body').
1810-
animate({ scrollTop: $inFocus.offset().top - svgtop - window.innerHeight / 2 }, { duration: 'slow', easing: 'swing'});
1812+
animate({ scrollTop: $inFocus.offset().top - svgtop - window.innerHeight / 2 },
1813+
{ duration: 'slow', easing: 'swing' });
18111814
}
18121815
}
18131816
dispatcher.post('allowReloadByURL');

0 commit comments

Comments
 (0)