[Ipe-discuss] How can I scale a rectangle only in length and preserve its width?

Tim Hutt tdhutt at gmail.com
Mon Jan 16 11:22:31 CET 2012


On 16 January 2012 10:07, elwood151 <elwood151 at web.de> wrote:
>
> Sometimes I have 2 identical rectangles like that
>
> <ipeselection pos="84.0589 700.408">
> <path matrix="0.991736 0 0 0.633987 9.19555 253.784" stroke="black">
> 75.4872 761.132 m
> 75.4872 720.514 l
> 136.547 720.514 l
> 136.547 761.132 l
> h
> </path>
> <path matrix="0.991736 0 0 0.633987 93.5383 253.783" stroke="black">
> 75.4872 761.132 m
> 75.4872 720.514 l
> 136.547 720.514 l
> 136.547 761.132 l
> h
> </path>
> </ipeselection>
>
> which are aligned at their top, for example,
>
> Lets call the left one rectangle "A" and the right one "B".
>
> I want to change the height of "A" (without changing its width and without
> changing the positions of its 2 upper edges) and then change the height of
> "B", so that it is again identical to "A".
>
> Is there a way to achieve that with snapping (and without drawing additional
> lines)?
> As soon as I use snapping, the width of the rectangle also changes according
> to the origin.

Yes. If I understand you correctly.

1. Turn on snap-to-vertex or snap-to-edge and hover over the top edge
of the rectangle.
2. Press F1
3. Press E (stretch)
4. Left-drag down the vertical green line.

Actually I just tried this and noticed (what I think is) a bug: If you
start your drag quite far down, away from the rectangles, they can
suddenly doubled in width. That shouldn't happen should it?

Ah, I guess the procedure I described wasn't really intended to work,
and it is trying to scale by 0/0 in the x direction.

It might be nice to add something like this to the scaling code:

if (xPos == xStartPos && angleSnap)
   xScale = 1

Actually that might be tricky to get right given the way scale behaves.

Anyway, a more robust way to do this:

1. Turn on snap-to-vertex or snap-to-edge and hover over the top edge
of the rectangle.
2. Press F1
3. Press F8 to turn off angle-snap.
4. Press F7 to turn on snap-to-grid.
3. Press E (stretch)
4. Left-drag down, to the right of the vertical green line, below the
rectangles.

Cheers,

Tim


More information about the Ipe-discuss mailing list