diff --git a/CHANGELOG.md b/CHANGELOG.md index 472bab2b3fa..55ec5360f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +### 4.8.6 + +- fix: loop edge position for custom rect node, closes: #4236; +- fix: drag-node should be ended after data changed; + ### 4.8.5 - fix: combo with size and fixSize setting; @@ -114,8 +119,8 @@ - fix: image lost while updating the size for an image node, closes: #3938; ### 4.7.7 - - - feat: getContentPlaceholder and getTitlePlaceholder for Annotation plugin; + +- feat: getContentPlaceholder and getTitlePlaceholder for Annotation plugin; ### 4.7.6 @@ -126,9 +131,9 @@ - perf: Annotation support updating positions for outside cards by calling updateOutsideCards; - ### 4.7.4 - - - perf: Annotation min-width and input width; +### 4.7.4 + +- perf: Annotation min-width and input width; ### 4.7.3 @@ -225,7 +230,7 @@ - fix: destroyLayout error, closes: #3727; - fix: drag combo with stack problem, closes: #3699; -- fix: updateLayout does not take effect if update layout with same type as graph instance configuration, closes: #3706; +- fix: updateLayout does not take effect if update layout with same type as graph instance configuration, closes: #3706; - fix: legendStateStyles typo, closes: #3705; - perf: zoom-canvas take the maximum and minimum values instead of return directly; - perf: minimap cursor move; @@ -238,7 +243,6 @@ - chore: improve the types of graph events; - fix: position animate considers origin attributes; - #### 4.6.3 - feat: shouldDeselect param for lasso-select; @@ -283,18 +287,17 @@ - feat: translate graph with animation; - feat: zoom graph with animation; -- feat: timebar supports filterItemTypes to configure the types of the graph items to be filtered; only nodes can be filtered before; +- feat: timebar supports filterItemTypes to configure the types of the graph items to be filtered; only nodes can be filtered before; - feat: timebar supports to configure the rotate of the tick labels by tickLabelStyle[dot]rotate; - feat: timebar supports container CSS configuration by containerCSS; - feat: timebar supports a function getDate to returns the date value according to each node or edge by user; -- feat: timebar supports afunction getValue to returns the value (for trend line of trend timebar) according to each node or edge by user; +- feat: timebar supports afunction getValue to returns the value (for trend line of trend timebar) according to each node or edge by user; - feat: timebar supports to configure a boolean changeData to control the filter way, true means filters by graph[dot]changeData, false means filters by graph[dot]showItem and graph[dot]hideItem; - feat: timebar supports to configure a function shouldIgnore to return true or false by user to decide whether the node or the edge should be ignored while filtering; - fix: simple timebar silder text position strategy and expand the lineAppendWidth for the slider; - fix: edge label padding bug, closes: #3346; - fix: update node with iconfont icon, the icon is updated to a wrong position, closes: #3348; - #### 4.5.0 - fix: add item type to the parameter of afterremoveitem event; @@ -345,7 +348,6 @@ - fix: update node position with wrong position; - feat: enableStack for drag-node behavior, closes: #3128; - #### 4.3.5 - fix: drag a node without comboId by drag-node with onlyChangeComboSize; @@ -359,7 +361,7 @@ - fix: when select a node with click-select, selected combos should be deselected; - fix: contextmenu with click trigger does not show the menu up, closes: #2982; - fix: layout with collapsed combo, closes: #2988; -- fix: zoom-canvas with optimizeZoom, drag-canvas shows the node shapes hiden by zoom-canvas optimizeZoom, closes: #2996; +- fix: zoom-canvas with optimizeZoom, drag-canvas shows the node shapes hiden by zoom-canvas optimizeZoom, closes: #2996; #### 4.3.3 @@ -439,6 +441,7 @@ - feat: tooltip with trigger configuration, supports mouseenter and click; #### 4.2.0 + #### 4.1.14 - fix: combo edge link position problem; diff --git a/packages/core/package.json b/packages/core/package.json index 817ae374cd7..8016108e2cb 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-core", - "version": "0.8.5", + "version": "0.8.6", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", diff --git a/packages/core/src/global.ts b/packages/core/src/global.ts index 8d6f4a18101..a859e31c64c 100644 --- a/packages/core/src/global.ts +++ b/packages/core/src/global.ts @@ -64,7 +64,7 @@ const colorSet = { }; export default { - version: '0.8.5', + version: '0.8.6', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', @@ -249,8 +249,9 @@ export default { strokeOpacity: 0.9, lineDash: [5, 5], }, - windowFontFamily: typeof window !== 'undefined' && window.getComputedStyle && document.body - ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || - 'Arial, sans-serif' - : 'Arial, sans-serif' + windowFontFamily: + typeof window !== 'undefined' && window.getComputedStyle && document.body + ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || + 'Arial, sans-serif' + : 'Arial, sans-serif', }; diff --git a/packages/core/src/util/graphic.ts b/packages/core/src/util/graphic.ts index 7754f84133d..03309acc193 100644 --- a/packages/core/src/util/graphic.ts +++ b/packages/core/src/util/graphic.ts @@ -70,7 +70,7 @@ export const getLoopCfgs = (cfg: EdgeData): EdgeData => { if (!containerMatrix) containerMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1]; const keyShape: IShapeBase = item.getKeyShape(); - const bbox: IBBox = keyShape.getBBox(); + const bbox: IBBox = keyShape.getCanvasBBox(); const loopCfg = cfg.loopCfg || {}; // 距离keyShape边的最高距离 @@ -78,8 +78,8 @@ export const getLoopCfgs = (cfg: EdgeData): EdgeData => { // 自环边与keyShape的相对位置关系 const position: string = loopCfg.position || Global.defaultLoopPosition; - // 中心取group上真实位置 - const center = [containerMatrix[6], containerMatrix[7]]; + // 中心取 keyShape canvasBBox 的中心位置 + const center = [(bbox.minX + bbox.maxX) / 2, (bbox.minY + bbox.maxY) / 2]; let startPoint = [cfg.startPoint.x, cfg.startPoint.y]; let endPoint = [cfg.endPoint.x, cfg.endPoint.y]; @@ -688,8 +688,8 @@ export const getComboBBox = ( const comboModel = combo?.getModel(); const { x, y, fixSize, collapsed, fixCollapseSize } = comboModel || {}; const useFixSize = collapsed ? fixCollapseSize : fixSize; - const [ width, height ] = isArray(useFixSize) ? useFixSize : [useFixSize, useFixSize]; - const halfSize = [ width / 2, height / 2 ]; + const [width, height] = isArray(useFixSize) ? useFixSize : [useFixSize, useFixSize]; + const halfSize = [width / 2, height / 2]; return { minX: x - halfSize[0], minY: y - halfSize[1], diff --git a/packages/element/package.json b/packages/element/package.json index 7f06785b5a4..7b3e93cfba2 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-element", - "version": "0.8.5", + "version": "0.8.6", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -61,7 +61,7 @@ }, "dependencies": { "@antv/g-base": "^0.5.1", - "@antv/g6-core": "0.8.5", + "@antv/g6-core": "0.8.6", "@antv/util": "~2.0.5" }, "devDependencies": { diff --git a/packages/g6/package.json b/packages/g6/package.json index 6e556aee290..331aaee8683 100644 --- a/packages/g6/package.json +++ b/packages/g6/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6", - "version": "4.8.5", + "version": "4.8.6", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@antv/g6-pc": "0.8.5" + "@antv/g6-pc": "0.8.6" }, "devDependencies": { "@babel/core": "^7.7.7", diff --git a/packages/g6/src/index.ts b/packages/g6/src/index.ts index 5d39afabc18..f0859cc7f4b 100644 --- a/packages/g6/src/index.ts +++ b/packages/g6/src/index.ts @@ -1,7 +1,7 @@ import G6 from '@antv/g6-pc'; -G6.version = '4.8.5'; +G6.version = '4.8.6'; export * from '@antv/g6-pc'; export default G6; -export const version = '4.8.5'; \ No newline at end of file +export const version = '4.8.6'; diff --git a/packages/pc/package.json b/packages/pc/package.json index 14b043ec1be..481d0233460 100644 --- a/packages/pc/package.json +++ b/packages/pc/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-pc", - "version": "0.8.5", + "version": "0.8.6", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -75,9 +75,9 @@ "@antv/g-canvas": "^0.5.2", "@antv/g-math": "^0.1.1", "@antv/g-svg": "^0.5.1", - "@antv/g6-core": "0.8.5", - "@antv/g6-element": "0.8.5", - "@antv/g6-plugin": "0.8.5", + "@antv/g6-core": "0.8.6", + "@antv/g6-element": "0.8.6", + "@antv/g6-plugin": "0.8.6", "@antv/hierarchy": "^0.6.7", "@antv/layout": "^0.3.0", "@antv/matrix-util": "^3.1.0-beta.3", diff --git a/packages/pc/src/behavior/drag-node.ts b/packages/pc/src/behavior/drag-node.ts index 2796ebd9b5f..0b908502677 100644 --- a/packages/pc/src/behavior/drag-node.ts +++ b/packages/pc/src/behavior/drag-node.ts @@ -6,10 +6,10 @@ * @Description: 拖动节点的Behavior */ import { Point } from '@antv/g-base'; -import { deepMix, clone, debounce } from '@antv/util'; -import { G6Event, IG6GraphEvent, Item, NodeConfig, INode, ICombo } from '@antv/g6-core'; -import { IGraph } from '../interface/graph'; +import { G6Event, ICombo, IG6GraphEvent, INode, Item, NodeConfig } from '@antv/g6-core'; +import { clone, debounce, deepMix } from '@antv/util'; import Global from '../global'; +import { IGraph } from '../interface/graph'; export default { getDefaultCfg(): object { @@ -31,16 +31,17 @@ export default { getEvents(): { [key in G6Event]?: string } { return { 'node:mousedown': 'onMouseDown', // G's dragstart event is not triggered sometimes when the drag events are not finished properly. Listen to mousedown and drag instead of dragstart - 'drag': 'onDragMove', // global drag, mouseup, and dragend to avoid mouse moving too fast to go out of a node while draging - 'dragend': 'onDragEnd', + drag: 'onDragMove', // global drag, mouseup, and dragend to avoid mouse moving too fast to go out of a node while draging + dragend: 'onDragEnd', 'combo:dragenter': 'onDragEnter', 'combo:dragleave': 'onDragLeave', 'combo:drop': 'onDropCombo', 'node:drop': 'onDropNode', 'canvas:drop': 'onDropCanvas', - 'touchstart': 'onTouchStart', - 'touchmove': 'onTouchMove', - 'touchend': 'onDragEnd', + touchstart: 'onTouchStart', + touchmove: 'onTouchMove', + touchend: 'onDragEnd', + afterchangedata: 'onDragEnd', }; }, validationCombo(item: ICombo) { @@ -72,7 +73,7 @@ export default { } this.mousedown = { item: evt.item, - target: evt.target + target: evt.target, }; this.dragstart = true; self.onDragStart(evt); @@ -102,7 +103,7 @@ export default { onMouseDown(evt: IG6GraphEvent) { this.mousedown = { item: evt.item, - target: evt.target + target: evt.target, }; }, /** @@ -123,7 +124,7 @@ export default { // drag this.onDrag({ ...evt, - ...this.mousedown + ...this.mousedown, }); } }, @@ -168,7 +169,7 @@ export default { const currentNodeId = item.get('id'); // 当前拖动的节点是否是选中的节点 - const dragNodes = nodes.filter(node => { + const dragNodes = nodes.filter((node) => { const nodeId = node.get('id'); return currentNodeId === nodeId; }); @@ -178,7 +179,7 @@ export default { this.targets.push(item); } else if (nodes.length > 1) { // 拖动多个节点 - nodes.forEach(node => { + nodes.forEach((node) => { const locked = node.hasLocked(); if (!locked) { this.targets.push(node); @@ -199,9 +200,9 @@ export default { this.hidenEdge = {}; if (this.get('updateEdge') && this.enableOptimize && !this.enableDelegate) { - this.targets.forEach(node => { + this.targets.forEach((node) => { const edges = node.getEdges(); - edges.forEach(edge => { + edges.forEach((edge) => { if (!edge.isVisible()) return; this.hidenEdge[edge.getID()] = true; edge.hide(); @@ -245,11 +246,11 @@ export default { evt, updateEdge: this.get('updateEdge'), onlyChangeComboSize: this.onlyChangeComboSize, - updateParentCombos: this.updateParentCombos + updateParentCombos: this.updateParentCombos, }); } else { const parentComboMap = {}; - this.targets.map(target => { + this.targets.map((target) => { this.update(target, evt); const parentComboId = target.getModel().comboId; if (parentComboId) parentComboMap[parentComboId] = this.graph.findById(parentComboId); @@ -273,7 +274,7 @@ export default { } // 拖动结束后,设置拖动元素 group 的 capture 为 true,允许拾取拖动元素 - this.cachedCaptureItems?.forEach(item => { + this.cachedCaptureItems?.forEach((item) => { const group = item.getContainer(); group.set('capture', true); }); @@ -285,9 +286,9 @@ export default { } if (this.get('updateEdge') && this.enableOptimize && !this.enableDelegate) { - this.targets.forEach(node => { + this.targets.forEach((node) => { const edges = node.getEdges(); - edges.forEach(edge => { + edges.forEach((edge) => { if (this.hidenEdge[edge.getID()]) edge.show(); edge.refresh(); }); @@ -304,11 +305,11 @@ export default { after: { nodes: [], edges: [], combos: [] }, }; - this.get('beforeDragNodes').forEach(model => { + this.get('beforeDragNodes').forEach((model) => { stackData.before.nodes.push(model); }); - this.targets.forEach(target => { + this.targets.forEach((target) => { const { x, y, id } = target.getModel(); stackData.after.nodes.push({ x, y, id }); }); @@ -478,10 +479,10 @@ export default { evt, updateEdge: this.get('updateEdge'), onlyChangeComboSize: this.onlyChangeComboSize, - updateParentCombos: this.updateParentCombos + updateParentCombos: this.updateParentCombos, }); - else if (!restore) this.targets.map(node => this.update(node, evt)); - } else this.targets.map(node => this.update(node, evt, restore)); + else if (!restore) this.targets.map((node) => this.update(node, evt)); + } else this.targets.map((node) => this.update(node, evt, restore)); }, /** * 更新节点 @@ -522,9 +523,18 @@ export default { * @param evt */ debounceUpdate: debounce( - event => { - const { targets, graph, point, origin, evt, updateEdge, onlyChangeComboSize, updateParentCombos } = event; - targets.map(item => { + (event) => { + const { + targets, + graph, + point, + origin, + evt, + updateEdge, + onlyChangeComboSize, + updateParentCombos, + } = event; + targets.map((item) => { const model: NodeConfig = item.get('model'); const nodeId: string = item.get('id'); if (!point[nodeId]) { @@ -651,12 +661,12 @@ export default { const graph = paramGraph || this.graph; const targets = paramTargets || this.targets; const comboParentMap = {}; - targets?.forEach(target => { + targets?.forEach((target) => { const comboId = target.getModel().comboId; if (comboId) comboParentMap[comboId] = graph.findById(comboId); - }) + }); Object.values(comboParentMap).forEach((combo: ICombo) => { if (combo) graph.updateCombo(combo); - }) - } + }); + }, }; diff --git a/packages/pc/src/global.ts b/packages/pc/src/global.ts index c8fc77d6a69..569f559b774 100644 --- a/packages/pc/src/global.ts +++ b/packages/pc/src/global.ts @@ -7,7 +7,7 @@ const textColor = 'rgb(0, 0, 0)'; const colorSet = getColorsWithSubjectColor(subjectColor, backColor); export default { - version: '0.8.5', + version: '0.8.6', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 0679a165bd8..4e497e0fdeb 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-plugin", - "version": "0.8.5", + "version": "0.8.6", "description": "G6 Plugin", "main": "lib/index.js", "module": "es/index.js", @@ -22,8 +22,8 @@ "@antv/g-base": "^0.5.1", "@antv/g-canvas": "^0.5.2", "@antv/g-svg": "^0.5.2", - "@antv/g6-core": "0.8.5", - "@antv/g6-element": "0.8.5", + "@antv/g6-core": "0.8.6", + "@antv/g6-element": "0.8.6", "@antv/matrix-util": "^3.1.0-beta.3", "@antv/scale": "^0.3.4", "@antv/util": "^2.0.9", diff --git a/packages/site/package.json b/packages/site/package.json index 56d8156a783..c95f8007f20 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@antv/g6-site", - "version": "4.8.5", + "version": "4.8.6", "description": "G6 sites deployed on gh-pages", "keywords": [ "antv",