1
1
import Ember from 'ember' ;
2
2
3
- // Import the D3 packages we want to use
4
- import { select , event } from 'd3-selection' ;
5
- import { cluster , hierarchy } from 'd3-hierarchy' ;
6
- import { zoom , zoomIdentity } from 'd3-zoom' ;
7
-
8
- const { run, get, inject } = Ember ;
3
+ const {
4
+ select,
5
+ hierarchy,
6
+ cluster,
7
+ zoom,
8
+ zoomIdentity
9
+ } = self . d3 ;
10
+
11
+ const { inject } = Ember ;
12
+ import { run } from '@ember/runloop' ;
13
+ import { get } from '@ember/object' ;
14
+ import Component from '@ember/component' ;
9
15
10
16
const DURATION = 500 ;
11
17
12
18
// The offset amount (in px) from the left or right side of a node
13
19
// box to offset lines between nodes, so the lines don't come right
14
20
// up to the edge of the box.
15
- const NODE_OFFSET_SIZE = 50 ;
21
+ const NODE_OFFSET_SIZE = 50 ;
16
22
17
23
// copied these functions temporarily from `broccoli-viz` here:
18
24
// https://github.com/ember-cli/broccoli-viz/blob/master/lib/node-by-id.js
19
25
20
- export default Ember . Component . extend ( {
26
+ export default Component . extend ( {
21
27
classNames : [ 'basic-tree' ] ,
22
28
23
29
graph : inject . service ( ) ,
@@ -120,7 +126,7 @@ export default Ember.Component.extend({
120
126
// for debugging
121
127
self . root = root ;
122
128
123
- // Create the graph. The nodeSize() is [8,280] (width, height) because we
129
+ // Create the graph. The nodeSize() is [8,280] (width, height) because we
124
130
// want to change the orientation of the graph from top-down to left-right.
125
131
// To do that we reverse X and Y for calculations and translations.
126
132
let graph = cluster ( )
@@ -177,7 +183,7 @@ export default Ember.Component.extend({
177
183
. style ( 'fill' , "#fff" ) ;
178
184
179
185
// Draw a box in a separate color for the first line as
180
- // a 'title'.
186
+ // a 'title'.
181
187
nodeEnter . append ( "rect" )
182
188
. attr ( 'x' , 0 )
183
189
. attr ( 'y' , '-2em' )
@@ -258,7 +264,7 @@ export default Ember.Component.extend({
258
264
. attr ( "d" , function ( d ) {
259
265
let sourceExitY = d . source . y + d . source . computedWidth + NODE_OFFSET_SIZE ;
260
266
let targetEntranceY = d . target . y - NODE_OFFSET_SIZE ;
261
-
267
+
262
268
return "M" + d . target . y + "," + d . target . x
263
269
+ "L" + targetEntranceY + "," + d . target . x
264
270
+ " " + sourceExitY + "," + d . target . x
@@ -272,7 +278,7 @@ export default Ember.Component.extend({
272
278
. attr ( "d" , function ( d ) {
273
279
let sourceExitY = d . source . y + d . source . computedWidth + NODE_OFFSET_SIZE ;
274
280
let targetEntranceY = d . target . y - NODE_OFFSET_SIZE ;
275
-
281
+
276
282
return "M" + d . target . y + "," + d . target . x
277
283
+ "L" + targetEntranceY + "," + d . target . x
278
284
+ " " + sourceExitY + "," + d . target . x
0 commit comments