Dragging a big image in a smaller "canvas"

For general discussion related FlowStone
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Dragging a big image in a smaller "canvas"

Post 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 :)
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

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

Post 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 1017 times

I think this is for 3081
The view scroll is the slider on the left of grid
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

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

Post by Nubeat7 »

here is a zoom and scroll bitmap window i did a while ago..
Attachments
zoom sxroll.fsm
(586.65 KiB) Downloaded 986 times
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

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

Post 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.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

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

Post by martinvicanek »

Here is a very basic hand tool. No boundary checking etc., just plain click&drag. Can you take it from there?
Attachments
MovableBitmapDisplay.fsm
(4.05 KiB) Downloaded 945 times
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

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

Post 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?
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

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

Post 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.
Attachments
MovableBitmapDisplay[Martin, tulamide].fsm
(11.9 KiB) Downloaded 1019 times
"There lies the dog buried" (German saying translated literally)
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

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

Post by RJHollins »

Works real nice Tulamide.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

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

Post by tulamide »

RJHollins wrote:Works real nice Tulamide.

Thanks! But I've only added the boudary checks, the rest is Martin's work!
"There lies the dog buried" (German saying translated literally)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

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

Post 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!!! :)
Post Reply