[Cuis-dev] Elastic Morph

Hilaire Fernandes hfern at free.fr
Thu May 4 05:47:27 PDT 2023


Hi,

In a row (or a column), when I want one morph to be at the left and the 
other one at the right (here a LabelMorph and a WheelMorph) :

row

I use a kind of elastic morph to fill the content between the two morphs 
with a transparent Morph (line 5):

1
2
3
4
5
6
7

	

	"Install the wheels at the right"
	col  :=  LayoutMorph  newColumn  name:  #wheelsYZ.
	col  addMorph:  self  zoomWheel  layoutSpec:  (
		LayoutSpec  fixedExtent:  DrGeoSystem  wheelWidth  @  DrGeoSystem  wheelHeight).
	col  addMorphUseAll:  self  transparentMorph.
	col  addMorph:  self  verticalWheel  layoutSpec:  (
		LayoutSpec  fixedExtent:  DrGeoSystem  wheelWidth  @  DrGeoSystem  wheelHeight).			

Is there a better way of doing this? I think about embedding the second 
morph (the wheel) in an additional column with alignment set to right, 
but this adds complexity to the code and make it harder to understand.

transparentMorph
^  BoxedMorph  new  
    borderWidth:  0;
    color:  Color  transparent;
    yourself

If there is not better way we could add an helper method to LayoutMorph, 
say addElastic, that will do just that:

LayoutMorph>>addElastic
    self  addMorphUseAll:  (BoxedMorph  new
	borderWidth:  0;
	color:  Color  transparent;
	yourself)

Thanks

Hilaire

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230504/69628624/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran de 2023-05-04 14-34-36.png
Type: image/png
Size: 8248 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230504/69628624/attachment.png>


More information about the Cuis-dev mailing list