Skip to content

Commit 4bf1663

Browse files
committed
yFiles for HTML 2.2.0.2 demos
1 parent 1f99fcf commit 4bf1663

File tree

532 files changed

+40413
-9002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

532 files changed

+40413
-9002
lines changed

demos/01-tutorial-getting-started/03-managing-viewport/SampleApplication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
ExteriorLabelModel,
3131
FreeNodePortLocationModel,
3232
GraphComponent,
33+
GraphOverviewComponent,
3334
ICommand,
3435
IGraph,
3536
License,

demos/01-tutorial-getting-started/04-setting-styles/SampleApplication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
Fill,
3434
FreeNodePortLocationModel,
3535
GraphComponent,
36+
GraphOverviewComponent,
3637
ICommand,
3738
IGraph,
3839
License,

demos/01-tutorial-getting-started/05-label-placement/SampleApplication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
ExteriorLabelModelPosition,
3333
FreeNodePortLocationModel,
3434
GraphComponent,
35+
GraphOverviewComponent,
3536
ICommand,
3637
IGraph,
3738
Insets,

demos/01-tutorial-getting-started/06-basic-interaction/SampleApplication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
FreeNodePortLocationModel,
3434
GraphComponent,
3535
GraphEditorInputMode,
36+
GraphOverviewComponent,
3637
ICommand,
3738
IGraph,
3839
InteriorLabelModel,

demos/01-tutorial-getting-started/07-undo-clipboard-support/SampleApplication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
FreeNodePortLocationModel,
3434
GraphComponent,
3535
GraphEditorInputMode,
36+
GraphOverviewComponent,
3637
ICommand,
3738
IGraph,
3839
InteriorLabelModel,

demos/01-tutorial-getting-started/08-grouping/SampleApplication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
FreeNodePortLocationModel,
3434
GraphComponent,
3535
GraphEditorInputMode,
36+
GraphOverviewComponent,
3637
ICommand,
3738
IGraph,
3839
InteriorLabelModel,

demos/01-tutorial-getting-started/09-data-binding/SampleApplication.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
GraphComponent,
3535
GraphEditorInputMode,
3636
GraphItemTypes,
37+
GraphOverviewComponent,
3738
ICommand,
3839
IGraph,
3940
IMapper,
@@ -45,7 +46,8 @@ import {
4546
PanelNodeStyle,
4647
Point,
4748
ShapeNodeStyle,
48-
Size
49+
Size,
50+
ToolTipQueryEventArgs
4951
} from 'yfiles'
5052

5153
import ContextMenu from '../../utils/ContextMenu.js'
@@ -157,15 +159,15 @@ function setupTooltips() {
157159
graphEditorInputMode.toolTipItems = GraphItemTypes.NODE
158160
graphEditorInputMode.addQueryItemToolTipListener((src, eventArgs) => {
159161
if (eventArgs.handled) {
160-
// A tooltip has already been assigned -> nothing to do.
162+
// Tooltip content has already been assigned -> nothing to do.
161163
return
162164
}
163165
const item = eventArgs.item
164166
if (INode.isInstance(item)) {
165-
// Set the tooltip.
167+
// Set the tooltip content.
166168
eventArgs.toolTip = dateMapper.get(item).toLocaleString()
167169

168-
// Indicate that the tooltip has been set.
170+
// Indicate that the tooltip content has been set.
169171
eventArgs.handled = true
170172
}
171173
})

demos/01-tutorial-getting-started/10-layout/SampleApplication.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
GraphComponent,
3636
GraphEditorInputMode,
3737
GraphItemTypes,
38+
GraphOverviewComponent,
3839
HierarchicLayout,
3940
ICommand,
4041
IGraph,
@@ -49,7 +50,8 @@ import {
4950
Point,
5051
Rect,
5152
ShapeNodeStyle,
52-
Size
53+
Size,
54+
ToolTipQueryEventArgs
5355
} from 'yfiles'
5456

5557
import ContextMenu from '../../utils/ContextMenu.js'
@@ -158,35 +160,31 @@ function createSampleGraph() {
158160
nodeIdBinding: 'id',
159161
nodeLabelBinding: 'label',
160162
groupBinding: 'parent',
161-
groupIdBinding: 'id',
162-
locationXBinding: data => data.layout.x,
163-
locationYBinding: data => data.layout.y
163+
groupIdBinding: 'id'
164164
})
165165

166166
builder.buildGraph()
167167

