Skip to content

[MPQEditor] Implement 'dispose' and 'onViewMessage' #1539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions src/MPQEditor/MPQCircleSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as vscode from "vscode";
import {
CircleGraphCtrl,
CircleGraphEvent,
MessageDefs,
} from "../CircleGraph/CircleGraphCtrl";

export interface MPQSelectionEvent {
Expand Down Expand Up @@ -213,14 +214,49 @@ export class MPQSelectionPanel
}

public dispose() {
//TODO
if (!this._closedByOwner && this._mpqEventHandler) {
this._mpqEventHandler.onClosed(this._ownerPanel);
}

this.disposeGraphCtrl();

MPQSelectionPanel.panels.forEach((selPan, index) => {
if (
this._ownerId === selPan._ownerId &&
this._modelPath === selPan._modelPath
) {
MPQSelectionPanel.panels.splice(index, 1);
}
});

// Clean up our resources
this._panel.dispose();

while (this._disposables.length) {
const x = this._disposables.pop();
if (x) {
x.dispose();
}
}
}

/**
* CircleGraphEvent interface implementations
*/
public onViewMessage(_message: any) {
// TODO
public onViewMessage(message: any) {
switch (message.command) {
case MessageDefs.selection:
Copy link
Contributor

@dayo09 dayo09 Apr 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got some UI feedbacks. If it's not easy to handle on this pr, please may you consider it later.

image

On #1505 draft,

  • when I click on 'add' node, MPQEditor seems to adds the node to the mpq editor slot.
  • when I click on 'Place holder's or 'Add 2' node, as they are not the mpq target, they shows the property view on the right side of the circle editor.

I think that 'click' event must result in the same behavior.
We can choose either to open the property view same to 'add' operation or not to open the property view to other operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dayo09
Thank you. I'll try to fix it in the draft at first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dayo09 @seanshpark
The same behaviour in the netron:
click on input/output nodes shows Model Properties, while clicking on the internal nodes show Nodes Properties.
For MPQ draft clicking internal nodes results in their selection for editing, while for input/output nodes still shows Model Properties to observe input/output size and theirs type.
To handle this issue:

  1. We can hide input/output nodes
  2. We can disable clicking input/output nodes

But still there may be some issues that some users are used to observe input/output size.
IMHO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or 3. We can show Properties too, when clicking on the internal nodes(ex. Add).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will approve this PR, let's go on about it on the other issue or PR. Thanks for listening to me.!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will approve this PR, let's go on about it on the other issue or PR. Thanks for listening to me.!

Thank you very much!

this._lastSelected = message.names;
// we need to update the document, but not save to file.
// pass to owner to handle this.
if (this._mpqEventHandler) {
this._mpqEventHandler.onSelection(message.names, this._document);
}
break;
case MessageDefs.finishload:
this.onForwardSelection(this._lastSelected);
break;
}
}

public onForwardSelection(selection: any) {
Expand Down