Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) ExpandButtonClicked in Angular/typescript (Read 6396 times)
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Re: ExpandButtonClicked in Angular/typescript
Reply #15 - May 6th, 2020 at 9:21am
Print Post  
Tried to do so. Now when clicking the expand button, I get a lot of errors

TypeError: Cannot read property 'emit' of undefined
    at Array.<anonymous> (diagram-library-angular.js:111)
    at MindFusion.Common.js:6
    at abt.<computed>.raiseEvent (MindFusion.Diagramming.js:6)
    at abt.<computed>.raiseExpandButtonClicked (MindFusion.Diagramming.js:6)
    at aBm.ExpandButton.onClick (MindFusion.Diagramming.js:6)
    at aKg.LinkNodesBehavior.createController (MindFusion.Diagramming.js:6)
    at Object.callBaseMethod (MindFusion.Common.js:6)
    at aKg.LinkNodesBehavior.createController (MindFusion.Diagramming.js:6)
    at a1N.MouseInputDispatcher.selectController (MindFusion.Diagramming.js:6)
    at a1N.MouseInputDispatcher.onMouseMove (MindFusion.Diagramming.js:6)

When following the link, I end up in the code

        for (var v in events) {
            function addAndDelegate(event, prop) {
                prop.diagram.addEventListener(event, (sender, args) => {
                    let emitter = Reflect.get(prop, event);
                    emitter.emit({ sender, args });
                });
            }
            addAndDelegate(v, this);
        }

and see that emitter is undefined.

What am I missing?

Best,
Michael
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: ExpandButtonClicked in Angular/typescript
Reply #16 - May 7th, 2020 at 7:52am
Print Post  
Hi,

diagram-library-angular@1.0.3 on npm adds expandClicked emitter to DiagramView -

(onExpandButtonClicked)="onExpandButtonClicked($event)"

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Re: ExpandButtonClicked in Angular/typescript
Reply #17 - May 7th, 2020 at 9:16am
Print Post  
Awesome, works fine.

But one thing I noticed: The expand button does not change from + to - and vice versa though the state of node.getExpanded() is correct in the event handler. Even if I change it explicitly (again) using node.setExpanded() it does not change ...

Is there any intention to add the mousebutton which was used to click the button to the event args?
e.args.getMouseButton() always delivers 'undefined'

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: ExpandButtonClicked in Angular/typescript
Reply #18 - May 7th, 2020 at 11:25am
Print Post  
try calling this from event handler for time being -

Code
Select All
(node as any).expandButton.updateContent();
node.invalidate(); 



Regards,
Slavcho
  
Back to top
 
IP Logged
 
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Re: ExpandButtonClicked in Angular/typescript
Reply #19 - May 7th, 2020 at 12:39pm
Print Post  
Works fine. Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint