Thanks Alexandre. Just managed to have a look at it. Very elegant. Sticking an element to the window border like that will have a lot of use for menus and status bars, however that wasn't quite what I needed - which was to translate the whole graph to stick an element to the bottom left. However with your template I managed to get what I needed with the following... ------------------- stickToBottomLeft: element Transcript crShow: '1> ', element view camera windowSize asString , ' -- ', element position asString, ' -- ', element model asString. "element view translateTo: ( 0 @ element view camera windowSize y - element position y - element height)." element view on: ROWindowResized do: [ :event | Transcript crShow: '2> ', event extent asString , ' -- ', element position asString, ' -- ', element model asString. element view translateTo: ( element position x negated @ (event extent y - element position y - element height )) ]. ------------------- #(1 2 3 4 5 6 7 8 9) do: "Easel script - note additional temp var elementToPin " [ :x | | element | rawView add: (element := ROElement spriteOn: x) + ROLabel. (x=7) ifTrue: [elementToPin := element]. ]. rawView add: (ROEdge lineFrom: rawView elements seventh to: rawView elements eighth). rawView add: (ROEdge lineFrom: rawView elements seventh to: rawView elements ninth). (ROHorizontalTreeLayout new verticalGap: 40; horizontalGap:60) on: rawView elements. ROConstraint stickToBottomLeft: elementToPin. rawView elements do: [ :el | el @ (ROMenuActivable new item: 'act' action: #inspect) ]. rawView elements do: [ :el | el @ (ROMenuActivable new item: 'Stick To Bottom Left' action: [ ROConstraint stickToBottomLeft: el ]) ]. ------------------- A few additional thoughts... 1. Note the second line of #stickToBottomLeft is commented-out. IT currently has no effect. The transcript shows #windowSize incorrectly returns 0@0. If you reverse the commenting so that only this executes you will see things end up out camera. It is the windowResize event that makes it work. 2. However without that second line, "ROMenuActivable new item: 'Stick To Bottom Left' " has no effect until the window is resized. 3. Actually for the ROMenuActivable to have an effect, the line "ROConstraint stickToBottomLeft: elementToPin." needs to be commented-out. Further, activating the ROMenuActivable a second time has no effect since the first one is still active. The transcript shows two ROConstraints being handled on window resize, but the original taking precedence. 4. It isn't necessarily just a single element that needs sticking. Ideally in the Easel example above element#7 could be stuck to the left side while element#9 is stuck to the bottom - but obviously that adds more complexity. 5. I don't necessarily need it to stick permanently to the bottom left, but only on the first display. cheers -ben Alexandre Bergel wrote: >> Could you try changing the Visualisation window size and then running the script. >> > > I've extended the camera to have the window size. > This will enable a range of new facilities (e.g., sticking an element to a window edge) > > >> btw, I notice that ROCamera is created in both ROAbstractCamvas>>initialize and ROView>>initialize. >> How do these relate? >> > > The idea of having a camera in ROAbstractCanvas>>initialize is to not have to clutter each method with "camera ifFalse: [ ^ self]" for example. > A canvas needs a camera to render things. Is the comment in this #initialize method not enough? What could be a better comment? > > >> P.S. just to remove doubt, I don't need this to be pinned dynamically the bottom left, just to set the default position of the layout. ) >> > > A student is working on centering layouts... It should come soon. > > >> P.P.S note that I will be wanting to use this from Glamour, and in particular in my project in the image you have previously downloaded in the mothod EpCimtest>>showClassRelationshipsSelected: just following the ROHorizontalTreeLayout (which you can leave for me to check) >> > > Ok > > Alexandre > > > >> >> >> >> Alexandre Bergel wrote: >> >>> Something like: >>> >>> #(1 2 3 4 5 6 7 8 9) do: >>> [ >>> :x | >>> rawView add: (ROElement spriteOn: x) + ROLabel. >>> ]. >>> rawView add: (ROEdge lineFrom: rawView elements seventh to: rawView elements eighth). >>> rawView add: (ROEdge lineFrom: rawView elements seventh to: rawView elements ninth). >>> (ROHorizontalTreeLayout new verticalGap: 40; horizontalGap:60) on: rawView elements. >>> >>> rawView elements do: [ :el | el @ (ROMenuActivable new item: 'act' action: #inspect) ]. >>> >>> rawView translateTo: 0 @ ((rawView elements collect: [:el | el position y + el height] ) max negated + rawView camera bounds height ). >>> >>> Cheers, >>> Alexandre >>> >>> On Nov 11, 2012, at 10:31 PM, Ben Coman >>> <btc@openInWorld.com> >>> wrote: >>> >>> >>> >>> >>>> With Roassal after applying a layout, I would like to be able to translate the graph such that the bottom left corner of the graph is displayed. Is there someway to do that already? >>>> I looked into ROFocusView, ROCanvas & ROCamera, but could not work it out what was needed. >>>> With the script below, the attached image is what I would like to see. >>>> >>>> "-------------" >>>> #(1 2 3 4 5 6 7 8 9) do: >>>> [ >>>> :x | >>>> rawView add: (ROElement spriteOn: x) + ROLabel. >>>> ]. >>>> rawView add: (ROEdge lineFrom: rawView elements seventh to: rawView elements eighth). >>>> rawView add: (ROEdge lineFrom: rawView elements seventh to: rawView elements ninth). >>>> (ROHorizontalTreeLayout new verticalGap: 40; horizontalGap:60) on: rawView elements. >>>> "HERE TRANSLATE CANVAS/CAMERA TO SHOW NODES 7, 8 & 9 IN THE BOTTOM LEFT CORNER OF WINDOW PANE" >>>> "-------------" >>>> >>>> cheers -ben >>>> >>>> <Roassal-how-to-show-bottom-left-corner.png>_______________________________________________ >>>> Moose-dev mailing list >>>> >>>> Moose-dev@iam.unibe.ch >>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>>> >>>> >>>> >>>> >>> >>> >>> >> _______________________________________________ >> Moose-dev mailing list >> Moose-dev@iam.unibe.ch >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> > >
_______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev