Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Got an error while collapsing (Read 7285 times)
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Got an error while collapsing
Jul 19th, 2017 at 10:33am
Print Post  
I am working on minfusion library. It works fine but whenever i fold or unfold. it give the below error attached in pic can you please look in to this problem and let me know where i am going wrong.
Code (Javascript)
Select All
this.diagram.addEventListener(Events.containerFolded, (sender, args) => {
            const node = args.getNode();
            const r = node.getBounds();
            r.height = nodeAttribute.height;
            r.width = nodeAttribute.width;
            node.setBounds(r, true, true);
            this.setOffsetFoldedChildNode(node, node.unfoldedSize.height - node.captionHeight);
            node.updateLinks();
        });
        this.diagram.addEventListener(Events.containerUnfolded, (sender, args) => {
            const node = args.getNode();
            const r = node.getBounds();
            r.height = node.unfoldedSize.height;
            r.width = node.unfoldedSize.width;
            node.setBounds(r, true, true);
            this.setOffsetUnFoldedChildNode(node, node.unfoldedSize.height - node.captionHeight);
            node.updateLinks();
        });
        this.diagram.addEventListener(Events.nodeClicked, (sender, args) => {
            const node = args.getNode();
            this.nodeClick.emit(node.data);
        });
 



Code (Javascript)
Select All
 private setOffsetFoldedChildNode(node, offset) {
        const links = node.getOutgoingLinks();
        for (let l = 0; l < links.length; l++) {
            const link = links[l];
            const child = link.getDestination();
            const rect = child.getBounds().clone();
            rect.y -= offset;
            child.setBounds(rect, true, true);
            for (let c = 1; c < link.getControlPoints().length - 1; c++) {
                link.getControlPoints()[c].y -= offset;
            }
            link.updateFromPoints();
            this.setOffsetFoldedChildNode(child, offset);
        }
    }

    private setOffsetUnFoldedChildNode(node, offset) {
        const links = node.getOutgoingLinks();
        for (let l = 0; l < links.length; l++) {
            const link = links[l];
            const child = link.getDestination();
            const rect = child.getBounds().clone();
            rect.y += offset;
            child.setBounds(rect, true, true);
            for (let c = 1; c < link.getControlPoints().length - 1; c++) {
                link.getControlPoints()[c].y += offset;
            }
            link.updateFromPoints();
            this.setOffsetUnFoldedChildNode(child, offset);
        }
    }
 

« Last Edit: Jul 24th, 2017 at 11:14am by Ankur shah »  

mindfusion_error_log.PNG ( 22 KB | 133 Downloads )
mindfusion_error_log.PNG
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Got an error while collapsing
Reply #1 - Jul 19th, 2017 at 12:19pm
Print Post  
Hi,

We were able to reproduce it by clicking immediately after the page loads without moving the mouse, is it how it happens on your side?

Regargs,
Lyubo
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Got an error while collapsing
Reply #2 - Jul 19th, 2017 at 12:23pm
Print Post  
yes you right. But how can we solve it?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Got an error while collapsing
Reply #3 - Jul 19th, 2017 at 2:23pm
Print Post  
You can work around it like this -

Code
Select All
var originalMouseDown = MouseInputDispatcher.prototype.onMouseDown;
MouseInputDispatcher.prototype.onMouseDown = function(position, button)
{
    if (!this.pointerPosition)
        this.onMouseMove(position);
    originalMouseDown.apply(this, [position, button]);
} 



