B4J Question B4XCanvas: why lines are cut ?

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Trying to use B4XCanvas for the first time.
Trying to join red point by drawing the yellow lines.
B4XCanvas is tied to the container placed over the image, but strange that the area where lines are visible - is limited sometimes, when app window is maximized:

1735750080855.jpeg


Fullscreen:
1735750102769.jpeg
Dimensions of the lines container is changed together with dimensions of the imageview.
Lines like placed into a box when app window is big.
What is wrong ?
 
Solution
Solved: B4XCanvas must also be ... _Resized, when class' root container is _Resized.

B4X:
Public Sub Base_Resize (Width As Double, Height As Double)
    pnl.SetLayoutAnimated(0, 0, 0, Width, Height)
    Reset
    canvas.Resize(Width, Height)
End Sub

Cableguy

Expert
Licensed User
Longtime User
If I understand correctly, the dots are not place onto the canvas, right?
I am guessing the coordinates scheme changes with the re-dimensioning of the image. Try to first place the dots on the same canvas plane, and once that works with the zoom, then connecting the dots will be a breeze.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
place the dots on the same canvas plane
It's not so simple as just say...

It's Erel's code of ZoomImageView with several containers.
Some for dragging, some for zooming. One of them contains the ImageView.
I added the container for dots and cursor, and mouse events...

And now added the container for drawing lines that must be ... over the ImageView, transparent for mouse clicks...
It cannot have the same container with the Imageview - drawn lines are ... not visible under image :)

Why all is OK while container is small sized ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Some edge variant when the app window is big, but not fullscreen:
1735752139772.jpeg
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Solved: B4XCanvas must also be ... _Resized, when class' root container is _Resized.

B4X:
Public Sub Base_Resize (Width As Double, Height As Double)
    pnl.SetLayoutAnimated(0, 0, 0, Width, Height)
    Reset
    canvas.Resize(Width, Height)
End Sub
 
Last edited:
Upvote 1
Solution
Top