Skip to content

Commit

Permalink
fix: fix demos (#5754)
Browse files Browse the repository at this point in the history
* fix: fix unexpected update style

* docs(demos): update demos

* fix(runtime): fix attributes assign
  • Loading branch information
Aarebecca authored May 20, 2024
1 parent 49e51bb commit 716cb92
Show file tree
Hide file tree
Showing 23 changed files with 8 additions and 24 deletions.
8 changes: 4 additions & 4 deletions packages/g6/src/runtime/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export class ElementController {
elementType,
stage,
originalStyle: { ...element.attributes },
modifiedStyle: style,
modifiedStyle: { ...style },
},
{
after: () => {
Expand Down Expand Up @@ -440,7 +440,7 @@ export class ElementController {
elementType,
stage: exactStage,
originalStyle: { ...element.attributes },
modifiedStyle: style,
modifiedStyle: { ...element.attributes, ...style },
},
{
before: () => {
Expand Down Expand Up @@ -490,8 +490,8 @@ export class ElementController {
element,
elementType,
stage,
originalStyle: element.attributes,
modifiedStyle: element.attributes,
originalStyle: { ...element.attributes },
modifiedStyle: { ...element.attributes },
},
{
after: () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/site/examples/animation/basic/demo/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const graph = new Graph({
},
edge: {
animation: {
update: [{ fields: ['stroke', 'path', 'lineWidth'], shape: 'key' }],
update: [{ fields: ['sourceNode', 'targetNode'] }, { fields: ['stroke', 'lineWidth'], shape: 'key' }],
},
},
});
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/animation/viewport/demo/rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ fetch('https://assets.antv.antgroup.com/g6/force.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
data,
layout: {
type: 'force',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ fetch('https://assets.antv.antgroup.com/g6/force.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
data,
layout: {
type: 'force',
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/animation/viewport/demo/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ fetch('https://assets.antv.antgroup.com/g6/force.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
data,
layout: {
type: 'force',
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/behavior/focus/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const data = {

const graph = new Graph({
container: 'container',
animation: true,
node: {
style: { labelText: (d) => d.id },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CircleComboWithExtraButton extends CircleCombo {
const [, height] = this.getKeySize(attributes);
const btnR = 8;
const y = height / 2 + btnR;
const d = collapsed ? expand(0, 0, btnR) : collapse(0, 0, btnR);
const d = collapsed ? expand(0, y, btnR) : collapse(0, y, btnR);

const hitArea = this.upsert('hit-area', Circle, { cy: y, r: 10, fill: '#fff', cursor: 'pointer' }, this);
this.upsert('button', Path, { stroke: '#3d81f7', d, cursor: 'pointer' }, hitArea);
Expand Down
1 change: 1 addition & 0 deletions packages/site/examples/element/node/demo/donut.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fetch('https://assets.antv.antgroup.com/g6/element-nodes.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: false,
data,
node: {
type: 'donut',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ fetch('https://assets.antv.antgroup.com/g6/dagre-combo.json')
const graph = new Graph({
container: 'container',
autoFit: 'view',
animation: true,
data,
node: {
type: 'rect',
Expand Down
1 change: 1 addition & 0 deletions packages/site/examples/layout/dendrogram/demo/vertical.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.j
labelText: data.id,
labelWordWrap: true,
labelWordWrapWidth: 150,
labelDx: isLeaf ? 20 : 0,
labelDy: isLeaf ? 0 : 20,
labelTextAlign: isLeaf ? 'start' : 'center',
labelTextBaseline: 'middle',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fetch('https://assets.antv.antgroup.com/g6/d3-force-3d.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
renderer,
data,
layout: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const width = container.scrollWidth;

const graph = new Graph({
container,
animation: true,
data: getData(width),
layout: {
type: 'd3force',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ fetch('https://assets.antv.antgroup.com/g6/cluster.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
data,
node: {
style: {
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/force-directed/demo/force.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ fetch('https://assets.antv.antgroup.com/g6/cluster.json')
layout: {
type: 'force',
linkDistance: 50,
animation: true,
clustering: true,
nodeClusterBy: 'cluster',
clusterNodeStrength: 70,
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/force-directed/demo/mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function getData(size = 10) {
}

const graph = new Graph({
animation: true,
data: getData(),
layout: {
type: 'd3force',
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/fruchterman/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fetch('https://assets.antv.antgroup.com/g6/cluster.json')
field: 'cluster',
},
},
animation: true,
behaviors: ['drag-canvas', 'drag-element'],
});

Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/fruchterman/demo/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ fetch('https://assets.antv.antgroup.com/g6/cluster.json')
},
},
behaviors: ['drag-canvas', 'drag-element'],
animation: true,
});

graph.render();
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/grid/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ fetch('https://assets.antv.antgroup.com/g6/cluster.json')
},
},
behaviors: ['zoom-canvas', 'drag-canvas', 'drag-element', 'click-select'],
animation: true,
});

graph.render();
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/mds/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ fetch('https://assets.antv.antgroup.com/g6/cluster.json')
},
},
behaviors: ['drag-element', 'drag-canvas', 'zoom-canvas'],
animation: true,
});

graph.render();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const fetchData = async (type) => {
fetchData('small').then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
behaviors: ['drag-canvas', 'zoom-canvas', 'drag-element'],
layout: {
type: 'force',
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/layout/mechanism/demo/switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/relations.json')
.then((data) => {
const graph = new Graph({
container: 'container',
animation: true,
layout: {
type: 'circular',
},
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/plugin/bubble-sets/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ fetch('https://assets.antv.antgroup.com/g6/collection.json')
layout: {
type: 'force',
preventOverlap: true,
animation: true,
linkDistance: (d) => {
if (d.source === 'node0' || d.target === 'node0') {
return 200;
Expand Down
1 change: 0 additions & 1 deletion packages/site/examples/plugin/hull/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ fetch('https://assets.antv.antgroup.com/g6/collection.json')
layout: {
type: 'force',
preventOverlap: true,
animation: true,
linkDistance: (d) => {
if (d.source === 'node0' || d.target === 'node0') {
return 200;
Expand Down

0 comments on commit 716cb92

Please sign in to comment.