Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

name: 💬 Auto Comment
on: [issues, pull_request_target]
permissions:
contents: read
issues: write
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v3
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pr-label-file-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@

name: 🏷️ Label(File Paths)
on: pull_request_target
permissions:
contents: read
pull-requests: write
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: actions/labeler@v4
with:
repo-token: ${{ env.bot_token }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/workflows/config/pr-label-file-paths.yml
10 changes: 4 additions & 6 deletions .github/workflows/pr-label-patch-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

name: 🏷️ Label(Patch Size)
on: pull_request_target
permissions:
contents: read
pull-requests: write
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wow-actions/use-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORED: "!.gitignore\nyarn.lock"
10 changes: 4 additions & 6 deletions .github/workflows/pr-label-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ on:
workflow_run:
workflows: ['🏷️ Label(Status) Dummy'] # the workflow in step 1
types: [requested]
permissions:
contents: read
pull-requests: write
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/pr-triage@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_ID: ${{ github.event.workflow_run.id }}
2 changes: 1 addition & 1 deletion .github/workflows/update-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v3
Expand Down
106 changes: 100 additions & 6 deletions examples/x6-example-features/src/pages/undo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,46 @@ export default class Example extends React.Component<
container: this.container,
width: 800,
height: 600,
grid: true,
history: true,
grid: {
size: 10,
visible: true,
type: 'doubleMesh',
args: [
{
color: '#e6e6e6',
thickness: 1
},
{
color: '#ddd',
thickness: 1,
factor: 4
}
]
},
history: {
enabled: true,
beforeAddCommand(event, args) {
if (args && 'options' in args && args.options) {
return args.options.ignore !== true
}
}
},
selecting: {
enabled: true
},
embedding: {
enabled: true,
findParent({ node }) {
const bbox = node.getBBox()
return this.getNodes().filter((node) => {
const data = node.getData<any>()
if (data && data.parent) {
const targetBBox = node.getBBox()
return bbox.isIntersectWithRect(targetBBox)
}
return false
})
}
},
})

Expand All @@ -42,6 +78,7 @@ export default class Example extends React.Component<
y: 120,
width: 100,
height: 40,
zIndex: 10,
attrs: {
label: {
text: 'Hello',
Expand All @@ -50,13 +87,14 @@ export default class Example extends React.Component<
strokeWidth: 1,
},
},
})
}, { ignore: true })

const target = graph.addNode({
x: 300,
y: 320,
width: 100,
height: 40,
zIndex: 10,
attrs: {
label: {
text: 'World',
Expand All @@ -65,13 +103,14 @@ export default class Example extends React.Component<
strokeWidth: 1,
},
},
})
}, { ignore: true })

graph.addNode({
x: 400,
y: 100,
width: 150,
height: 150,
zIndex: 1,
attrs: {
label: {
text: '🌎',
Expand All @@ -80,9 +119,64 @@ export default class Example extends React.Component<
strokeWidth: 1,
},
},
data: {
parent: true
},
}, { ignore: true })

graph.addEdge(
{
source,
target,
arrts: {
line: {
strokeWidth: 1
}
},
vertices: [
{
x: 220,
y: 220
},
{
x: 120,
y: 320
},
{
x: 300,
y: 400
}
]
},
{ ignore: true }
)

graph.on('edge:click', ({ cell }) => {
if (!cell.hasTool('vertices')) {
cell.addTools(
{
name: 'vertices',
args: {
stopPropagation: false,
addable: true,
removeable: false,
removeRedundancies: false,
snapRadius: 10,
attrs: {
r: 4
}
}
}
)
}
})

graph.addEdge({ source, target, arrts: { line: { strokeWidth: 1 } } })
graph.on('edge:unselected', ({ cell }) => {
cell.removeTools()
})
graph.on('edge:mouseup', ({ cell }) => {
console.log('edge:mouseup', cell)
})
}

onUndo = () => {
Expand All @@ -100,7 +194,7 @@ export default class Example extends React.Component<
render() {
return (
<div className="x6-graph-wrap">
<h1>Default Settings</h1>
<h1>Edge Vertices & History & Embedding</h1>
<div className="x6-graph-tools">
<Button.Group>
<Button onClick={this.onUndo} disabled={!this.state.canUndo}>
Expand Down
18 changes: 8 additions & 10 deletions packages/x6/src/registry/tool/vertices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,15 @@ export class Vertices extends ToolsView.ToolItem<EdgeView, Vertices.Options> {
this.updatePath()
}

if (!options.removeRedundancies) {
return
}

const verticesRemoved = edgeView.removeRedundantLinearVertices({
ui: true,
toolId: this.cid,
})
if (options.removeRedundancies) {
const verticesRemoved = edgeView.removeRedundantLinearVertices({
ui: true,
toolId: this.cid,
})

if (verticesRemoved) {
this.render()
if (verticesRemoved) {
this.render()
}
}

this.blur()
Expand Down