![](/img/trans.png)
[英]Is there a way to update the graph/paper or all modified elements in the graph in JointJS?
[英]Unhighlight all cellViews on paper - jointjs
我們最近添加了 Jointjs 的突出顯示功能,以向用戶顯示當前突出顯示和選擇的單元格視圖。 但是,如果用戶點擊外面,我們想要取消突出顯示在紙上繪制的所有 cellView(s)。 在調查了官方文檔后,我們最終無法找到滿足我們要求的解決方案。
突出顯示 cellView(s) 的代碼是:
this.paper.on('cell:pointerclick', (cellView: any) => {
cellView.highlight();
});
為了解決這個問題,我們迭代顯示在當前紙張(區域)上的所有 cellViews 並調用 unhighlight 函數。 此邏輯放置在blank:pointerdown
回調中 - 以便我們處理實際 cellView 之外的所有點擊。
this.paper.on('blank:pointerdown', (evt, x, y) => {
this.paper.findViewsInArea(this.paper.getArea()).forEach(cell => {
cell.unhighlight();
});
});
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.