Rog
Rog

Reputation: 17170

Reference enclosing frame in PaintCode expression

I'm trying to use paint code to draw a roundrect with different corner radii. I have nearly everything working by drawing two circles and two roundrects. The problem is I can't make one of the roundrects draw at x offset circle radius have width of "frame.width - circle_radius" - the end effect being it keeps aligned to the right hand edge of the frame.

shapes

It feels like I should be able to write frame.width - largeCornerRadius in an expression editor but PaintCode objects to the frame reference.

That said, i's beginning to feels like I could write this code quicker by hand :-)

Upvotes: 5

Views: 576

Answers (3)

Tricertops
Tricertops

Reputation: 8512

I see this question is old, but let me show how to achieve this using Springs & Struts.

Resizable rounded rect with different corner radii

Let’s use 2 circles and 2 rounded rectangle, each having only one corner rounded, just like you have. Once you draw a Frame around these shapes, their Springs & Struct inspector becomes enabled.

Inspector for resizing

Here you can click each of 6 segments to toggle fixed or flexible dimension for each shape. For Red Circle, make flexible only top and right margin (just like on the image above) and for Blue Circle the opposite margins (bottom and left). Then for both rectangles make flexible size and fixed margins.

Inspector for rectangle

For more information, check out our videos, blog, and documentation on this topic.

– PaintCode Support

Upvotes: 0

chepiok
chepiok

Reputation: 245

You can also :

  • use a set of rect, oval or other shapes
  • select them and "union" to get one bezier curve for the whole shape
  • selection each point (or a set of points) of the resulting bezier and fix springs on each of them as fixed or fluid from the edge of the surrounding frame.

Upvotes: 0

Rog
Rog

Reputation: 17170

I don't have an answer to my specific stated question but I have discovered a better way to draw my roundrect as four different rects and turning off the roundrects on the "inner corners:

enter image description here

As you'd expect the drawing code is much better and it resizes well with the enclosing frame.

Upvotes: 1

Related Questions