@microbiome-informatics/genome-properties-viewer 1.0.0-beta.1 → 1.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,16 +128,16 @@ export default class TaxonomyNodeManager {
128
128
  event.sourceEvent.stopPropagation();
129
129
  const g = d3.select(event.sourceEvent.target.closest("g.node"));
130
130
  if (d.has_loaded_leaves) {
131
- g.attr("transform", (p) => `translate(${p.x},${event.y})`);
131
+ g.attr("transform", (p) => `translate(${event.x},${p.y})`);
132
132
  }
133
133
  })
134
134
  .on("end", (event, d) => {
135
135
  if (d.has_loaded_leaves) {
136
136
  const g = d3.select(event.sourceEvent.target.closest("g.node"));
137
137
  const w = this.main.cell_side;
138
- const dy = event.y - d.y; // - w/2,
139
- const d_row = Math.round(dy / w);
140
- move_tree(d, d_row);
138
+ const dx = event.x - d.x;
139
+ const d_col = Math.round(dx / w);
140
+ move_tree(d, d_col);
141
141
  const time = d3.transition().duration(500);
142
142
  g.transition(time).attr(
143
143
  "transform",
@@ -169,10 +169,14 @@ export default class TaxonomyNodeManager {
169
169
 
170
170
  g.append("text")
171
171
  .attr("class", "label-species")
172
- .attr("x", -this.r / 2)
173
- .attr("y", this.r + 4)
174
- .style("text-anchor", "end")
175
- // .style("transform", "rotate(-70deg)")
172
+ .attr("x", this.r)
173
+ .attr("y", this.r)
174
+ .style("text-anchor", "start")
175
+ .attr("transform", (d) =>
176
+ d.children || d._children
177
+ ? `translate(0,${-this.r - 2})`
178
+ : "rotate(-70)"
179
+ )
176
180
  .style("fill", (d) => (d.data.isFromFile ? "darkred" : null))
177
181
  .text((d) => {
178
182
  let label = "";
@@ -23,6 +23,7 @@ export default class GenomePropertiesTaxonomy {
23
23
  this.svg = null;
24
24
  this.collapse_tree = true;
25
25
  this.show_tree = show_tree;
26
+ this.dataOffsetX = 0;
26
27
  this.dipatcher = d3.dispatch(
27
28
  "changeOrder",
28
29
  "spaciesRequested",
@@ -72,44 +73,46 @@ export default class GenomePropertiesTaxonomy {
72
73
  return this.nodes;
73
74
  }
74
75
 
75
- draw_tree_panel(svg) {
76
+ draw_tree_panel(svg, treeClipId = null) {
76
77
  this.svg = svg;
77
- this.tree_g = svg
78
+ this.tree_layer = svg.append("g").attr("class", "taxon_tree_layer");
79
+ if (treeClipId) {
80
+ this.tree_layer.attr("clip-path", `url(#${treeClipId})`);
81
+ }
82
+ this.tree_g = this.tree_layer
78
83
  .append("g")
79
84
  .attr("class", "taxon_tree")
80
85
  .attr("transform", `translate(${this.x}, ${this.y})`);
81
86
  this.node_manager.tree_g = this.tree_g;
82
87
  }
83
88
 
84
- // Walks the tree and calculates x,y values for each node
89
+ // Walks the tree and calculates x,y values for each node.
90
+ // Leaves run along X so they line up with species columns; depth runs down Y.
85
91
  tree(node, deepness = 0) {
86
92
  let avg = 0;
87
93
 
88
94
  if (node.has_loaded_leaves) {
89
95
  if (node.children) {
90
- // Intermediate nodes with leaves get located in the midle of the leaves
91
96
  for (const child of node.children) {
92
97
  this.tree(child, deepness + 1);
93
- avg += child.y;
98
+ avg += child.x;
94
99
  node.deepness =
95
100
  !node.deepness || child.deepness > node.deepness
96
101
  ? child.deepness
97
102
  : node.deepness;
98
103
  }
99
- node.y = avg / node.children.length;
104
+ node.x = avg / node.children.length;
105
+ const leafY = Math.max(0, this.height - this.y - this.cell_side);
106
+ node.y = (deepness / (node.deepness || 1)) * leafY;
100
107
  } else {
101
- // MAking sure it aligns with the heatmap
102
- node.y =
108
+ node.x =
109
+ (this.dataOffsetX || 0) +
103
110
  this.cell_side / 3 +
104
111
  this.cell_side *
105
112
  this.current_order.indexOf(this.organisms.indexOf(node.data.taxid));
106
- node.x = this.width - this.x;
113
+ node.y = Math.max(0, this.height - this.y - this.cell_side);
107
114
  node.deepness = deepness;
108
115
  }
109
- } else {
110
- const number_of_selected_org = this.organisms.length;
111
- const space_for_leaves = this.cell_side * number_of_selected_org;
112
- node.y = space_for_leaves / 2 + node.y;
113
116
  }
114
117
  }
115
118
 
@@ -231,7 +234,7 @@ export default class GenomePropertiesTaxonomy {
231
234
  }
232
235
 
233
236
  update_tree(time = 0, cell_side = null) {
234
- if (this.root === null) return;
237
+ if (this.root === null || !this.tree_g) return;
235
238
  if (cell_side !== null) this.cell_side = cell_side;
236
239
  this.tree_g.attr("transform", `translate(${this.x}, ${this.y})`);
237
240
 
@@ -263,6 +266,10 @@ export default class GenomePropertiesTaxonomy {
263
266
  .sort((a, b) => a.data.taxid - b.data.taxid);
264
267
  const ol = leaves.length;
265
268
  this.organisms = leaves.map((n) => n.data.taxid);
269
+ this.dataOffsetX = Math.max(
270
+ 0,
271
+ this.width - this.organisms.length * this.cell_side
272
+ );
266
273
 
267
274
  // Precompute the orders.
268
275
  this.orders = {
@@ -285,23 +292,22 @@ export default class GenomePropertiesTaxonomy {
285
292
  };
286
293
  if (!this.current_order || this.current_order.length !== leaves.length)
287
294
  this.current_order = this.orders.tree1;
288
- const tree_f = d3.tree().size([this.height, this.width - 2 * this.x]);
295
+ const layoutHeight = Math.max(
296
+ this.cell_side,
297
+ this.height - (this.y || 0) - this.cell_side
298
+ );
299
+ const tree_f = d3
300
+ .tree()
301
+ .size([Math.max(this.cell_side, this.width), layoutHeight]);
289
302
  tree_f(root);
290
- root.each((node) => {
291
- const { x, y } = node;
292
- node.y = x;
293
- node.x = y;
294
- });
295
303
  this.tree(root);
296
- const t = d3.transition().duration(time).delay(100);
297
- const visible_nodes = root
298
- .descendants()
299
- .filter(
300
- (d) =>
301
- d.data.expanded ||
302
- d.parent.data.expanded ||
303
- d.parent.has_loaded_leaves
304
+ const t = this.tree_g.transition().duration(time).delay(100);
305
+ const visible_nodes = root.descendants().filter((d) => {
306
+ if (!d.parent) return true;
307
+ return (
308
+ d.data.expanded || d.parent.data.expanded || d.parent.has_loaded_leaves
304
309
  );
310
+ });
305
311
 
306
312
  const link = this.tree_g
307
313
  .selectAll(".link")
@@ -317,8 +323,8 @@ export default class GenomePropertiesTaxonomy {
317
323
  .attr(
318
324
  "d",
319
325
  (d) =>
320
- `M${d.source.x},${d.source.y}H${d.source.x + 10}V${d.target.y}H${
321
- d.target.x
326
+ `M${d.source.x},${d.source.y}V${d.source.y + 10}H${d.target.x}V${
327
+ d.target.y
322
328
  }`
323
329
  );
324
330
 
@@ -330,8 +336,8 @@ export default class GenomePropertiesTaxonomy {
330
336
  .attr(
331
337
  "d",
332
338
  (d) =>
333
- `M${d.source.x},${d.source.y}H${d.source.x + 10}V${d.target.y}H${
334
- d.target.x
339
+ `M${d.source.x},${d.source.y}V${d.source.y + 10}H${d.target.x}V${
340
+ d.target.y
335
341
  }`
336
342
  )
337
343
  .style("stroke", (d) =>
package/src/gp-totals.js CHANGED
@@ -1,17 +1,16 @@
1
1
  import * as d3 from "./d3";
2
2
 
3
3
  export const drawTotalPerOrganismPanel = (viewer) => {
4
- // const ph = viewer.options.total_panel_height;
5
4
  viewer.total_g = viewer.mainGroup
6
5
  .append("g")
7
6
  .attr("class", "total-group")
8
- .attr(
9
- "transform",
10
- `translate(${
11
- viewer.options.width - viewer.options.dimensions.total.short_side / 2
12
- }, ${viewer.options.dimensions.total.short_side / 2}
13
- )`
14
- );
7
+ .attr("transform", "translate(0,0)");
8
+ };
9
+
10
+ export const drawRowTotalPanel = (viewer) => {
11
+ viewer.row_total_g = viewer.mainGroup
12
+ .append("g")
13
+ .attr("class", "row-total-group");
15
14
  };
16
15
 
17
16
  export const refreshGPTotals = (viewer) => {
@@ -40,13 +39,18 @@ const refreshOrganismTotals = (viewer) => {
40
39
  export const updateTotalPerOrganismPanel = (viewer) => {
41
40
  viewer.options.total_panel_height = viewer.options.cell_side;
42
41
  const ph = viewer.options.total_panel_height;
42
+ const heatmapBottom =
43
+ viewer.heatmapTop +
44
+ Math.min(
45
+ viewer.heatmapHeight(),
46
+ viewer.y(viewer.props?.length || 0) || viewer.heatmapHeight()
47
+ );
43
48
 
44
49
  viewer.total_g.attr(
45
50
  "transform",
46
51
  `translate(${
47
- viewer.options.width - viewer.options.dimensions.total.short_side / 2
48
- }, ${viewer.options.dimensions.total.short_side / 2}
49
- )`
52
+ viewer.heatmapAnchor + viewer.current_scroll.x
53
+ }, ${heatmapBottom})`
50
54
  );
51
55
 
52
56
  const arc_f = d3
@@ -68,14 +72,17 @@ export const updateTotalPerOrganismPanel = (viewer) => {
68
72
  (d) => d.key
69
73
  );
70
74
 
71
- const newY = d3
75
+ const newX = d3
72
76
  .scaleBand()
73
77
  .range([0, viewer.organisms.length * viewer.options.cell_side])
74
- .domain(viewer.current_order);
78
+ .domain(viewer.current_order || []);
75
79
 
76
80
  cells_t.attr(
77
81
  "transform",
78
- (d, i) => `translate(0, ${newY(i) + viewer.options.cell_side})`
82
+ (d, i) =>
83
+ `translate(${newX(i) + viewer.options.cell_side / 2}, ${
84
+ viewer.options.cell_side / 2
85
+ })`
79
86
  );
80
87
  cells_t.exit().remove();
81
88
 
@@ -85,7 +92,10 @@ export const updateTotalPerOrganismPanel = (viewer) => {
85
92
  .attr("class", "total_cell_org")
86
93
  .attr(
87
94
  "transform",
88
- (d, i) => `translate(0, ${newY(i) + viewer.options.cell_side})`
95
+ (d, i) =>
96
+ `translate(${newX(i) + viewer.options.cell_side / 2}, ${
97
+ viewer.options.cell_side / 2
98
+ })`
89
99
  )
90
100
  .on("mouseover", (event, p) => {
91
101
  d3.selectAll(".node--leaf text").classed(
@@ -115,3 +125,85 @@ export const updateTotalPerOrganismPanel = (viewer) => {
115
125
  .attr("d", arc_f)
116
126
  .style("fill", (d) => viewer.c[d.data.key]);
117
127
  };
128
+
129
+ export const updateRowTotalPanel = (viewer) => {
130
+ if (!viewer.row_total_g) return;
131
+ const side = viewer.options.cell_side;
132
+ const dataWidth = (viewer.organisms?.length || 0) * side;
133
+ const pieOffset = viewer.organisms?.length
134
+ ? Math.min(dataWidth, viewer.heatmapWidth())
135
+ : 0;
136
+
137
+ viewer.row_total_g.attr(
138
+ "transform",
139
+ `translate(${viewer.heatmapAnchor + pieOffset + side * 0.5}, ${
140
+ viewer.current_scroll.y
141
+ })`
142
+ );
143
+
144
+ const header = viewer.row_total_g
145
+ .selectAll("text.total_title")
146
+ .data(viewer.organisms?.length ? ["TOTAL"] : []);
147
+ header.exit().remove();
148
+ header
149
+ .enter()
150
+ .append("text")
151
+ .attr("class", "total_title")
152
+ .merge(header)
153
+ .attr("transform", `translate(0, ${viewer.heatmapTop - 6}) rotate(-70)`)
154
+ .attr("text-anchor", "start")
155
+ .text("TOTAL");
156
+
157
+ const props = viewer.current_props || [];
158
+ const dy = props.length ? Math.max(0, viewer.props.indexOf(props[0])) : 0;
159
+ const localY = (d, i) => viewer.heatmapTop + viewer.y(i + dy) + side * 0.5;
160
+
161
+ const cells_t = viewer.row_total_g
162
+ .selectAll(".total_cell")
163
+ .data(props, (d) => d.property);
164
+
165
+ cells_t.exit().remove();
166
+ cells_t.attr("transform", (d, i) => `translate(0, ${localY(d, i)})`);
167
+
168
+ const mouseover = (event, gp) => {
169
+ viewer.controller.draw_legends(gp.values.TOTAL);
170
+ viewer.controller.draw_tooltip(event, {
171
+ Property: gp.property,
172
+ Name: gp.name,
173
+ Organism: "All",
174
+ Value: `TOTAL: {YES: ${gp.values.TOTAL.YES}, PARTIAL: ${gp.values.TOTAL.PARTIAL}, NO: ${gp.values.TOTAL.NO}}`,
175
+ });
176
+ };
177
+ const mouseout = () => {
178
+ viewer.controller.draw_legends();
179
+ viewer.controller.draw_tooltip();
180
+ };
181
+
182
+ const entered = cells_t
183
+ .enter()
184
+ .append("g")
185
+ .attr("class", "total_cell")
186
+ .attr("transform", (d, i) => `translate(0, ${localY(d, i)})`)
187
+ .on("mouseover", mouseover)
188
+ .on("mouseout", mouseout);
189
+
190
+ const arc_f = d3
191
+ .arc()
192
+ .outerRadius(side * 0.4)
193
+ .innerRadius(0);
194
+ const pie_f = d3.pie().value((d) => d.value);
195
+
196
+ const group = entered.merge(cells_t);
197
+ const arcs = group.selectAll(".arc").data(
198
+ (d) => pie_f(d3.entries(d.values.TOTAL)),
199
+ (d) => d.data.key
200
+ );
201
+
202
+ arcs.attr("d", arc_f);
203
+ arcs
204
+ .enter()
205
+ .append("path")
206
+ .attr("class", "arc")
207
+ .attr("d", arc_f)
208
+ .style("fill", (d) => viewer.c[d.data.key]);
209
+ };
@@ -5,6 +5,9 @@ import * as d3 from "./d3";
5
5
  * @param {GernomeProperiesViewer} viewer - The instance of the genome properites viewer
6
6
  */
7
7
  export const createGradient = (viewer) => {
8
+ const uid = `gpv-${Math.random().toString(36).slice(2, 8)}`;
9
+ viewer.heatmapClipId = `${uid}-heatmap`;
10
+ viewer.treeClipId = `${uid}-tree`;
8
11
  const defs = viewer.mainGroup.append("defs");
9
12
  const gradient_left = defs
10
13
  .append("linearGradient")
@@ -23,6 +26,23 @@ export const createGradient = (viewer) => {
23
26
  .attr("offset", "100%")
24
27
  .attr("stop-color", "#fff")
25
28
  .attr("stop-opacity", 0.5);
29
+ const gradient_top = defs
30
+ .append("linearGradient")
31
+ .attr("id", "gradienttop")
32
+ .attr("x1", "0%")
33
+ .attr("y1", "0%")
34
+ .attr("x2", "0%")
35
+ .attr("y2", "100%");
36
+ gradient_top
37
+ .append("stop")
38
+ .attr("offset", "85%")
39
+ .attr("stop-color", "#fff")
40
+ .attr("stop-opacity", 1);
41
+ gradient_top
42
+ .append("stop")
43
+ .attr("offset", "100%")
44
+ .attr("stop-color", "#fff")
45
+ .attr("stop-opacity", 0.5);
26
46
  const gradient_right = defs
27
47
  .append("linearGradient")
28
48
  .attr("id", "gradientright")
@@ -45,10 +65,50 @@ export const createGradient = (viewer) => {
45
65
  .attr("offset", "35%")
46
66
  .attr("stop-color", "#fff")
47
67
  .attr("stop-opacity", 1);
68
+ const gradient_bottom = defs
69
+ .append("linearGradient")
70
+ .attr("id", "gradientbottom")
71
+ .attr("x1", "0%")
72
+ .attr("y1", "0%")
73
+ .attr("x2", "0%")
74
+ .attr("y2", "100%");
75
+ gradient_bottom
76
+ .append("stop")
77
+ .attr("offset", "0%")
78
+ .attr("stop-color", "#fff")
79
+ .attr("stop-opacity", 0);
80
+ gradient_bottom
81
+ .append("stop")
82
+ .attr("offset", "15%")
83
+ .attr("stop-color", "#fff")
84
+ .attr("stop-opacity", 0.5);
85
+ gradient_bottom
86
+ .append("stop")
87
+ .attr("offset", "35%")
88
+ .attr("stop-color", "#fff")
89
+ .attr("stop-opacity", 1);
90
+
91
+ viewer.heatmapClipPath = defs
92
+ .append("clipPath")
93
+ .attr("id", viewer.heatmapClipId);
94
+ viewer.heatmapClipPath
95
+ .append("rect")
96
+ .attr("x", viewer.heatmapLeft)
97
+ .attr("y", viewer.treeHeight)
98
+ .attr("width", Math.max(1, viewer.heatmapWidth()))
99
+ .attr("height", Math.max(1, viewer.heatmapHeight()));
100
+ viewer.treeClipPath = defs.append("clipPath").attr("id", viewer.treeClipId);
101
+ viewer.treeClipPath
102
+ .append("rect")
103
+ .attr("x", 0)
104
+ .attr("y", 0)
105
+ .attr("width", Math.max(1, viewer.options.width))
106
+ .attr("height", Math.max(1, viewer.treeHeight));
48
107
  };
108
+
49
109
  /**
50
110
  * Appends a new group element into the mainGroup of the viewer.
51
- * The group contains masks as rectangles to give the effect of new GP fading-in/out while horizontal scrolling
111
+ * The group contains masks as rectangles to give the effect of fading around the heatmap
52
112
  * @param {GernomeProperiesViewer} viewer - The instance of the genome properites viewer
53
113
  */
54
114
  export const drawMasks = (viewer) => {
@@ -56,10 +116,18 @@ export const drawMasks = (viewer) => {
56
116
  viewer.masks
57
117
  .append("rect")
58
118
  .attr("class", "tree-background background")
119
+ .style("fill", "url(#gradienttop)")
120
+ .attr("x", 0)
121
+ .attr("y", 0)
122
+ .attr("width", viewer.options.width)
123
+ .attr("height", viewer.treeHeight);
124
+ viewer.masks
125
+ .append("rect")
126
+ .attr("class", "label-background background")
59
127
  .style("fill", "url(#gradientleft)")
60
128
  .attr("x", 0)
61
129
  .attr("y", 0)
62
- .attr("width", viewer.options.dimensions.tree.width)
130
+ .attr("width", viewer.labelWidth)
63
131
  .attr("height", viewer.options.height);
64
132
  viewer.masks
65
133
  .append("rect")
@@ -72,12 +140,32 @@ export const drawMasks = (viewer) => {
72
140
  .attr("y", 0)
73
141
  .attr("width", viewer.options.dimensions.total.short_side * 1.2)
74
142
  .attr("height", viewer.options.height);
143
+ viewer.masks
144
+ .append("rect")
145
+ .attr("class", "bottom-background background")
146
+ .style("fill", "url(#gradientbottom)")
147
+ .attr("x", 0)
148
+ .attr(
149
+ "y",
150
+ viewer.options.height - viewer.options.dimensions.total.short_side * 1.2
151
+ )
152
+ .attr("width", viewer.options.width)
153
+ .attr("height", viewer.options.dimensions.total.short_side * 1.2);
75
154
  };
155
+
76
156
  /**
77
157
  * Update the size and position of the masks
78
158
  * @param {GernomeProperiesViewer} viewer - The instance of the genome properites viewer
79
159
  */
80
160
  export const updateMasks = (viewer) => {
161
+ viewer.masks
162
+ .select(".tree-background")
163
+ .attr("width", viewer.options.width)
164
+ .attr("height", viewer.treeHeight);
165
+ viewer.masks
166
+ .select(".label-background")
167
+ .attr("width", viewer.heatmapAnchor)
168
+ .attr("height", viewer.options.height);
81
169
  viewer.masks
82
170
  .select(".total-background")
83
171
  .attr(
@@ -87,64 +175,87 @@ export const updateMasks = (viewer) => {
87
175
  .attr("width", viewer.options.dimensions.total.short_side * 1.2)
88
176
  .attr("height", viewer.options.height);
89
177
  viewer.masks
90
- .select(".tree-background")
91
- .attr("y", 0)
92
- .attr("width", viewer.options.dimensions.tree.width)
93
- .attr("height", viewer.options.height);
178
+ .select(".bottom-background")
179
+ .attr(
180
+ "y",
181
+ viewer.options.height - viewer.options.dimensions.total.short_side * 1.2
182
+ )
183
+ .attr("width", viewer.options.width)
184
+ .attr("height", viewer.options.dimensions.total.short_side * 1.2);
185
+ if (viewer.heatmapClipPath) {
186
+ viewer.heatmapClipPath
187
+ .select("rect")
188
+ .attr("x", viewer.heatmapLeft)
189
+ .attr("y", viewer.heatmapTop)
190
+ .attr("width", viewer.heatmapWidth())
191
+ .attr("height", viewer.heatmapHeight());
192
+ }
193
+ if (viewer.treeClipPath) {
194
+ viewer.treeClipPath
195
+ .select("rect")
196
+ .attr("x", 0)
197
+ .attr("y", 0)
198
+ .attr("width", viewer.options.width)
199
+ .attr("height", viewer.treeHeight);
200
+ }
201
+ viewer.mainGroup
202
+ .select(".height-dragger")
203
+ .attr("transform", `translate(0, ${viewer.treeHeight})`);
204
+ viewer.mainGroup.select(".height-sizer").attr("x2", viewer.options.width);
94
205
  };
95
206
 
96
207
  /**
97
- * Draws a draggable area ||| to redifine the widthassigned to the tree.
208
+ * Draws a draggable area to redefine the height assigned to the taxonomy tree.
98
209
  * @param {GernomeProperiesViewer} viewer - The instance of the genome properites viewer
99
210
  */
100
211
  export const drawDragArea = (viewer) => {
101
- const xLimit = 90;
102
- let dx = 0;
212
+ const yLimit = 80;
213
+ let dy = 0;
103
214
  const g = viewer.mainGroup
104
215
  .append("g")
105
216
  .attr("class", "height-dragger")
106
- .attr("transform", `translate(${viewer.options.dimensions.tree.width}, 0)`)
217
+ .attr("transform", `translate(0, ${viewer.treeHeight})`)
107
218
  .call(
108
219
  d3
109
220
  .drag()
110
221
  .on("drag", (event) => {
111
222
  const treeSpace = viewer.options.dimensions.tree.width;
112
- // Forces limits for the drag
113
- dx = Math.min(
114
- Math.max(-treeSpace + event.x, xLimit - treeSpace),
115
- viewer.options.width - treeSpace
223
+ dy = Math.min(
224
+ Math.max(-treeSpace + event.y, yLimit - treeSpace),
225
+ viewer.options.height - treeSpace - 80
116
226
  );
117
- g.attr("transform", `translate(${dx + treeSpace}, 0)`);
227
+ g.attr("transform", `translate(0, ${dy + treeSpace})`);
118
228
  })
119
229
  .on("end", () => {
120
230
  const treeSpace = viewer.options.dimensions.tree.width;
121
- const new_width = treeSpace + dx;
122
- if (Number.isNaN(new_width)) return;
231
+ const new_height = treeSpace + dy;
232
+ if (Number.isNaN(new_height)) return;
123
233
  viewer.gp_taxonomy.dipatcher.call(
124
234
  "changeWidth",
125
235
  viewer.gp_taxonomy,
126
- new_width
236
+ new_height
127
237
  );
128
- g.attr("transform", `translate(${new_width}, 0)`);
129
- viewer.gp_taxonomy.width = new_width;
238
+ g.attr("transform", `translate(0, ${new_height})`);
239
+ viewer.gp_taxonomy.height = new_height;
130
240
  viewer.gp_taxonomy.update_tree();
131
241
  })
132
242
  );
133
243
  const side = viewer.options.cell_side / 2;
134
244
  g.append("rect")
135
- .attr("x", -side / 2)
136
- .attr("y", 0)
137
- .attr("width", side)
138
- .attr("height", side * 2)
245
+ .attr("x", 0)
246
+ .attr("y", -side / 2)
247
+ .attr("width", side * 2)
248
+ .attr("height", side)
139
249
  .style("fill", "transparent");
140
250
  for (let index = -1; index < 2; index++) {
141
251
  g.append("line")
142
- .attr("y1", side * 2)
143
- .attr("x1", (index * side) / 2)
144
- .attr("x2", (index * side) / 2)
252
+ .attr("x1", 0)
253
+ .attr("x2", side * 2)
254
+ .attr("y1", (index * side) / 2)
255
+ .attr("y2", (index * side) / 2)
145
256
  .style("stroke", "#333");
146
257
  }
147
258
  g.append("line")
148
259
  .attr("class", "height-sizer")
149
- .attr("y1", viewer.options.height);
260
+ .attr("x2", viewer.options.width);
150
261
  };