Page Index Toggle Pages: 1 2 [3]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Node Edit Mode through F2 ! (Read 14845 times)
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Node Edit Mode through F2 !
Reply #30 - Apr 24th, 2020 at 8:36am
Print Post  
Hi,

What are these tabs that you are using, Is it a custom control? Can you prepare for us a small sample that demonstrates the issue?

Thanks!
Lyubo
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Node Edit Mode through F2 !
Reply #31 - Apr 27th, 2020 at 4:20pm
Print Post  
Hi Lyubo,

I've created a sample and uploaded in the below url,

https://drive.google.com/open?id=1w6_ZHEUU9_kNst9e6vxbcMc_-4riQJfH

This app has 3 tabs. In all the 3 tabs, I've loaded the same diagram.

When I do any keydown or press delete key, the following events are called only in the third tab and not in the first and second tab.

    var diagramFocusDiv = (this.diagram as any).focusDiv as any;
    diagramFocusDiv.addEventListener("keydown", (args) => {

      this.handleKeyDown(args);
    });

    this.diagram.addEventListener(Event.nodeDeleting, (sender, args) => {

      var a = args;
    });

    this.diagram.addEventListener(Event.nodeDeleted, (sender, args) => {

      var a = args;
    });

May I know why this behavior?

Regards,
Kannan
  

Keydown_Happens_In_One_Tab.png ( 424 KB | 143 Downloads )
Keydown_Happens_In_One_Tab.png
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Node Edit Mode through F2 !
Reply #32 - Apr 28th, 2020 at 6:53am
Print Post  
Hi,

There is an issue and the event doesn't wire up correctly, because all your 3 diagrams share an id. Try setting unique ids to your distinct diagram instances, and the keydown event should fire in all 3 tabs.

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Node Edit Mode through F2 !
Reply #33 - Apr 28th, 2020 at 8:17am
Print Post  
Hi Lyubo,

I tried by setting canvas id like this, but still didn't work. Am I missing anything?

  private drawDiagram(): void {

    var r = Math.round(Math.random() * 100);
    var id = "diagram_" + r.toString();
    this.canvas.nativeElement.id = id;

    ......
}

Regards,
Kannan
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Node Edit Mode through F2 !
Reply #34 - Apr 28th, 2020 at 8:39am
Print Post  
You need to dynamically set the id before creating the diagram instance.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Node Edit Mode through F2 !
Reply #35 - Apr 28th, 2020 at 2:43pm
Print Post  
Hi Lyubo,

I fixed by setting diagram id dynamically like this,

<canvas #canvas id="{{diagramid}}"></canvas>

  public diagramid: string = undefined;

  constructor(private _httpClient: HttpClient) {

    this.diagramid = "diagram_" + Utilities.getDiagramCounter().toString();
  }

class Utilities {

  static counter: number = 0;

  static getDiagramCounter(): number{

    return this.counter++;
  }
}

It works. Thank you !

Regards,
Kannan
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Node Edit Mode through F2 !
Reply #36 - Apr 29th, 2020 at 12:29pm
Print Post  
Hi,

We've updated the npm packages with a fix for the focusDiv / same id issue. Can try out the updated scripts from the diagram-library and mindfusion-common packages.

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Node Edit Mode through F2 !
Reply #37 - Apr 29th, 2020 at 1:49pm
Print Post  
Hi Lyubo,

I took latest version and tried by reverting back my previous fix.

Now, keydown happens on focusDiv but Event.nodeDeleting is not raised

    this.diagram.addEventListener(Event.nodeDeleting, (sender, args) => {

      var a = args;
    });

When I commented focusDiv code, then Event.nodeDeleting is raised but for only first tab and not other tabs. So, element in other tab is not getting deleted when delete key is pressed.

Regards,
Kannan
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Node Edit Mode through F2 !
Reply #38 - Apr 29th, 2020 at 2:15pm
Print Post  
Hi,

Thank you for this report. We've identified this additional issue and will include the fix in the following package update. We'll let you know when it's published.

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Node Edit Mode through F2 !
Reply #39 - May 4th, 2020 at 11:25am
Print Post  
Hi Lyubo,

I tried in the latest version 3.4.4, it works fine. Thank you Smiley

Regards,
Kannan
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Node Edit Mode through F2 !
Reply #40 - May 26th, 2021 at 12:22pm
Print Post  
Hi,

We can end the node edit by calling diagram.endEdit(). But how to know whether any of the node in the diagram is in edit mode?

Regards,
Kannan
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Node Edit Mode through F2 !
Reply #41 - May 27th, 2021 at 5:47am
Print Post  
Hi,

It should be safe to call endEdit even if there's no node currently being edited. You could subscribe to enterInplaceEditMode / leaveInplaceEditMode events to know if currently in edit mode.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 
Send TopicPrint