Skip to content

Commit

Permalink
Fixes #645 (text highlight problems)
Browse files Browse the repository at this point in the history
  • Loading branch information
Goran Topic committed Feb 16, 2012
1 parent c6e4e85 commit 6232709
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/src/visualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ var Visualizer = (function($, window, undefined) {
to: endPos
};
} else { // it's markedText [id, start?, char#, offset]
if (span[2] < 0) span[2] = 0;
if (!span[2]) { // start
span[3] = text.getStartPositionOfChar(span[2]).x;
} else {
Expand All @@ -879,9 +880,12 @@ var Visualizer = (function($, window, undefined) {

// get the span annotation text sizes
var spanTexts = {};
var noSpans = true;
$.each(data.spans, function(spanNo, span) {
spanTexts[span.glyphedLabelText] = true;
noSpans = false;
});
if (noSpans) spanTexts.$ = true; // dummy so we can at least get the height
var spanSizes = getTextMeasurements(spanTexts, {'class': 'span'});

return {
Expand Down Expand Up @@ -1275,6 +1279,9 @@ Util.profileStart('chunks');
// }
var rightBorderForArcs = hasRightArcs ? arcHorizontalSpacing : (hasInternalArcs ? arcSlant : 0);

var lastX = current.x;
var lastRow = row;

if (chunk.sentence) {
while (sentenceNumber < chunk.sentence) {
sentenceNumber++;
Expand All @@ -1288,9 +1295,6 @@ Util.profileStart('chunks');
sentenceToggle = 1 - sentenceToggle;
}

var lastX = current.x;
var lastRow = row;

if (chunk.sentence ||
current.x + boxWidth + rightBorderForArcs >= canvasWidth - 2 * Configuration.visual.margin.x) {
// the chunk does not fit
Expand Down

0 comments on commit 6232709

Please sign in to comment.