[Cuis-dev] [ANN] Cuis-Smalltalk-RoadTrip idle game + a question on implementing a ZoomPanMorph

Juan Vuletich juan at cuis.st
Fri Mar 8 04:38:37 PST 2024


On 3/7/2024 11:33 AM, Ian Jeffries via Cuis-dev wrote:
> > Welcome to the Cuis community!
>
> Glad to be here, what a cool project. I'm very fond of small things in 
> software, especially for fun (small in scope that is, not in the 
> amount of work since getting something small isn't easy).

Yep. The difference between "simple" and "easy"!

>
> I'll go ahead and respond about the things I've already done, and 
> leave the rest for a later message.
>
> > But then I tried to understand what was going on with your code, and I
> > found a bug in the Cuis image, Rectangle class >> #center:extent: This
> > is the real reason for the jerking you see. I just pushed an update for
> > that. Please pull & install. It will be much better.
>
> Amazing! Thank you. I wasn't sure about posting before my car "game" 
> even had roads, now I'm glad I did.
>
> > One last comment. You'd add ‘JSON’ as a prerequisite to your package, so
> > it is loaded automatically if needed.
>
> Done!
>
> > My first thought was "you'd use a PluggableScrollPane". You can put a
> > simpler morph, that knows nothing about panning and scaling in a
> > ScrollPane, and play with the halo to scale it. Most likely
> > PluggableScrollPane could use some tweaks (like handling the scaling,
> > and the pan / zoom gestures), but it is not far from what you need.
> > Separating RoadTrip from Zoom/Pan issues, by composing them instead of
> > subclassing, is better IMO. Besides, in places like City>>drawOn: you're
> > hiding cities out of bounds yourself, while PluggableScrollPane already
> > clips for you. At least that what I'd do.
>
> That does seem better. There's a wrinkle though in my case though: I 
> don't want to set `clipsSubmorphs` to true since I want to be able to 
> use the car's halo to move it off of the map. Having the car drive 
> across the screen to get back to the game has melted people's minds 
> when I show them Cuis.

Hehehe. Yes, that's cool!

> So directly using the strategy of `PluggableScrollPane` is out, since 
> my understanding is it works by a combination of moving the interior 
> morph around while clipping what part of it's shown with 
> `clipsSubmorphs`. I'll think about this some more.

Right. Your approach is perfectly fine and works great.

> More to follow once I've tried out your code. Thank you for the help 
> and encouragement.
>

You're most welcome!

Wrt the code I included before, what it does is to keep at the same 
pixel position whe place under the cursor. I feel it is the intuitive 
behavior.


Cheers,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240308/930c1382/attachment.htm>


More information about the Cuis-dev mailing list