Displaying a jpg photo larger than my liveCode window ?

Mike Bonner bonnmike at gmail.com
Fri Jun 19 09:38:23 EDT 2015


Put the image into a group, size and place the group, then set the lockloc
to true.

I was going to use mouseMove for this, but I couldn't get it to behave as I
liked, and its too early to figure out why, so I used a send loop instead.

Add this code to your group:

local sMouseLoc
on mouseDown
   put the mouseloc into sMouseLoc -- set the start mouse position
   setScroll -- start the loop
end mouseDown

on setScroll
   if the mouse is down then -- only set the scroll while the mouse is down
      if item 1 of sMouseLoc > item 1 of the mouseloc then --this if block
sets the hscroll
         set the hscroll of me to the hscroll of me - (item 1 of the
mouseloc - item 1 of sMouseLoc)
      else
         set the hscroll of me to the hscroll of me + (item 1 of sMouseLoc
- item 1 of the mouseloc)

      end if

      if item 2 of sMouseLoc > item 2 of the mouseloc then -- this if block
sets the vscroll
         set the vscroll of me to the vscroll of me - (item 2 of the
mouseloc - item 2 of sMouseLoc)
      else
         set the vscroll of me to the vscroll of me + (item 2 of sMouseLoc
- item 2 of the mouseloc)

      end if
      put the mouseloc into sMouseLoc
      send setScroll to me in 50 millisec
   else
      put empty into sMouseLoc
   end if
end setScroll


Theres no real need to check scroll bounds, the engine handles things just
fine.

I'm sure this could be greatly improved, but it should give you a general
idea.

On Fri, Jun 19, 2015 at 6:34 AM, Francis Nugent Dixon <effendi at wanadoo.fr>
wrote:

> Hi from Beautiful Brittany,
>
> I have a tiny problem (otherwise I wouldn’t ask for help) !
> I have a stack window of a reasonable size, but I want to
> display a jpg (or other) file in this window, but it is much
> larger. I want to be able to “click and slide” on my displayed
> photo, in much the same way as you do with a Google map,
> so I can see any part of the large photo within my LiveCode
> window..
>
> And I don’t even know where to start ….
>
> Any help gratefully received.
>
> -Francis
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list