We'll try to upload fixed build later this week.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Got an error while collapsing
Reply #4 - Jul 20th, 2017 at 6:26am
Print Post  
Please let me know when ever this bug will get fixed.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Got an error while collapsing
Reply #5 - Jul 20th, 2017 at 10:14am
Print Post  
Please check if https://mindfusion.eu/_temp/jsdiag_nomove.zip fixes it on your side and we'll upload to NPM.
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Got an error while collapsing
Reply #6 - Jul 24th, 2017 at 6:54am
Print Post  
I have checked the diagram library provided by you. It having problem that when ever I fold or unfold my nodes. It stop listening the node click event. When diagram get loaded if  we click on node it listens the click event but when ever we click any folded or unfolded button it stop listening the node click event. Can please let me know what is going wrong?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Got an error while collapsing
Reply #7 - Jul 24th, 2017 at 8:46am
Print Post  
By folding you mean collapsing a tree branch using the +/- icon, right? I've added a diagram.addEventListener(Events.nodeClicked, function () { alert("click") }) to DomTree example where that's demonstrated and it shows the alert after collapse/expand. Check if there isn't some script error shown in browser's console when you click, preventing your event handler from completing.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Got an error while collapsing
Reply #8 - Jul 24th, 2017 at 11:06am
Print Post  
No by folding i mean say these button (^/v) present container node. Please have a look at the image i have attached. And also we did not get any kind of error in console.
« Last Edit: Jul 24th, 2017 at 12:14pm by Ankur shah »  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Got an error while collapsing
Reply #9 - Jul 24th, 2017 at 12:06pm
Print Post  
This handler works for me after fold/unfold in Containers.js example -
Code
Select All
diagram.addEventListener(MindFusion.Diagramming.Events.nodeClicked,
    function (s,e) { alert(e.node.getText()) }); 



Please let me know what I should change there to reproduce.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Shafi
Full Member
***
Offline


I Love MindFusion!

Posts: 109
Joined: Nov 8th, 2016
Re: Got an error while collapsing
Reply #10 - Aug 2nd, 2017 at 8:43am
Print Post  
Please have a look at the code.
As i am able to upload whole project because over here maximum size file is 300 KB only.
To run this attached project
1. You need to extract all three zip.
2. Run npm install in Angular2_mindfusion_example folder
3. Copy the files from folder name "extract_it_in_assets_mindfusion"  and paste it in "Angular2_Mindfusion_example\src\assets\mindfusion"
4. As i am using attached diagram library please copy and paste it in node_modules
5. Now try  run by npm start
6. You can see the result here  http://localhost:4200/

In this project I have created the app-diagram component which does all the things related to mind fusion.
To reproduce this issue you need check the below file present in diagram\diagram.component.ts
In function attachEvents over there i have attached the node click event.
  

diagram-library.zip ( 265 KB | 171 Downloads )
Angular2_Mindfusion_example.zip ( 143 KB | 154 Downloads )
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Got an error while collapsing
Reply #11 - Aug 2nd, 2017 at 2:25pm
Print Post  
Hi,

I don't see the fold/unfold buttons in your test page (I'm attaching a screenshot). What do we need to do in order to fold/unfold the containers?

Also, I saw in your onDiagramMouseDown handler you set the diagram to disabled - that prevents the nodeClicked event from firing.

Regards,
Lyubo
  

containers.png ( 18 KB | 139 Downloads )
containers.png
Back to top
 
IP Logged
 
Shafi
Full Member
***
Offline


I Love MindFusion!

Posts: 109
Joined: Nov 8th, 2016
Re: Got an error while collapsing
Reply #12 - Aug 3rd, 2017 at 6:40am
Print Post  
Sorry it was my mistake. if you can check we don't receive any click event after collapsing or expanding i.e. (+ or  - button). Mean while I will send you another ts which will also reproduce the issue reproduce the same issue while fold and unfold.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Got an error while collapsing
Reply #13 - Aug 3rd, 2017 at 8:12am
Print Post  
The nodeClicked event is not firing, because you're calling diagram.setEnabled(false) in your diagram mousedown handler, when the cursor is positioned over a node. When the diagram is disabled, click events are no longer raised by the control (this is by design). If you comment out the disabling code from your handler, you'll receive the event as expected.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Shafi
Full Member
***
Offline


I Love MindFusion!

Posts: 109
Joined: Nov 8th, 2016
Re: Got an error while collapsing
Reply #14 - Aug 10th, 2017 at 6:02am
Print Post  
Yes you are right if we comment that code it works but we are using this code for drag and drop and also you can see we are enabling the diagram onDiagramMouseUp. this must work?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint