feat: render zindex for addItem and changeData.

This commit is contained in:
Yanyan-Wang 2020-04-03 10:47:12 +08:00 committed by Yanyan Wang
parent 3798b476c2
commit ea48e70788
3 changed files with 12 additions and 10 deletions

View File

@ -1928,11 +1928,9 @@ export default class Graph extends EventEmitter implements IGraph {
const sourceDepth: number = dataDepthMap[edge.source] || 0;
const targetDepth: number = dataDepthMap[edge.target] || 0;
const depth = Math.max(sourceDepth, targetDepth);
console.log(depth, edge.id, edge.source, edge.target, sourceDepth, targetDepth);
if (depthMap[depth]) depthMap[depth].push(edge.id);
else depthMap[depth] = [ edge.id ];
});
console.log(depthMap);
depthMap.forEach(array => {
if (!array || !array.length) return;
for (let i = array.length - 1; i >= 0; i--) {

View File

@ -11,6 +11,10 @@ const CACHE_BBOX = 'bboxCache';
const CACHE_CANVAS_BBOX = 'bboxCanvasCache';
const CACHE_ANCHOR_POINTS = 'anchorPointsCache';
const CACHE_BBOX = 'bboxCache';
const CACHE_CANVAS_BBOX = 'bboxCanvasCache';
const CACHE_ANCHOR_POINTS = 'anchorPointsCache';
export default class Combo extends Node implements ICombo {
public getDefaultCfg() {
return {

View File

@ -237,13 +237,13 @@ const DefaultCombo = () => {
graph.on('canvas:click', e => {
// graph.setItemState(graph.findById('A'), 'selected', true);
// console.log( graph.findAllByState('combo', 'selected'))
// const hidedCombos = graph.findAll('combo', combo => {
// if (!combo.isVisible()) return true;
// return false;
// });
// hidedCombos.forEach(combo => {
// graph.showItem(combo);
// })
const hidedCombos = graph.findAll('combo', combo => {
if (!combo.isVisible()) return true;
return false;
});
hidedCombos.forEach(combo => {
graph.showItem(combo);
})
// console.log(graph.getCombos()[0]);
// console.log(graph.getComboChildren(graph.getCombos()[0]));
//graph.focusItem(graph.getCombos()[0]);
@ -251,7 +251,7 @@ const DefaultCombo = () => {
// graph.remove('A');
// graph.changeData(data2);
// graph.changeData(graph.save());
// graph.render();
// graph.addItem('combo', {
// id: 'M',