ImageViewer panning out of boundaries when zooming

52 views
Skip to first unread message

Carlos Verdier

unread,
Jan 21, 2021, 4:43:18 AM1/21/21
to CodenameOne Discussions
Hi

I have noticed a chage of behavior on ImageViewer recently. Now, when zooming, the image can go offlimits when panning, which is not convinient at all.

Could you please take a look? Here is a test case:

        Form hi = new Form("Viewer", new BorderLayout());
       
FontImage img = FontImage.createMaterial(FontImage.MATERIAL_IMAGE, UIManager.getInstance().getComponentStyle("Label"), 20f);      
       
ImageViewer viewer = new ImageViewer(img) {
           
int cilckCount = 0;
           
@Override
           
public void pointerReleased(int x, int y) {
                cilckCount
++;
               
new UITimer(() -> cilckCount = 0).schedule(500, false, hi);
               
if (cilckCount > 1) {
                    cilckCount
= 0;                    
                   
if (this.getZoom() > 1) {
                       
this.setZoom(1);
                   
} else {
                       
this.setZoom(2);
                   
}
               
}
           
}            
       
};
        hi
.add(BorderLayout.CENTER, viewer);
        hi
.show();    

Thanks.

Shai Almog

unread,
Jan 22, 2021, 5:34:05 AM1/22/21
to CodenameOne Discussions

Carlos Verdier

unread,
Jan 22, 2021, 6:32:00 AM1/22/21
to CodenameOne Discussions
Yes, it works as expected reverting the fix.

Shai Almog

unread,
Jan 23, 2021, 1:08:47 AM1/23/21
to CodenameOne Discussions
Thanks, we'll look into it.

Carlos Verdier

unread,
Mar 6, 2021, 6:38:52 AM3/6/21
to CodenameOne Discussions
Has this problem been addressed? I still see the same issue.

Shai Almog

unread,
Mar 6, 2021, 9:21:45 PM3/6/21
to CodenameOne Discussions
I don't know. I'll check.

CodenameOne Discussions

unread,
Mar 8, 2021, 7:58:33 AM3/8/21
to CodenameOne Discussions
I tried your test case and can't seem to reproduce what you're describing.  Can you provide some instructions on how to use your test case to demonstrate the issue?

Carlos Verdier

unread,
Mar 8, 2021, 2:06:52 PM3/8/21
to CodenameOne Discussions
Just double tap on the image to zoom and then pan it around. You will see that you can pan outside the boundaries, which should not happen. If you style the form background color, the failure is more evident.

If you revert the changes that Shai points out above, it works as it should.

Steve Hannah

unread,
Mar 10, 2021, 8:21:45 AM3/10/21
to codenameone...@googlegroups.com
OK.  I see what you mean.  I should have a fix for Friday.

On Mon, Mar 8, 2021 at 11:06 AM Carlos Verdier <cver...@gmail.com> wrote:
Just double tap on the image to zoom and then pan it around. You will see that you can pan outside the boundaries, which should not happen. If you style the form background color, the failure is more evident.

If you revert the changes that Shai points out above, it works as it should.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/caf919f8-d5ea-47e8-8a96-a975762b483co%40googlegroups.com.


--
Steve Hannah
Software Developer
Codename One

Carlos Verdier

unread,
Mar 10, 2021, 9:16:12 AM3/10/21
to CodenameOne Discussions
Great, thank you.

Steve Hannah

unread,
Mar 10, 2021, 12:03:48 PM3/10/21
to codenameone...@googlegroups.com

On Wed, Mar 10, 2021 at 6:16 AM Carlos Verdier <cver...@gmail.com> wrote:
Great, thank you.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages