建個畫布
// 創(chuàng)建畫布
this.graph = new Graph({
container: document.getElementById('layoutContainer'),
width: 800,
height: 500,
grid: true,
// 旋轉(zhuǎn)
rotating: {
enabled: true, // 是否開啟節(jié)點(diǎn)旋轉(zhuǎn)
grid: 15 // 每次旋轉(zhuǎn)15度
}
})
配置旋轉(zhuǎn) rotating 屬性
// 旋轉(zhuǎn)
rotating: {
enabled: true, // 是否開啟節(jié)點(diǎn)旋轉(zhuǎn)
grid: 15 // 每次旋轉(zhuǎn)15度
}
來個Node
// A
this.graph.addNode({
x: 50,
y: 50,
width: 100,
height: 40,
attrs: { label: { text: 'A' } }
})
監(jiān)聽旋轉(zhuǎn)角度變化
this.graph.on('node:resize', (args) => {
console.log('node:resize', args)
})
this.graph.on('node:resizing', (args) => {
console.log('node:resizing', args)
})
this.graph.on('node:rotate', (args) => {
console.log('node:rotate', args)
})
this.graph.on('node:rotating', (args) => {
console.log('node:rotating', args)
})
this.graph.on('node:rotated', (args) => {
console.log('node:rotated', args)
})
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。