Slip, sliding away

-hh hh at hh.on-rev.com
Mon Jul 25 05:53:07 EDT 2016


Script your grouped image with the following.

local iAmDragged=false

on mouseDown
  set lockloc of me to true
  put the loc of me into iL
  put item 1 of iL into i1
  put item 2 of iL into i2
  lock cursor; set cursor to hand
  put true into iAmDragged
  dragMeInGrp i1,i2,the mouseH-i1,the mouseV-i2
end mouseDown

on dragMeInGrp L1,L2,dx,dy
  if not iAmDragged then exit dragMeInGrp
  if the shiftkey is down then -- drag only horizontal
    set loc of me to (-dx+the mouseH,L2)
  else if the optionkey is down then -- drag only vertical
    set loc of me to (L1,-dy+the mouseV)
  else -- drag in both directions
    set loc of me to (-dx+the mouseH,-dy+the mouseV)
  end if
  send "dragMeInGrp L1,L2,dx,dy" to me in 8 millisecs
end dragMeInGrp
  
on mouseUp
  unlock cursor; put false into iAmDragged
end mouseUp

on mouseRelease
  mouseUp
end mouseRelease


Richmond wrote
> I made a loooong rectangular image (3 times wider than my stack) and 
> grouped it
> 
> into a group the width of my stack and gave it a horizontal scrollbar; 
> so I can scroll the image
> 
> laterally using the scrollbar . . . surprise, surprise; and jolly s*xy 
> it looks too.
> 
> I would look even s*xier if it had NO scrollbar and I could do some sort
> of
> 
> 'constrained grab'/scroll by doing a mouseDown & horizontal drag on the 
> image within the group.
> 
> 
> Does anyone know how to do this.
> 
> Just to stimulate interest, the reason is that I want to do this sort of 
> thing
> 
> in Livecode: http://www.stefanv.com/calculators/aristo970/index.html
> 
> Richmond.
> 
> 
> _______________________________________________
> use-livecode mailing list

> use-livecode at .runrev

> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Slip-sliding-away-tp4706994p4706997.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list