[Pharo-dev] SVG described countries in Roassal

Alexandre Bergel alexandre.bergel at me.com
Sat Nov 16 15:44:01 EST 2013


Hi!

I had fun understanding how countries may be described using SVG.
Here is a first shoot:



Moving the mouse above a country name highlight the country. You can now rehearse your geography.

The complete source code of this example is:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view element nameComponent label |
view := ROView new.

ROSVGPath countries do: [ :k |
	element := (ROSVGPath path: (ROSVGPath perform: k)) elementOn: k.
	view add: element.
]. 

nameComponent := ROElement new.
ROSVGPath countries do: [ :k |
	label := ROLabel elementOn: k asString.
	label @ ROLightlyHighlightable.
	label on: ROMouseEnter do: [ :event | ROBlink highlight: (view elementFromModel: event model asSymbol) ].
	label on: ROMouseLeave do: [ :event | ROBlink unhighlight: (view elementFromModel: event model asSymbol) ].
	nameComponent add: label.
].
ROGridLayout new
	gapSize: -3;
	lineItemsCount: 15;
	on: nameComponent elements.
	
view add: nameComponent.
nameComponent translateTo: 0 @ 400.

view openInWindowSized: 1000 @ 700
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131116/34a4aae3/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2013-11-16 at 5.36.21 PM.png
Type: image/png
Size: 157547 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131116/34a4aae3/attachment.png>


More information about the Pharo-dev mailing list