Page 1 of 2

Dragging a big image in a smaller "canvas"

Posted: Sun Jul 08, 2018 9:00 am
by kortezzzz
Hi,

My question is about a very simple feature you'll probably find in the android\web world.
Lets say we've determined an image "canvas" in FS with a size of 200X200 pxls. Now, we are loading in to it a 400X400 pxls image. I need a mouse feature that allows me to drag to the left\right\down\up to see the hidden parts of the image. Does anyone knows how to do it?

Thnaks :)

Re: Dragging a big image in a smaller "canvas"

Posted: Sun Jul 08, 2018 10:54 am
by nix
I have done this before in a piano roll.
I think you will best start by hooking it up to sliders-
imo start there mate,
and then you can use the mouse over on the image itself
I can up the piano roll if you like, actually- here 'tis->
DS_RC2017.fsm
(371.92 KiB) Downloaded 1018 times

I think this is for 3081
The view scroll is the slider on the left of grid

Re: Dragging a big image in a smaller "canvas"

Posted: Sun Jul 08, 2018 1:45 pm
by Nubeat7
here is a zoom and scroll bitmap window i did a while ago..

Re: Dragging a big image in a smaller "canvas"

Posted: Sun Jul 08, 2018 3:51 pm
by kortezzzz
Thanks guys, those are great examples and a great starting points, but I ment scrolling without extra sliders. Only with mouse cursor. I mean like every time you point the image and push the cursor+left button pressed, the whole image moves to the dragged direction.

Re: Dragging a big image in a smaller "canvas"

Posted: Sun Jul 08, 2018 8:00 pm
by martinvicanek
Here is a very basic hand tool. No boundary checking etc., just plain click&drag. Can you take it from there?

Re: Dragging a big image in a smaller "canvas"

Posted: Mon Jul 09, 2018 7:57 am
by kortezzzz
martinvicanek wrote:Here is a very basic hand tool. No boundary checking etc., just plain click&drag. Can you take it from there?


That's great martin :) Thanks.

No success with determining the bounderies. Can you please explain how?

Re: Dragging a big image in a smaller "canvas"

Posted: Mon Jul 09, 2018 8:45 am
by tulamide
martinvicanek wrote:Here is a very basic hand tool. No boundary checking etc., just plain click&drag. Can you take it from there?
Wow, Martin! You've evolved a lot since the early days. Keep it going!

I corrected a few bits, used syntax and style according to the style guide and added boundary checks. Now some people in the past have reacted strangely, so if you don't want me to correct your code, just say so. It will spare me the work, and I won't mind it.

Re: Dragging a big image in a smaller "canvas"

Posted: Mon Jul 09, 2018 9:01 am
by RJHollins
Works real nice Tulamide.

Re: Dragging a big image in a smaller "canvas"

Posted: Mon Jul 09, 2018 11:09 am
by tulamide
RJHollins wrote:Works real nice Tulamide.

Thanks! But I've only added the boudary checks, the rest is Martin's work!

Re: Dragging a big image in a smaller "canvas"

Posted: Mon Jul 09, 2018 1:25 pm
by kortezzzz
Thanks tulamide, it works perfectely :D

tulamide wrote:I corrected a few bits, used syntax and style according to the style guide and added boundary checks. Now some people in the past have reacted strangely, so if you don't want me to correct your code, just say so. It will spare me the work, and I won't mind it.


Why should anyone refuse to such a possitive tribute? If someone already decided to shares something, what's the point in refusing to customizing it or even improving it? that's one of the forum's best benefits :roll:
Please guys, don't push us into that dirrection.

Thanks!!! :)