Skip to content

Commit

Permalink
yFiles for HTML 2.5.0.4 demos
Browse files Browse the repository at this point in the history
  • Loading branch information
michabaur committed Apr 27, 2023
1 parent 50ae3b6 commit 0f250e1
Show file tree
Hide file tree
Showing 38 changed files with 98 additions and 98 deletions.
2 changes: 1 addition & 1 deletion demos/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h2>Your browser does not support modern CSS</h2>
<div class="content-wide">
<div id="general-intro">
<p class="first-paragraph">
The <a href="https://www.yworks.com/products/yfiles-for-html">yFiles for HTML 2.5.0.3</a> demo applications are available in
The <a href="https://www.yworks.com/products/yfiles-for-html">yFiles for HTML 2.5.0.4</a> demo applications are available in
both JavaScript and TypeScript, with only a few exceptions.
</p>
<div class="js-only">
Expand Down
2 changes: 1 addition & 1 deletion demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ This folder and its subfolders contain demo applications which illustrate the di
<img src="resources/image/nodejs.png" alt="Node.js screenshot" width="128" height="96" /> | [Node.js](loading/nodejs) | Shows how to run a yFiles layout algorithm in a <a href='https://nodejs.org/' target='_blank'>Node.js&reg;</a> environment.
<img src="resources/image/amdloading.png" alt="AMD Loading screenshot" width="128" height="96" /> | [AMD Loading](loading/amdloading) | Loads the yFiles library modules with the AMD loading standard (require.js).
<img src="resources/image/esmodules.png" alt="ES Module Loading screenshot" width="128" height="96" /> | [ES Module Loading](loading/esmodules) | Loads the yFiles module resources using ES module imports.
<img src="resources/image/browserify.png" alt="Browserify screenshot" width="128" height="96" /> | [Browserify](loading/browserify/README.html) | Shows how to bundle the yFiles library in a <a href="http://browserify.org" target="_blank">Browserify</a> project.
<img src="resources/image/browserify.png" alt="Browserify screenshot" width="128" height="96" /> | [Browserify](loading/browserify/README.html) | Shows how to bundle the yFiles library in a <a href="https://browserify.org" target="_blank">Browserify</a> project.
<img src="resources/image/rollupjs.png" alt="Rollup.js screenshot" width="128" height="96" /> | [Rollup.js](loading/rollupjs/README.html) | Shows how to bundle the yFiles library in a <a href="https://rollupjs.org" target="_blank">rollup</a> project.
<img src="resources/image/scriptloading.png" alt="Script Loading screenshot" width="128" height="96" /> | [Script Loading](loading/scriptloading) | Loads the yFiles modules using plain old &lt;script&gt; tags.
<img src="resources/image/webworker.png" alt="Web Worker Webpack screenshot" width="128" height="96" /> | [Web Worker Webpack](loading/webworker-webpack/README.html) | Shows how to run a yFiles layout algorithm in a Web Worker task using Webpack.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//
////////////////////////////////////////////////////////////////////////-->

