ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Layer alignment broken?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

whisper1980

USA
83 Posts

Posted - Dec 07 2019 :  17:27:56  Show Profile  Reply
I believe layer alignment worked fine in 8.7.0 because that is where I first added layer alignment in my app.

I just now tried it after updating to 8.7.6, and it does not work at all. For example, selecting a single rectangle layer and clicking to align left causes the rectangle pos to shift basically out of bounds:

Using these lines of code:
ImageEnView1.LayersRepositionAll(IELayer_Pos_Left, 0, true, false, false);
ImageEnView1.Update();

The rectangle goes from
pos: 701,1068 size: 525x274 to
pos: 2147483636,1068 size 525x274

I also do not see the rectangle anymore, just the dotted sizing lines.

Similar things occur for the other alignment options, for example:
Align top:
ImageEnView1.LayersRepositionAll(0, IELayer_Pos_Top, true, false, false);
From 709,1159
to: 709,2147483636

None of these work: left, top, right, bottom, center vert, center horz.

I think I see the problem... (I have not tested this theory yet)

In LayersRepositionAll you are assigning the new pos directly to PosXD and PosYD instead of PosX, PosY. In 8.7.0, when setting PosX IELayer_Pos_Left is checked for and sets PosXD to 0 but in setting PosXD directly in LayersRepositionAll that check is missing, so it ends up assigning IELayer_Pos_Left as the new actual X pos instead of 0.

Maybe something there?

Eric

xequte

38180 Posts

Posted - Dec 08 2019 :  10:52:05  Show Profile  Reply
Hi Eric

I'll need to investigate this when I'm back in the office in late December. Does changing loDynamicCanvas of ImageEnView1.LayerOptions make any difference?



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

whisper1980

USA
83 Posts

Posted - Dec 08 2019 :  18:25:41  Show Profile  Reply
That option makes no difference. Tracing the code seems to show that replacing those constants like IELayer_Pos_Top is not being replaced when setting PoxXD or PosYD directly like setting PosX/PosY does. Setting PosX eventually calls SetPosXD, but only after those constants have been looked at, conditionally setting the pos to the passed in value or to 0, i.e. if v < IELayer_Pos_Left then SetPosXD(v) else SetPosXD(0), but SetPosXD itself does not have this if statement and LayersRepositionAll now uses SetPosXD not SetPosX.



Eric
Go to Top of Page

xequte

38180 Posts

Posted - Dec 09 2019 :  03:12:55  Show Profile  Reply
Thanks for the investigation, Eric,

I'll get a fix in the next update.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

whisper1980

USA
83 Posts

Posted - Dec 09 2019 :  13:36:23  Show Profile  Reply
As a quick and dirty fix until you return in case others run into this, I made the following change to TImageEnView.LayersRepositionAll:

From:
aLayer.PosXD := newPosX;
aLayer.PosYD := newPosY;
To:
aLayer.PosX := Trunc(newPosX);
aLayer.PosY := Trunc(newPosY);


Eric
Go to Top of Page

xequte

38180 Posts

Posted - Jan 05 2020 :  23:11:30  Show Profile  Reply
Thanks, this is fixed for 8.7.7

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: