[lively-kernel] First stab at iPhone/iPad support

Dan Ingalls danhhingalls at gmail.com
Sun May 9 10:45:49 CEST 2010

Folks -

I've just committed a bunch of changes that enable one to play with 
Apple touch-based devices.  Just point your iPad at...
(the latest release), and it should automatically do the right thing 
for your device.

There are three changes:

1.  A toggle between "zoom/pan mode" and "mouse mode", indicated in 
code by whether UserAgent.touchIsMouse is false or true respectively. 
Form the user's standpoint, this is pretty simple:  If the cursor 
looks like a normal cursor, then you are in "mouse mode";  if it 
looks like a little blue pentagon, then you are in zoom/pan mode. 
Lively will switch modes if you click (touch briefly) in an 
unoccupied part of the world.

2.  Pie menus are enabled so that you can copy and drag objects and 
invoke their menus without needing modifier keys.  Although it's a 
bit sluggish, pie menus will do their best to help you out -- in 
other words if you simply click down and up, they will give you the 
normal object menu with an extra "pie menu help" item at the top. 
The help menu will list all the pie menu choices in a regular menu 
where you can read them and even activate them.  The current settings 

	12:00	undo (~)
	1:30	duplicate (o-->o)
	3:00	move (o-->)
	4:30	scale (o<O)
	6:00	show/hide handles
	7:30	delete (X)
	9:00	edit style (<>)
	10:30	rotate (G)

The test in parentheses appears on the pie menu, so this is a short 
form of documentation.  Some helpful mnemonics:
	Make more objects (dup) is directly across from delete
	Scale and rotate are directly opposite each other too
	Can you see the capital G as a rotate arrow?  ;-)

In the world the pie menu just gives you area selection plus an item 
for invoking zoo/pan mode (O).

3.  Rollovers don't work on a touch screen, so we have to activate 
the shape editing handles manually.  This is accomplished by a 
downward stroke on an object.  Do it again and the handles will go 

With these three changes, everything begins to be usable except for 
text input, and except that things are pretty slow and somewhat hard 
to use.  [You can test all of this on a fast laptop by putting 
"UserAgent.isTouch = true" in your localconfig.js file]. 
Nonetheless, I have actually managed to have a bit of fun with it on 
both my iPhone and an iPad already.

About the UI...
The current approach is one solution, and we can be glad to have 
that.  However, since putting in the persistent handles, I've been 
thinking of another solution that is closer to what we did for 
Squeak.  I'm hoping to actually make this work so we can play with 
both approaches.  Here's how the other one would work:

A quick click on any object "selects" it.  This means that a bunch of 
icons appear around it corresponding to the pie menu choices above. 
This corresponds to Squeak's "halos".  A second quick click will 
cause selection to expand out to the morph's owner and so on out to 
the world.  A long (unmoving) click will bring up the object's menu, 
and a drag will pick the object up and move it, as is normally the 

Please try this stuff out and make suggestions.  And if you get text 
input working before me, that would be nice, too.  Please tell me if 
you plan to do this, so I can do something else at the same time.

	- Dan

More information about the lively-kernel mailing list