168-
// Sets the sizes of the nodes
168+
// Sets the layout of the nodes
169169
graph.nodes.forEach(node => {
170-
node.layout.width = node.tag.layout.width
171-
node.layout.height = node.tag.layout.height
170+
graph.setNodeLayout(node, Rect.from(node.tag.layout))
172171
})
173172

174173
// Iterate the edge data and create the according bends and Ports
175174
graph.edges.forEach(edge => {
176175
if (edge.tag.bends) {
177176
edge.tag.bends.forEach(bend => {
178-
graph.addBend(edge, new Point(bend.x, bend.y))
177+
graph.addBend(edge, Point.from(bend))
179178
})
180179
}
181-
graph.setPortLocation(edge.sourcePort, new Point(edge.tag.sourcePort.x, edge.tag.sourcePort.y))
182-
graph.setPortLocation(edge.targetPort, new Point(edge.tag.targetPort.x, edge.tag.targetPort.y))
180+
graph.setPortLocation(edge.sourcePort, Point.from(edge.tag.sourcePort))
181+
graph.setPortLocation(edge.targetPort, Point.from(edge.tag.targetPort))
183182
})
184183

185184
// Sets the location of the groups
186185
graph.nodes.forEach(node => {
187186
if (graph.isGroupNode(node)) {
188-
const layout = node.tag.layout
189-
graph.setNodeLayout(node, new Rect(layout.x, layout.y, layout.width, layout.height))
187+
graph.setNodeLayout(node, Rect.from(node.tag.layout))
190188
}
191189
})
192190
}
@@ -237,15 +235,15 @@ function setupTooltips() {
237235
graphEditorInputMode.toolTipItems = GraphItemTypes.NODE
238236
graphEditorInputMode.addQueryItemToolTipListener((src, eventArgs) => {
239237
if (eventArgs.handled) {
240-
// A tooltip has already been assigned -> nothing to do.
238+
// Tooltip content has already been assigned -> nothing to do.
241239
return
242240
}
243241
const item = eventArgs.item
244242
if (INode.isInstance(item)) {
245-
// Set the tooltip.
243+
// Set the tooltip content.
246244
eventArgs.toolTip = dateMapper.get(item).toLocaleString()
247245

248-
// Indicate that the tooltip has been set.
246+
// Indicate that the tooltip content has been set.
249247
eventArgs.handled = true
250248
}
251249
})

demos/01-tutorial-getting-started/11-layout-data/SampleApplication.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
GraphBuilder,
3434
GraphComponent,
3535
GraphEditorInputMode,
36+
GraphOverviewComponent,
3637
HierarchicLayout,
3738
HierarchicLayoutData,
3839
HierarchicLayoutNodeLayoutDescriptor,
@@ -163,35 +164,31 @@ function createSampleGraph() {
163164
nodeIdBinding: 'id',
164165
nodeLabelBinding: 'alignment',
165166
groupBinding: 'parent',
166-
groupIdBinding: 'id',
167-
locationXBinding: data => data.layout.x,
168-
locationYBinding: data => data.layout.y
167+
groupIdBinding: 'id'
169168
})
170169

171170
builder.buildGraph()
172171

173172
// Sets the sizes of the nodes
174173
graph.nodes.forEach(node => {
175-
node.layout.width = node.tag.layout.width
176-
node.layout.height = node.tag.layout.height
174+
graph.setNodeLayout(node, Rect.from(node.tag.layout))
177175
})
178176

179177
// Iterate the edge data and create the according bends and Ports
180178
graph.edges.forEach(edge => {
181179
if (edge.tag.bends) {
182180
edge.tag.bends.forEach(bend => {
183-
graph.addBend(edge, new Point(bend.x, bend.y))
181+
graph.addBend(edge, Point.from(bend))
184182
})
185183
}
186-
graph.setPortLocation(edge.sourcePort, new Point(edge.tag.sourcePort.x, edge.tag.sourcePort.y))
187-
graph.setPortLocation(edge.targetPort, new Point(edge.tag.targetPort.x, edge.tag.targetPort.y))
184+
graph.setPortLocation(edge.sourcePort, Point.from(edge.tag.sourcePort))
185+
graph.setPortLocation(edge.targetPort, Point.from(edge.tag.targetPort))
188186
})
189187

190188
// Sets the location of the groups
191189
graph.nodes.forEach(node => {
192190
if (graph.isGroupNode(node)) {
193-
const layout = node.tag.layout
194-
graph.setNodeLayout(node, new Rect(layout.x, layout.y, layout.width, layout.height))
191+
graph.setNodeLayout(node, Rect.from(node.tag.layout))
195192
}
196193
})
197194

0 commit comments

Comments
 (0)