Hello
I noticed something in the following experiment:
As an example, exactly at the mouse cursor position inside the TImageEnView I want to create a ellipse shape layer (fix 50px size for this example) via the OnMouseDown event. Do you have any idea what would be a better event for this task?
I have chosen the center of the circle for the origin. But if, for example, the ruler is displayed on the left, the X coordinates from the event are not correct. They have exactly the offset from the width of the ruler.
Of course this can be worked around as seen below, but I think if depending on how the vert/horz rulers are visible, the X and Y coordinates should already be passed to the correct mouse positions or not?
The simple code snippet below only works correct for view 100% of course. So how we can get the correct mouse position "inside" the control canvas area (depening on zoom, rulers etc.)? So that the circle can be always placed correctly on the center point of the mouse cursor position.
procedure TMainForm.ImageEnViewMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ImageEnView.LayersAddEx(ielkShape,
(X-ImageEnView.RulerParams.VertWidth) - 25,
Y - 25,
50,
50);
end;
Thanks a lot!