Author |
Topic |
|
zerob
164 Posts |
Posted - Nov 12 2024 : 08:38:59
|
When i load some SVG's i've downloaded from the internet with LayersImport. After this, i group the layers it creates together ( This .svg creates multiple layers. Some lines and some ornaments).
1. Bug: When i resize the larger ornaments, the line layer gets resized strangely, as it gets diagonal instead of making the line thicker and still horizontal. This gets worse, the larger the line gets.
2. Bug: Then, when i shrink the ornament layer by mouse and get it to a certain size and resize it back, then the grouped line layer gets really huge (not relative to the size difference it had to the other layers).
When i resize that ornament layer to 3 pixels and back, then the linked line layer gets extremely huge and never shrinks down. All sizing begins to lag and stutter.
Conclusion: My issues, shouldn't the line layer just get higher instead of becomming a diagonal line? Second issue, the calculation for the line layer gets bugy, as soon as the other layers get really small, and never recover from this.
I've sent you a mail with a demo and a video. |
|
xequte
38619 Posts |
Posted - Nov 18 2024 : 23:03:46
|
Hi
Thank you for sending a video to illustrate this issue.
1. The logic used for a line layer is that the line runs from the top-left to the bottom right of its containing box. So if you enlarge it, you will change the angle of the line. Unfortunately, when grouped this has the effect of changing the look of the image in an unexpected manner.
There's not really a good solution here (without changing the existing line logic and breaking all the existing applications that rely on it).
The correct method would probably be to move the line rather than enlarge its box when it is sized as a group, but that would make it behave differently from sizing it by itself, so not a great solution.
2. I'm still looking into this one... |
|
|
zerob
164 Posts |
Posted - Nov 19 2024 : 01:56:09
|
Hi Nigel Thanks for looking into this :-) How about (i know, this is complicating things), letting the user chose if the line layer should react correctly or in the broken way that it was until now? Inkscape and all vector apps draw it horizontally and just make the line thicker when resizing a layer. All things that behave unexpectetly and strange, make designing with imageen hard. (Well, never try to resize a Line, and never try to group a line or import a SVG or PSD because then it fails. Draw that line fresh, each time you want to resize it some pixels, or don't do lines at all) All workarounds needed, make the apps bad and disliked by the public. But i understand you, it might be a huge and complicated task and adding yet another property to alter inner workings makes things complicated. |
|
|
xequte
38619 Posts |
Posted - Nov 19 2024 : 20:33:35
|
There is another option and that is to convert it from a line to a polygon. Then sizing it will enlarge the shape rather than change the start and end point. You will need the latest beta, and can convert a line to to a polygon layer, using:
ImageEnView1.CurrentLayer.ConvertToPolylineLayer( True );
It is still not perfect, because rectangular selection does not have a clear purpose with 1D objects.
Nigel Xequte Software www.imageen.com
|
|
|
zerob
164 Posts |
Posted - Nov 20 2024 : 09:28:44
|
Thanks, i will try it out, when you send me that beta. Yeah, would be nice if there was a way that didn't require me to change stuff in the graphics, or to loop through all layers and check if they need to be converted, but it always is nice to have at least some solution. :-) |
|
|
zerob
164 Posts |
Posted - Nov 20 2024 : 09:54:02
|
I discovered a new bug, while enabling some temporary workaround until this gets fixed.
I set a TImageEnView.OnDrawLayerGrip event and then did draw the left and right grid, to not allow changing the height.
On the small line layers, the grip gets the function to draw a [1, 3] instead of my [4, 5] and the cursor gets into that cursor, and im able to resize the layer (not in the way i planed).
Only after the layer gets bigger in height, the [4, 5] grips get working as intended.
It seems that there is a minimum height set for left and right sizing to be allowed, even on Line Layers and even when forced by me?
Also the help file has a small error... You forgot to set a "var iec: TIECanvas;" in the event.
This is my event i did, that didn't work until the height got larger:
var iec: TIECanvas;
begin
if grip in [4,5] then
begin
iec := TIECanvas.Create( ABitmap.Canvas );
IEDrawGrip( iec, rect, ImageEnView1.GetLayersGripStyle() );
iec.Free();
end;
4 Left side 5 Right side 1 Right-top 3 Left-bottom |
|
|
xequte
38619 Posts |
Posted - Nov 20 2024 : 15:22:35
|
Sorry, I added that code to the demo you emailed me, but don't see any issue (I see grips at all four corners regardless of the size). Can you give me some precise steps to reproduce it.
Nigel Xequte Software www.imageen.com
|
|
|
zerob
164 Posts |
Posted - Nov 20 2024 : 15:52:50
|
In my demo, i just commented out the Grouping and added a OnDrawLayerGrip. Then, when i click the lines, i get two grips. When i move the mouse over that grips, i see top right sizing and bottom left sizing Cursors, and im able to resize the line like if that grip really where top right and bottom left grips (not the ones left and right 4 and 5 i wanted, but it was 1 and 3, top right and bottom left).
As soon as the line layer is sized this way by mouse, these two grips switch to my left and right sizing grips and work as intended. But on the loaded line, before sizing, they don't change left and right of the line, but resize it top right and bottom left. And i wanted to block hight changes by drawing only left side and right side (4 and 5) grips.
It seems that the line layer does block my grips (left and right) until the height is bigger, and then it works again.
var iec: TIECanvas;
begin
if grip in [4,5] then
begin
iec := TIECanvas.Create( ABitmap.Canvas );
IEDrawGrip( iec, rect, ImageEnView1.GetLayersGripStyle() );
iec.Free();
end; |
|
|
zerob
164 Posts |
Posted - Nov 20 2024 : 16:08:39
|
I think i got something wrong in my understanding... I thought by not drawing the Grips, i would remove the ability to size the layer in that way and also hiding these cursors. But this way i only hide the Grips, without removing any ability.
Is there a way to disable handling of any of the Grip positions to disable some sizing, or do i need to disable autocursor (but that also hides the cursor i want), and set an event on sizemove and force the height to stay the same? |
|
|
xequte
38619 Posts |
|
zerob
164 Posts |
Posted - Nov 21 2024 : 03:46:01
|
But what if i only want to let the user change the width and x position of a line layer and not the hight? I can force the hight on onlayermovesize, but i can't disable the grip and the cursor change on the grip location that i want to disable. I don't want to set "AutoCursor := False" as i want the cursor to be seen for the grips i want to show. And i also don't want the user to be able to still click on the invisible grip "top right", to still fire that event and be able to size outside of that grip. Is there a way to say "don't make a grip and don't handle events on these grip positions i don't want to allow" and disable showing grips and cursors or firing events on these locations? So if somebody clicks on "top right" then not the topright event is handled but the "clicked on some other part that selects and maybe handles moving"
property SizingGripsAndHandling: [sgLeft, sgRight]; |
|
|
xequte
38619 Posts |
|
zerob
164 Posts |
Posted - Nov 22 2024 : 13:22:40
|
Height changes alone doesn't do the trick, as then the Line will just move up and down and there is also no way to know the old value. So i would need to track x, y, width, height and set it again, overwrite it on the right event value, otherwise, when just tracking the old height, then the line will still move when you grab the diagonal top right position.
I don't know if many people would write into this topic, but i guess that this feature would also be helpful with other layers (limiting on how sizing would be possible).
I don't want to block code changes, just mouse changes, so there is an idea to shrink the work needed: You certainly check for the mouse position somewhere to change the cursor and initiate the sizing on click inside a grip? Can't you just do a property to exclude or include some corners and then check for it on mouse over (for the cursor) and on mouse click (for the sizing and the check if there is a grip) and just say if(mouseInGrip in excludedGrips) then do nothing and Exit or tell that it clicked on non grip area. mouseInGrip := noGripJustLayerOrEmpty
|
|
|
xequte
38619 Posts |
Posted - Nov 24 2024 : 19:10:06
|
Hi
Here is an example of preventing line layers from being sized (can only be made longer):
// Allow line layers to be made longer (horizontally or vertically), but not sized
procedure TForm1.ImageEnView1LayerMoveSize(Sender: TObject; layer: Integer;
event: TIELayerEvent; var PosX, PosY, Width, Height: Double);
var
isHorz: Boolean;
begin
if ( event = ielResizing ) and ( ImageEnView1.Layers[layer] is TIELineLayer ) then
begin
isHorz := ImageEnView1.Layers[layer].Width > ImageEnView1.Layers[layer].Height;
if isHorz then
begin
PosY := ImageEnView1.Layers[layer].PosY;
Height := ImageEnView1.Layers[layer].Height
end
else
begin
PosX := ImageEnView1.Layers[layer].PosX;
Width := ImageEnView1.Layers[layer].Width;
end;
end;
end;
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|
|
|