<!--Created by yFiles for HTML 2.5.0.3-->
<!--Created by yFiles for HTML 2.5.0.4-->
<graphml xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml.html/2.0/ygraphml.xsd " xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:y="http://www.yworks.com/xml/yfiles-common/3.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/3.0" xmlns:yjs="http://www.yworks.com/xml/yfiles-for-html/2.0/xaml" xmlns:x0="http://www.yworks.com/yFilesHTML/demos/FlatDemoStyle/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<yjs:Stroke x:Key="8" fill="{y:GraphMLReference 9}"/>
<graph id="G" edgedefault="directed">
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "demo-server-for-yfiles-for-html",
"version": "25.0.3",
"version": "25.0.4",
"description": "A Node.js Express server for the yFiles for HTML demos and tutorials.",
"author": "yWorks GmbH <[email protected]>",
"license": "https://www.yworks.com/products/yfiles-for-html/sla",
Expand Down
27 changes: 13 additions & 14 deletions demos/input/button-input-mode/ButtonInputMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,19 @@ export class ButtonInputMode extends InputModeBase {
* @type {!ILabelStyle}
*/
get focusedButtonStyle() {
return (this.buttonLabelManager?.descriptor).focusedButtonStyle
return this.buttonLabelManager.descriptor.focusedButtonStyle
}

/**
* @type {!ILabelStyle}
*/
set focusedButtonStyle(style) {
;(this.buttonLabelManager?.descriptor).focusedButtonStyle = style
this.buttonLabelManager.descriptor.focusedButtonStyle = style
}

constructor() {
super()
this.buttons = null
this.buttonLabelManager = null
this.queryButtonsListener = null
this.itemRemovedListener = this.onItemRemoved.bind(this)
this.onMouseMoveListener = this.onMouseMove.bind(this)
Expand Down Expand Up @@ -327,22 +326,23 @@ export class ButtonInputMode extends InputModeBase {
this.clearPending = false
this.priority = 0
this.exclusive = true
this.createButtonLabelCollectionModel()
this.buttonLabelManager = this.createButtonLabelCollectionModel()
this._cursor = Cursor.POINTER
this.tooltipMode.duration = TimeSpan.fromSeconds(5)
}

createButtonLabelCollectionModel() {
this.buttonLabelManager = new CollectionModelManager(Button.$class)
this.buttonLabelManager.descriptor = new ButtonDescriptor()
this.buttonLabelManager.model = new ObservableCollection()
const buttonLabelManager = new CollectionModelManager(Button.$class)
buttonLabelManager.descriptor = new ButtonDescriptor()
buttonLabelManager.model = new ObservableCollection()
return buttonLabelManager
}

/**
* @type {!ObservableCollection.<Button>}
*/
get buttonLabels() {
return this.buttonLabelManager?.model
return this.buttonLabelManager.model
}

/**
Expand Down Expand Up @@ -678,7 +678,7 @@ export class ButtonInputMode extends InputModeBase {
* @param {!Point} location
*/
updateHoveredItem(location) {
const hitItem = this.getHitItem(this.inputModeContext?.canvasComponent, location)
const hitItem = this.getHitItem(location)
if (hitItem != this.hoveredOwner) {
// hovered model item has changed
if (hitItem) {
Expand Down Expand Up @@ -726,10 +726,10 @@ export class ButtonInputMode extends InputModeBase {
* @type {?Button}
*/
set focusedButton(focusedButton) {
;(this.buttonLabelManager?.descriptor).focusedButton = focusedButton
this.buttonLabelManager.descriptor.focusedButton = focusedButton
this._focusedButton = focusedButton
if (focusedButton) {
this.buttonLabelManager?.update(focusedButton)
this.buttonLabelManager.update(focusedButton)
}
this.inputModeContext?.canvasComponent?.invalidate()
}
Expand All @@ -755,7 +755,7 @@ export class ButtonInputMode extends InputModeBase {
this.triggerAction(hitButton)
}
} else if (rightClick && this.buttonTrigger === ButtonTrigger.RIGHT_CLICK) {
const hitItem = this.getHitItem(sender, evt.location)
const hitItem = this.getHitItem(evt.location)
if (hitItem && hitItem != this.buttonOwner) {
this.showButtons(hitItem)
} else {
Expand Down Expand Up @@ -822,10 +822,9 @@ export class ButtonInputMode extends InputModeBase {
}

/**
* @param {!GraphComponent} graphComponent
* @param {!Point} location
*/
getHitItem(graphComponent, location) {
getHitItem(location) {
const context = this.inputModeContext
const hitTester = context.lookup(IHitTester.$class)
let hitItem = hitTester
Expand Down
44 changes: 21 additions & 23 deletions demos/input/button-input-mode/ButtonInputMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export enum ButtonTrigger {
*/
export class ButtonInputMode extends InputModeBase {
private buttons: Button[] | null = null
private buttonLabelManager: CollectionModelManager<Button> | null = null
private buttonLabelManager: CollectionModelManager<Button>
private queryButtonsListener: QueryButtonsListener | null = null
private itemRemovedListener = this.onItemRemoved.bind(this)
private onMouseMoveListener = this.onMouseMove.bind(this)
Expand Down Expand Up @@ -295,30 +295,31 @@ export class ButtonInputMode extends InputModeBase {
* Using the {@link Key.TAB} the focus can be moved to the next button.
*/
get focusedButtonStyle(): ILabelStyle {
return (this.buttonLabelManager?.descriptor as ButtonDescriptor).focusedButtonStyle
return (this.buttonLabelManager.descriptor as ButtonDescriptor).focusedButtonStyle
}

set focusedButtonStyle(style: ILabelStyle) {
;(this.buttonLabelManager?.descriptor as ButtonDescriptor).focusedButtonStyle = style
;(this.buttonLabelManager.descriptor as ButtonDescriptor).focusedButtonStyle = style
}

constructor() {
super()
this.priority = 0
this.exclusive = true
this.createButtonLabelCollectionModel()
this.buttonLabelManager = this.createButtonLabelCollectionModel()
this._cursor = Cursor.POINTER
this.tooltipMode.duration = TimeSpan.fromSeconds(5)
}

private createButtonLabelCollectionModel() {
this.buttonLabelManager = new CollectionModelManager<Button>(Button.$class)
this.buttonLabelManager.descriptor = new ButtonDescriptor()
this.buttonLabelManager.model = new ObservableCollection<Button>()
const buttonLabelManager = new CollectionModelManager<Button>(Button.$class)
buttonLabelManager.descriptor = new ButtonDescriptor()
buttonLabelManager.model = new ObservableCollection<Button>()
return buttonLabelManager
}

private get buttonLabels(): ObservableCollection<Button> {
return this.buttonLabelManager?.model as ObservableCollection<Button>
return this.buttonLabelManager.model as ObservableCollection<Button>
}

/**
Expand Down Expand Up @@ -358,7 +359,7 @@ export class ButtonInputMode extends InputModeBase {
// get the bounding rectangle around all the buttons in this set
const wholeBounds = this.buttons.reduce((previousValue, currentValue) => {
const boundsProvider =
this.buttonLabelManager!.descriptor!.getBoundsProvider(currentValue)
this.buttonLabelManager.descriptor!.getBoundsProvider(currentValue)
return Rect.add(previousValue, boundsProvider.getBounds(canvasContext))
}, Rect.EMPTY)
// get the bounds for the owner of the buttons
Expand Down Expand Up @@ -442,7 +443,7 @@ export class ButtonInputMode extends InputModeBase {

private getHitButtons(context: IInputModeContext, location: Point) {
return context
.canvasComponent!.hitElementsAt(context, location, this.buttonLabelManager!.canvasObjectGroup)
.canvasComponent!.hitElementsAt(context, location, this.buttonLabelManager.canvasObjectGroup)
.map(canvasObject => canvasObject.userObject as Button)
}

Expand All @@ -453,7 +454,7 @@ export class ButtonInputMode extends InputModeBase {
install(context: IInputModeContext, controller: ConcurrencyController) {
super.install(context, controller)
const graphComponent = context.canvasComponent as GraphComponent
this.buttonLabelManager!.canvasObjectGroup = graphComponent.inputModeGroup.addGroup()
this.buttonLabelManager.canvasObjectGroup = graphComponent.inputModeGroup.addGroup()
graphComponent.addMouseMoveListener(this.onMouseMoveListener)
graphComponent.addMouseDragListener(this.onMouseDragListener)
graphComponent.addMouseLeaveListener(this.onMouseMoveListener)
Expand Down Expand Up @@ -493,7 +494,7 @@ export class ButtonInputMode extends InputModeBase {
graphComponent.removeMouseDragListener(this.onMouseDragListener)
graphComponent.removeMouseLeaveListener(this.onMouseMoveListener)
this.updateHoveredButton(null)
this.buttonLabelManager!.canvasObjectGroup!.remove()
this.buttonLabelManager.canvasObjectGroup!.remove()
super.uninstall(context)
}

Expand Down Expand Up @@ -573,9 +574,9 @@ export class ButtonInputMode extends InputModeBase {
const tooltipWorldSize = this.calculateTooltipWorldSize(button.tooltip)

// get the bounds of the button using the ButtonDescriptor
const buttonBounds = this.buttonLabelManager!.descriptor!.getBoundsProvider(button).getBounds(
this.inputModeContext!.canvasComponent!.canvasContext
)
const buttonBounds = this.buttonLabelManager
.descriptor!.getBoundsProvider(button)
.getBounds(this.inputModeContext!.canvasComponent!.canvasContext)

// horizontally the tooltip is centered with the button center
const x = buttonBounds.centerX - tooltipWorldSize.width / 2
Expand Down Expand Up @@ -618,10 +619,7 @@ export class ButtonInputMode extends InputModeBase {
}

private updateHoveredItem(location: Point) {
const hitItem = this.getHitItem(
this.inputModeContext?.canvasComponent as GraphComponent,
location
)
const hitItem = this.getHitItem(location)
if (hitItem != this.hoveredOwner) {
// hovered model item has changed
if (hitItem) {
Expand Down Expand Up @@ -665,10 +663,10 @@ export class ButtonInputMode extends InputModeBase {
* @param focusedButton The button to focus or `null` if no button shall be focused.
*/
public set focusedButton(focusedButton: Button | null) {
;(this.buttonLabelManager?.descriptor as ButtonDescriptor).focusedButton = focusedButton
;(this.buttonLabelManager.descriptor as ButtonDescriptor).focusedButton = focusedButton
this._focusedButton = focusedButton
if (focusedButton) {
this.buttonLabelManager?.update(focusedButton)
this.buttonLabelManager.update(focusedButton)
}
this.inputModeContext?.canvasComponent?.invalidate()
}
Expand All @@ -687,7 +685,7 @@ export class ButtonInputMode extends InputModeBase {
this.triggerAction(hitButton)
}
} else if (rightClick && this.buttonTrigger === ButtonTrigger.RIGHT_CLICK) {
const hitItem = this.getHitItem(sender as GraphComponent, evt.location)
const hitItem = this.getHitItem(evt.location)
if (hitItem && hitItem != this.buttonOwner) {
this.showButtons(hitItem)
} else {
Expand Down Expand Up @@ -738,7 +736,7 @@ export class ButtonInputMode extends InputModeBase {
button.onAction(button)
}

private getHitItem(graphComponent: GraphComponent, location: Point) {
private getHitItem(location: Point) {
const context = this.inputModeContext!
const hitTester = context.lookup(IHitTester.$class) as IHitTester<IModelItem>
let hitItem: IModelItem | null = hitTester
Expand Down
20 changes: 11 additions & 9 deletions demos/layout/custom-layout-stage/MoveNodesAsideStage.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ export default class MoveNodesAsideStage extends LayoutStageBase {

const asideNodes = []

for (const node of graph.nodes) {
// For each node, get the original node and see whether the tag specifies that it
// should be handled specially.
const iNode = originalNodeDp?.get(node)
if (iNode?.tag?.moveAside) {
// If so, hide the node for now ...
hider.hide(node)
// ... and remember it for later use
asideNodes.push(node)
if (originalNodeDp) {
for (const node of graph.nodes) {
// For each node, get the original node and see whether the tag specifies that it
// should be handled specially.
const iNode = originalNodeDp.get(node)
if (iNode?.tag?.moveAside) {
// If so, hide the node for now ...
hider.hide(node)
// ... and remember it for later use
asideNodes.push(node)
}
}
}

Expand Down
20 changes: 11 additions & 9 deletions demos/layout/custom-layout-stage/MoveNodesAsideStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ export default class MoveNodesAsideStage extends LayoutStageBase {

const asideNodes: YNode[] = []

for (const node of graph.nodes) {
// For each node, get the original node and see whether the tag specifies that it
// should be handled specially.
const iNode = originalNodeDp?.get(node) as INode
if (iNode?.tag?.moveAside) {
// If so, hide the node for now ...
hider.hide(node)
// ... and remember it for later use
asideNodes.push(node)
if (originalNodeDp) {
for (const node of graph.nodes) {
// For each node, get the original node and see whether the tag specifies that it
// should be handled specially.
const iNode = originalNodeDp.get(node) as INode | null
if (iNode?.tag?.moveAside) {
// If so, hide the node for now ...
hider.hide(node)
// ... and remember it for later use
asideNodes.push(node)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion demos/layout/layoutstyles/resources/edge-labels.graphml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//
////////////////////////////////////////////////////////////////////////-->

<!--Created by yFiles for HTML 2.5.0.3-->
<!--Created by yFiles for HTML 2.5.0.4-->
<graphml xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml.html/2.0/ygraphml.xsd " xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:y="http://www.yworks.com/xml/yfiles-common/3.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/3.0" xmlns:yjs="http://www.yworks.com/xml/yfiles-for-html/2.0/xaml" xmlns:x0="http://www.yworks.com/yFilesHTML/demos/FlatDemoStyle/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<key id="d0" for="node" attr.name="NodeLabels" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/NodeLabels"/>
<key id="d1" for="node" attr.name="NodeGeometry" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/NodeGeometry"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
////////////////////////////////////////////////////////////////////////-->
<!--Created by yFiles for HTML 2.5.0.3-->
<!--Created by yFiles for HTML 2.5.0.4-->
<graphml
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml.html/2.0/ygraphml.xsd "
xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:y="http://www.yworks.com/xml/yfiles-common/3.0"
Expand Down
2 changes: 1 addition & 1 deletion demos/loading/browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "browserify ./src/browserify-demo.js -o ./dist/bundle.js"
},
"dependencies": {
"yfiles-umd": "../../../lib-dev/yfiles-umd-25.0.3+dev.tgz",
"yfiles-umd": "../../../lib-dev/yfiles-umd-25.0.4+dev.tgz",
"color": "4.2.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion demos/loading/nodejs/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"dependencies": {
"express": "4.18.1",
"body-parser": "1.20.0",
"yfiles-umd": "../../../../lib-dev/yfiles-umd-25.0.3+dev.tgz"
"yfiles-umd": "../../../../lib-dev/yfiles-umd-25.0.4+dev.tgz"
}
}
6 changes: 3 additions & 3 deletions demos/loading/rollupjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"private": true,
"scripts": {
"postinstall": "node -e \"require('fs').copyFileSync('../../../lib/license.json','./src/license.json');\"",
"build": "node --max-old-space-size=4096 ./node_modules/grunt/bin/grunt",
"production": "node --max-old-space-size=4096 ./node_modules/grunt/bin/grunt production"
"build": "node --max-old-space-size=8000 ./node_modules/grunt/bin/grunt",
"production": "node --max-old-space-size=8000 ./node_modules/grunt/bin/grunt production"
},
"devDependencies": {
"@babel/core": "^7.18.5",
Expand All @@ -29,6 +29,6 @@
"core-js": "^3.23.1",
"regenerator-runtime": "^0.13.9",
"unfetch": "^4.2.0",
"yfiles": "../../../lib-dev/yfiles-25.0.3+dev.tgz"
"yfiles": "../../../lib-dev/yfiles-25.0.4+dev.tgz"
}
}
2 changes: 0 additions & 2 deletions demos/loading/rollupjs/src/RollupJsDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const layoutWorker = new LayoutWorker()

License.value = license

enableWorkarounds()

// Create a GraphComponent and enable interactive editing
const graphComponent = new GraphComponent('graphComponent')
const graph = graphComponent.graph
Expand Down
2 changes: 1 addition & 1 deletion demos/loading/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"devDependencies": {
"typescript": "^4.9.5",
"vite": "^4.1.1",
"yfiles": "../../../lib-dev/yfiles-25.0.3+dev.tgz"
"yfiles": "../../../lib-dev/yfiles-25.0.4+dev.tgz"
}
}
Loading

0 comments on commit 0f250e1

Please sign in to comment.