Flow元素位置更改
我如果想更换flow中某个元素的位置应该如何设置? 比如 flow中有 children [box1,box2,box3,box4]; 我想让box4移动到box3的位置,或者box4移动到box2的位置; 形成[box1,box4,box3,box3,]这样的效果。
我在playground试了下好像没有起作用 // #自动布局 import { Leafer, Box } from 'leafer-ui' import { Flow } from '@leafer-in/flow' // 导入自动布局插件
const leafer = new Leafer({ view: window })
const box1 = new Box({ fill: '#FF4B4B', children: [{ tag: 'Text', text: '1', fill: 'white', textAlign: 'center', verticalAlign: 'middle', width: 25, height: 20 }] }); const box2 = new Box({ fill: '#FEB027', children: [{ tag: 'Text', text: '2', fill: 'white', textAlign: 'center', verticalAlign: 'middle', width: 25, height: 40 }] }); const box3 = new Box({ fill: '#79CB4D', children: [{ tag: 'Text', text: '3', fill: 'white', textAlign: 'center', verticalAlign: 'middle', width: 25, height: 30 }] });
const flow = new Flow({ fill: '#676', width: 100, height: 100, children: [ box1,box2,box3 ], })
leafer.add(flow)
setTimeout(()=>{ box1.zIndex=3; },2000)
那应该是暂时不支持, 可以用flow.addBefore()等方式物理移动