mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-30 00:29:46 +08:00
fix: drag mind map root node should layout in real time (#9252)
Fixes [BS-2062](https://linear.app/affine-design/issue/BS-2062/拖拽整个-mind-map-还是希望和之前一样,整个思维导图跟手)
This commit is contained in:
@@ -69,7 +69,10 @@ export class MindMapView extends GfxElementModelView<MindmapElementModel> {
|
||||
if (payload.props['xywh']) {
|
||||
updateButtons();
|
||||
}
|
||||
if (payload.props['hidden'] !== undefined) {
|
||||
if (
|
||||
payload.props['hidden'] !== undefined ||
|
||||
payload.props['opacity'] !== undefined
|
||||
) {
|
||||
this._updateButtonVisibility(payload.id);
|
||||
}
|
||||
}
|
||||
@@ -169,6 +172,7 @@ export class MindMapView extends GfxElementModelView<MindmapElementModel> {
|
||||
|
||||
if (!latestNode) {
|
||||
buttonModel.opacity = 0;
|
||||
buttonModel.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,9 +190,9 @@ export class MindMapView extends GfxElementModelView<MindmapElementModel> {
|
||||
|
||||
buttonModel.hidden = latestNode.element.hidden;
|
||||
buttonModel.opacity =
|
||||
hasChildren && notHidden && (collapsed || isNodeSelected || hovered)
|
||||
(hasChildren && notHidden && (collapsed || isNodeSelected || hovered)
|
||||
? 1
|
||||
: 0;
|
||||
: 0) * (latestNode.element.opacity ?? 1);
|
||||
}
|
||||
|
||||
private _updateCollapseButton(node: MindmapNode) {
|
||||
@@ -216,7 +220,7 @@ export class MindMapView extends GfxElementModelView<MindmapElementModel> {
|
||||
const buttonStyle = collapsed ? style.expandButton : style.collapseButton;
|
||||
|
||||
Object.entries(buttonStyle).forEach(([key, value]) => {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error key is string
|
||||
collapseButton[key as unknown] = value;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user