Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Operation node: overlayNode (Read 2499 times)
D
Full Member
***
Offline


I Love MindFusion!

Posts: 158
Joined: Mar 16th, 2020
Operation node: overlayNode
Apr 6th, 2020 at 8:28am
Print Post  
Drag the edge or diagonal of overlayNode to change the size of overlayNode. How to achieve this?
  

44.jpg (Attachment deleted)
55.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Operation node: overlayNode
Reply #1 - Apr 6th, 2020 at 10:04am
Print Post  
Hi,

To enable interactions on nodes make sure the ShapeNode.Locked property is set to false and the setting of Diagram.Behavior permits interactions with the items - i.e. it's not set to Pan or DoNothing.

You will probably need to invalidate the visuals of the background node from the overlay nodes NodeModfied handler to update the transparency layer.

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


I Love MindFusion!

Posts: 158
Joined: Mar 16th, 2020
Re: Operation node: overlayNode
Reply #2 - Apr 6th, 2020 at 11:01am
Print Post  
Thank you very much for your answer, Lyubo.
Do you say "please make sure the ShapeNode.Locked property is set to false" refers to setting imageNode.Locked and overlayNode.Locked to false? Also, I do n’t quite understand what you said about “The visual effect of covering the background node in NodeModfied handler is invalid to update the transparent layer”. Is there any sample code?
cs:
        private void ImageManipulation(string path)
{
var myImage = new BitmapImage(new Uri(path, UriKind.Relative));

var imageWidthPx = myImage.PixelWidth * GetScreenDpi() / myImage.DpiX;
var imageHeightPx = myImage.PixelHeight * GetScreenDpi() / myImage.DpiY;
var imageWidth = GraphicsUnit.Pixel.Convert(imageWidthPx, diagram.MeasureUnit);
var imageHeight = GraphicsUnit.Pixel.Convert(imageHeightPx, diagram.MeasureUnit);

imageNode = diagram.Factory.CreateShapeNode(0, 0, imageWidth, imageHeight);
imageNode.Image = myImage;
imageNode.Shape = Shapes.Rectangle;
imageNode.CustomDraw = CustomDraw.Additional;
imageNode.ImageAlign = ImageAlign.Fit;
//overlayNode = diagram.Factory.CreateShapeNode(0, 0, 150, 150);
var overlayNodeWidth = 100;
var overlayNodeHeight = 100;

overlayNode = diagram.Factory.CreateShapeNode(imageNode.Bounds.Right - overlayNodeWidth,
imageNode.Bounds.Bottom - overlayNodeHeight, overlayNodeWidth, overlayNodeHeight);
overlayNode.Shape = Shapes.Rectangle;
overlayNode.Brush = Brushes.Transparent;
overlayNode.StrokeThickness = 0.8;
overlayNode.Stroke = new SolidColorBrush(Color.FromArgb(120, 12, 236, 13));
overlayNode.Locked = true;
overlayNode.AttachTo(imageNode, AttachToNode.BottomRight);
}
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Operation node: overlayNode
Reply #3 - Apr 6th, 2020 at 11:42am
Print Post  
Hi,

The Locked property of the node that you wish to interact with.

D wrote on Apr 6th, 2020 at 11:01am:
Also, I do n’t quite understand what you said about “The visual effect of covering the background node in NodeModfied handler is invalid to update the transparent layer”.


Haven't said that anywhere. What I said is to make sure the transparent layer is invalidated for redrawing after you've interacted with the node. And as it stands in your example, that can be achieved by calling imageNode.InvalidateVisual(); from a overlayNode's NodeModifed event handler.

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


I Love MindFusion!

Posts: 158
Joined: Mar 16th, 2020
Re: Operation node: overlayNode
Reply #4 - Apr 6th, 2020 at 1:31pm
Print Post  
Thank you so much, Lyubo. Smiley I know that my code is definitely wrong, please guide me to correct it and
how to add NodeModifed event handler for overlayNode.
  

4_6_14.png (Attachment deleted)
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint