Hi all,
Has anyone worked out a method for drag-scrolling a group? I have a simple
game in which play area may be smaller than the working screenrect on some
screens. I lock the group so that it's always the same size as the stack
window, then I just set the scroll of the group to show part of the play area
that is in view. I've worked out how to do it using the scroll wheel on the
mouse, but I also want to be able to drag the play area around with the mouse.
It's "sort of" working, but is moving very jerkily.
I'm doing this:
local sDragging, sMouseV, sMouseH
on mouseUp
put false into sDragging
end mouseUp
on mouseRelease
put false into sDragging
end mouseRelease
on mouseDown
if the height of this stack < the maxHeight of this stack OR \
the height of this stack < the maxHeight of this stack then
put true into sDragging
else
put false into sDragging
end if
put the mouseV into sMouseV
put the mouseH into sMouseH
end mouseDown
on mouseMove pNewMouseH, pNewMouseV
if sDragging then
set the hScroll of me to the hScroll of me - (pNewMouseH -sMouseH)
set the vScroll of me to the vScroll of me - (pNewMouseV - sMouseV)
end if
end mouseMove
My math brain is not very sharp today. Ideas?
Thanks,
Devin
Devin Asay
Learn to code with LiveCode University
http://university.livecode.com
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode