Skip to content

Commit 45260e5

Browse files
author
angusforbes
committed
Fixes some minor sizing issues with Words.
1 parent 2c524bc commit 45260e5

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@
128128
var attachmentMargin = 0.1; //percentage value
129129

130130
var word2word_strategy = strategies.FARTHEST;
131-
var word2link_strategy = strategies.CLOSEST;
132-
var link2link_strategy = strategies.CLOSEST; //CLOSEST sometimes causes overlaps - need to be a bit more rigorous when assigning slots - don't assign any slots that have the potential to overlap (when dragged manually)? - or let the buyer beware that this could happen - they can always move out of the way - right now it won't automatically overlap, but won't prevent a user from doing it.
131+
var word2link_strategy = strategies.FARTHEST;
132+
var link2link_strategy = strategies.FARTHEST; //CLOSEST sometimes causes overlaps - need to be a bit more rigorous when assigning slots - don't assign any slots that have the potential to overlap (when dragged manually)? - or let the buyer beware that this could happen - they can always move out of the way - right now it won't automatically overlap, but won't prevent a user from doing it.
133133

134134
var rows = []; //list of Row object, each of those has a list of Word objects
135135

js/annotate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ class Word {
200200
drawWord(this);
201201
}
202202

203+
203204
getMinWidth() {
204-
return Math.max(minWordWidth, this.tw);
205+
return Math.max(minWordWidth, this.maxtextw);
205206
}
206207

207208
/* must return a value less than row width - edgepaddings, else will try to reposition long words forever! */

js/interact.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ function moveWordToNewPosition(w, nx, ny) {
764764
w.underneathRect.y(ny);
765765

766766
w.text.x(nx + (w.rect.w/2) - (w.text.bbox().w/2) );
767-
w.text.y(ny + textpaddingY*2 - texts.wordText.descent);
767+
w.text.y(ny + textpaddingY*2); // - texts.wordText.descent);
768768

769769

770770

@@ -1039,7 +1039,11 @@ function setWordToY(word, wy) {
10391039
word.underneathRect.y(wy);
10401040
word.leftHandle.y(wy);
10411041
word.rightHandle.y(wy);
1042-
word.text.y(word.rect.y + textpaddingY);
1042+
word.text.y(word.rect.y + textpaddingY*2);
1043+
1044+
if (word.tag != null) {
1045+
word.tagtext.y(word.rect.y + textpaddingY/2);
1046+
}
10431047
}
10441048

10451049
function setUpRowDraggable(row) {

js/render.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ function drawWord(word) {
453453
var text = draw.text(function(add) {
454454

455455
add.text(word.val)
456-
.y(word.wy + textpaddingY*2 - texts.wordText.descent)
456+
.y(word.wy + textpaddingY*2) // - texts.wordText.descent)
457457
.x(word.wx + (word.ww/2) - (textwh.w / 2))
458458
.font(texts.wordText.style);
459459
});
@@ -470,7 +470,7 @@ function drawWord(word) {
470470
var tagtext = draw.text(function(add) {
471471

472472
add.text(word.tag)
473-
.y(word.wy + textpaddingY/2 - texts.tagText.descent)
473+
.y(word.wy + textpaddingY/2) // - texts.tagText.descent)
474474
.x(tagXPos)
475475
.font(texts.tagText.style);
476476
});

js/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ function setupTexts(svg) {
388388

389389
textArr.wordText = new TextStyle('Brown, BrownPro, futura, helvetica', 12, new FillStyle('#444'));
390390
textArr.linkText = new TextStyle('Brown, BrownPro, futura, helvetica', 10, new FillStyle('#888'));
391-
textArr.tagText = new TextStyle('Brown, BrownPro, futura, helvetica', 12, new FillStyle('#888'));
391+
textArr.tagText = new TextStyle('Brown, BrownPro, futura, helvetica', 10, new FillStyle('#888'));
392392

393393
return textArr;
394394
}

0 commit comments

Comments
 (0)