Skip to content

Commit 9f2e9a6

Browse files
author
angusforbes
committed
Increases rendering speed, optimizes svg drawing. Fixes some bugs when
moving handles really quickly. Fixes bugs when adjusting rows.
1 parent f836edf commit 9f2e9a6

File tree

5 files changed

+935
-570
lines changed

5 files changed

+935
-570
lines changed

index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,23 @@
136136

137137

138138
// 1. create Words and Links objects (in utils.js) */
139-
var wordObjs = createTestWords(12, 5, 11);
139+
var wordObjs = createTestWords(13, 5, 11);
140140
//var wordObjs = [];
141141
//wordObjs.push(new Word("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0));
142142
//wordObjs.push(new Word("bbbbbbbbbbbbbbbbbbbbbbbbbb", 1));
143143

144144

145-
//var linkObjs = createTestLinks(0, 0, 0);
146-
var linkObjs = createTestLinks(3, 3, 3);
145+
//var linkObjs = createTestLinks(1,1,0);
146+
var linkObjs = createTestLinks(4,4,4);
147+
147148

148149
// 2. draw words and boxes around words
149150
drawWords(wordObjs);
150151

151152
// 3. draw each of the links
153+
var hidePercentage = 3;
154+
var hidePercentage2 = 7;
155+
152156
drawLinks(linkObjs);
153157

154158
var prevWidth = svgWidth;

js/annotate.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,53 @@ class Link {
3131
this.te = types.LINK;
3232
}
3333

34+
this.arrow1Style;
35+
this.arrow2Style;
36+
37+
this.arrow1 = null;
38+
this.arrow2 = null;
39+
40+
if (this.direction == directions.FORWARD) {
41+
this.arrow1Style = new ArrowStyle(0, -3, circleArrowPath, new FillStyle('#000000', 1.0));
42+
this.arrow2Style = new ArrowStyle(0, -1, downArrowPath, new FillStyle('#000000', 1.0));
43+
;
44+
} else if (this.direction == directions.BACKWARD) {
45+
this.arrow1Style = new ArrowStyle(0, -1, downArrowPath, new FillStyle('#000000', 1.0));
46+
this.arrow2Style = new ArrowStyle(0, -3, circleArrowPath, new FillStyle('#000000', 1.0));
47+
} else if (this.direction == directions.BOTH) {
48+
this.arrow1Style = new ArrowStyle(0, -1, downArrowPath, new FillStyle('#000000', 1.0));
49+
this.arrow2Style = new ArrowStyle(0, -1, downArrowPath, new FillStyle('#000000', 1.0));
50+
} else { //NONE
51+
this.arrow1Style = new ArrowStyle(0, -3, circleArrowPath, new FillStyle('#000000', 1.0));
52+
this.arrow2Style = new ArrowStyle(0, -3, circleArrowPath, new FillStyle('#000000', 1.0));
53+
}
54+
55+
3456
this.x1percent = 0.0;
3557
this.x2percent = 0.0;
3658

59+
60+
this.needsUpdate = true;
61+
62+
this.numLineSegments = 0;
63+
this.polylines = [];
64+
this.polylineSVGs = []; //null;
65+
this.labels = [];
66+
this.labelRectSVGs = [];
67+
this.labelTextSVGs = [];
68+
69+
//this.polyline = null;
70+
//this.polylineSVG = null;
71+
this.label = null;
72+
this.labelRectSVG = null;
73+
this.labelTextSVG = null;
74+
//this.arrow1SVG = null;
75+
//this.arrow2SVG = null;
76+
77+
78+
79+
80+
3781
//this.rootMinWord
3882
//this.rootMaxWord
3983

@@ -121,6 +165,8 @@ class Word {
121165

122166

123167
//used for calculating positions during drag
168+
//this.needsUpdate = true;
169+
124170
this.tempX = 0.0;
125171
this.tempW = 0.0;
126172
this.tempY = 0.0;

0 commit comments

Comments
 (0)