I have been looking at the ROExample "Nesting" examples and expanded
#nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. How can these be made for the circle layout to leave spacing between the middle node1 nodes? cheers -ben -------------------- | view nodes1 | view := ROView new. view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). nodes1 do: [:n | n addShape: ROLabel]. nodes1 do: [ :node1 | ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: [ :x | node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). ]. ROGridLayout on: node1 elements. ]. ROCircleLayout on: nodes1. view openInWindow. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Ben,
Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. How would you like to specific the layout? Cheers, Alexandre On Aug 30, 2012, at 6:10 PM, Ben Coman <[hidden email]> wrote: > I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. > How can these be made for the circle layout to leave spacing between the middle node1 nodes? > > cheers -ben > > -------------------- > | view nodes1 | > view := ROView new. > view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). > nodes1 do: [:n | n addShape: ROLabel]. > nodes1 do: > [ :node1 | > ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: > [ :x | > node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). > ]. > ROGridLayout on: node1 elements. > ]. > > ROCircleLayout on: nodes1. > view openInWindow. > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
About compositing, really I'm not sure yet. However I have a couple of thoughts that may be easier prior to full compositing. Referring to the attached images, you can see that the children shapes overlap the label shape of the parent, and also multiples within the one shape overlap. IT would help to have a way to offset shapes, and as a default the children should be offset below the label. One way to do that would be being able to specify an offset for shapes, and have some way for the user to set up the specific linking of the bounds. For instance, perhaps adding two label shapes at the top with the children nodes below. The user would have to specifically define the offset of the Take for instance this code for Roassal Easel... n1 := ROElement spriteOn: 'XX___'. n1 + (ROLabel new text: #model). n1 + (ROLabel new text: #bounds ). rawView add: n1. ...where the two labels overlap. I think you would gain a lot if you could do something like the following... n1 := ROElement spriteOn: 'XX___'. n1 + (shape1 := ROLabel new text: #model). n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). rawView add: n1. This should handle shape1 being a multi-line label. As a second stage, there should be some way to add text under the children nodes. The perhaps (only a wild guess) means that ROChildrenShape should not inherit from RONullShape to be forced to appear at the end of the list of shapes. Or perhaps since ROChildrenShape might be more coupled to the internals than other shapes, something like.... n1 := ROElement spriteOn: 'XX___' n1 + (shape1 := ROLabel new text: #model). n1 + (ROLabel new text: #bounds; offset: [ (shape1 bottomLeftCorner) + (n1 childrenShape bottomLeftCorner) ] ). rawView add: n1. Perhaps this is fairly rough - but it at least makes things possible. hope that makes sense :) cheers -ben Alexandre Bergel wrote: Hi Ben, Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. How would you like to specific the layout? Cheers, Alexandre On Aug 30, 2012, at 6:10 PM, Ben Coman [hidden email] wrote:I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. How can these be made for the circle layout to leave spacing between the middle node1 nodes? cheers -ben -------------------- | view nodes1 | view := ROView new. view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). nodes1 do: [:n | n addShape: ROLabel]. nodes1 do: [ :node1 | ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: [ :x | node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). ]. ROGridLayout on: node1 elements. ]. ROCircleLayout on: nodes1. view openInWindow. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev roassal simple composition.png (11K) Download Attachment roassal children overlapping parent label.png (3K) Download Attachment |
In reply to this post by abergel
I think the main problem I had was that the ROCircleLayout was determining its radius based only on the number of elements and not the size of the elements. So I've come up with a different approach - not quite finished but thought I'd share it now for some feedback. Using the same example from my original post. Existing ROCircleLayout>>doExecute resulting in [1] is due to this... radius := elements size * self scaleFactor. (btw could you change rad to radius anyway - for a while it confused be thinking this was a variable about radians) I found changing to the following gave a better result [2] targetCircumference := 0. elements do: [ :el | targetCircumference := targetCircumference + el bounds extent r ]. radius := targetCircumference / 2 / Float pi. However using 3 or 2 instead of 10 in the third line of that example still has overlaps [3] [4], so I was wondering what your thoughts were. Perhaps a fudge factor at those lower element counts. Also, probably this only works for elements that have the same bounds. With a mix of small and large elements some will probably still overlap - so I am thinking next of a more dynamic circle - that evens out the space between nodes and grows or shrinks the circumference as needed - leading into a force based one, that shifts connected elements around the circle to be closer to more connected elements. cheers -ben [1] ROCircleLayout-original-10nodes.png [2] ROCircleLayout-sumCircumference-10nodes.png [3] ROCircleLayout-sumCircumference-3nodes.png [4] ROCircleLayout-sumCircumference-2nodes.png Alexandre Bergel wrote: Hi Ben, Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. How would you like to specific the layout? Cheers, Alexandre On Aug 30, 2012, at 6:10 PM, Ben Coman [hidden email] wrote:I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. How can these be made for the circle layout to leave spacing between the middle node1 nodes? cheers -ben -------------------- | view nodes1 | view := ROView new. view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). nodes1 do: [:n | n addShape: ROLabel]. nodes1 do: [ :node1 | ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: [ :x | node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). ]. ROGridLayout on: node1 elements. ]. ROCircleLayout on: nodes1. view openInWindow. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev ROCircleLayout-original-10nodes.png (30K) Download Attachment ROCircleLayout-sumCircumference-10nodes.png (41K) Download Attachment ROCircleLayout-sumCircumference-3nodes.png (15K) Download Attachment ROCircleLayout-sumCircumference-2nodes.png (9K) Download Attachment |
Ben Coman wrote:
> My question was less about compositing and more about ROCircleLayout, so I've > split my response into two posts. > > I think the main problem I had was that the ROCircleLayout was determining its > radius based only on the number of elements and not the size of the elements. So > I've come up with a different approach - not quite finished but thought I'd > share it now for some feedback. Using the same example from my original post. > > Existing ROCircleLayout>>doExecute resulting in [1] is due to this... > radius := elements size * self scaleFactor. > (btw could you change rad to radius anyway - for a while it confused be thinking > this was a variable about radians) > > I found changing to the following gave a better result [2] > targetCircumference := 0. > elements do: [ :el | targetCircumference := targetCircumference + el bounds > extent r ]. > radius := targetCircumference / 2 / Float pi. > > However using 3 or 2 instead of 10 in the third line of that example still has > overlaps [3] [4], so I was wondering what your thoughts were. Perhaps a fudge > factor at those lower element counts. Also, probably this only works for > elements that have the same bounds. With a mix of small and large elements some > will probably still overlap - so I am thinking next of a more dynamic circle - > that evens out the space between nodes and grows or shrinks the circumference as > needed - leading into a force based one, that shifts connected elements around > the circle to be closer to more connected elements. > > cheers -ben > > [1] ROCircleLayout-original-10nodes.png > [2] ROCircleLayout-sumCircumference-10nodes.png > [3] ROCircleLayout-sumCircumference-3nodes.png > [4] ROCircleLayout-sumCircumference-2nodes.png > > Alexandre Bergel wrote: > > Hi Ben, > > > > Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. > > > > How would you like to specific the layout? > > > > Cheers, > > Alexandre > > > > > > On Aug 30, 2012, at 6:10 PM, Ben Coman <[hidden email]> wrote: > > > > > >> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. > >> How can these be made for the circle layout to leave spacing between the middle node1 nodes? > >> > >> cheers -ben > >> > >> -------------------- > >> | view nodes1 | > >> view := ROView new. > >> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). > >> nodes1 do: [:n | n addShape: ROLabel]. > >> nodes1 do: > >> [ :node1 | > >> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: > >> [ :x | > >> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). > >> ]. > >> ROGridLayout on: node1 elements. > >> ]. > >> > >> ROCircleLayout on: nodes1. > >> view openInWindow. > >> _______________________________________________ > >> Moose-dev mailing list > >> [hidden email] > >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > >> > > > > > > elements with a big different in their size in each axis, since even when neighbouring elements are well spaced, the seconds on over can still clash (see existing-circle-layout.png). To address this, my thinking is to selecting the element corner closest to the center to be pinned to the circle layout (see new-circle-layout.png). I wanted to share this concept with you early for your feedback. See attached changeset and these methods: ROCircleLayout>> ROExample>>newCircleLayout ROExample>>existingCircleLayout. cheers, ben [previous image attachments deleted] p.s. I saw your response to my other post. Looks interesting but its sleep time now so I will digest further tomorrow. 'From Pharo1.4 of 18 April 2012 [Latest update: #14457] on 7 September 2012 at 2:15:13 am'! !ROCircleLayout methodsFor: 'hook' stamp: 'BenComan 9/7/2012 01:45'! cornerOf: element nearestCenterForAngle: angle "For a rectangle placed 'angle' radians from a center point, return the corner closest to the centre" (angle sin) < 0 ifTrue: [ (angle cos) > 0 ifTrue: [ "top right quadrant, bottom left corner" ^ 0 @ element extent y negated. ] ifFalse: [ "top left quadrant, bottom right corner" ^ element extent x negated @ element extent y negated. ] ] ifFalse: [ (angle cos) > 0 ifTrue: [ "bottom right quadrant, top left corner" ^ 0 @ 0. ] ifFalse: [ "bottom left quadrant, top right corner" ^ element extent x negated @ 0. ] ] ! ! !ROExample methodsFor: 'layouts' stamp: 'BenComan 9/7/2012 01:59'! existingCircleLayout "self new existingCircleLayout" "For comparison to >>newCircleLayout" | radius view parentNode circle center el translator | view := ROView new. (Array with: 300@50 with:50@300 ) do: [ :testExtent | parentNode := (ROElement spriteOn: 'EXAMPLE NEW CIRCLE LAYOUT WITH EXTREME SIZES', testExtent asString) + ROLabel. view add: parentNode. #( -0.1 0.1 1.9 2.1 3.9 4.1 5.9 6.1 ) do: [ :n | el := (ROElement spriteOn: n) extent: testExtent. parentNode add: el. ]. (ROCircleLayout new scaleBy: 20) on: parentNode elements. ]. ROGridLayout on: view elements . view openInWindow.! ! !ROExample methodsFor: 'layouts' stamp: 'BenComan 9/7/2012 01:54'! newCircleLayout "self new newCircleLayout" "Concept still under development. Just demonstrating for discussion and testing ROCircleLayout>>cornerOf nearestCenterForAngle:" | radius view parentNode circle center el translator | radius := 70. translator := ROLayoutTranslator default. view := ROView new. (Array with: 300@50 with:50@300 ) do: [ :testExtent | parentNode := (ROElement spriteOn: 'EXAMPLE NEW CIRCLE LAYOUT WITH EXTREME SIZES', testExtent asString) + ROLabel. view add: parentNode. circle := (ROCircle new elementOn: 'circle') . circle size: (radius * 2). center := circle bounds center. parentNode add: circle. #( -0.1 0.1 1.9 2.1 3.9 4.1 5.9 6.1 ) do: [ :n | | angle | angle := n * Float pi / 4. el := (ROElement spriteOn: n) extent: testExtent. translator translate: el to: (Point radius: radius theta: angle) + center + (ROCircleLayout new cornerOf: el nearestCenterForAngle: angle). parentNode add: el. ]. ]. ROGridLayout on: view elements . view openInWindow.! ! _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev existing-circle-layout.png (31K) Download Attachment new-circle-layout.png (35K) Download Attachment |
In reply to this post by Ben Coman
Thanks Ben for all the effort you are putting in Roassal.
The core of Roassal should have the minimum amount tools to let one built any extensions. Currently, Roassal does not support a mechanism to compose shapes. It will probably come on some point. However, this future mechanism will not be at the core of Roassal. It should rather be done by having a small language on top of it. Is having an offset for shape be useful when come the time to have a FormBuilder? I have the impression that yes. I can work on it this week. Cheers, Alexandre On Sep 1, 2012, at 11:36 AM, Ben Coman <[hidden email]> wrote: > My question was less about compositing and more about ROCircleLayout, so I've split my response into two posts. > > About compositing, really I'm not sure yet. However I have a couple of thoughts that may be easier prior to full compositing. Referring to the attached images, you can see that the children shapes overlap the label shape of the parent, and also multiples within the one shape overlap. IT would help to have a way to offset shapes, and as a default the children should be offset below the label. One way to do that would be being able to specify an offset for shapes, and have some way for the user to set up the specific linking of the bounds. For instance, perhaps adding two label shapes at the top with the children nodes below. The user would have to specifically define the offset of the > > Take for instance this code for Roassal Easel... > n1 := ROElement spriteOn: 'XX___'. > n1 + (ROLabel new text: #model). > n1 + (ROLabel new text: #bounds ). > rawView add: n1. > > ...where the two labels overlap. I think you would gain a lot if you could do something like the following... > n1 := ROElement spriteOn: 'XX___'. > n1 + (shape1 := ROLabel new text: #model). > n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). > rawView add: n1. > > This should handle shape1 being a multi-line label. > > As a second stage, there should be some way to add text under the children nodes. The perhaps (only a wild guess) means that ROChildrenShape should not inherit from RONullShape to be forced to appear at the end of the list of shapes. Or perhaps since ROChildrenShape might be more coupled to the internals than other shapes, something like.... > n1 := ROElement spriteOn: 'XX___' > n1 + (shape1 := ROLabel new text: #model). > n1 + (ROLabel new text: #bounds; offset: [ (shape1 bottomLeftCorner) + (n1 childrenShape bottomLeftCorner) ] ). > rawView add: n1. > > Perhaps this is fairly rough - but it at least makes things possible. > > hope that makes sense :) > cheers -ben > > Alexandre Bergel wrote: >> Hi Ben, >> >> Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. >> >> How would you like to specific the layout? >> >> Cheers, >> Alexandre >> >> >> On Aug 30, 2012, at 6:10 PM, Ben Coman >> <[hidden email]> >> wrote: >> >> >> >>> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. >>> How can these be made for the circle layout to leave spacing between the middle node1 nodes? >>> >>> cheers -ben >>> >>> -------------------- >>> | view nodes1 | >>> view := ROView new. >>> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). >>> nodes1 do: [:n | n addShape: ROLabel]. >>> nodes1 do: >>> [ :node1 | >>> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: >>> [ :x | >>> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). >>> ]. >>> ROGridLayout on: node1 elements. >>> ]. >>> >>> ROCircleLayout on: nodes1. >>> view openInWindow. >>> _______________________________________________ >>> Moose-dev mailing list >>> >>> [hidden email] >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>> >>> >>> >> >> >> > > <roassal simple composition.png><roassal children overlapping parent label.png>_______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
The critical thing at the moment is to have the labels of children
elements not overlap the label of the parent element. For example...
------------- | view outer inner label | view := ROView new. outerLabel := (ROLabel new text: [ :el | el ]). innerLabel := (ROLabel new text: [ :el | el ]). outer := (ROElement on: 'outer element text should be easily visible by default') + outerLabel + ROBorder @ RODraggable. inner := (ROElement on: 'inner element text should not overlap outer') + innerLabel + ROBorder @ RODraggable. view add: (outer add: inner). view open ------------ Having an only an offset capability (rather than complex compositing) would I am hoping be sufficient to enable something like... inner := ((ROElement on: 'inner element text should not overlap outer') offset: #bottomLeft of: outerLabel ) + innerLabel + ROBorder @ RODraggable. Alexandre Bergel wrote: You are welcome. ActuallyThanks Ben for all the effort you are putting in Roassal. The core of Roassal should have the minimum amount tools to let one built any extensions. Currently, Roassal does not support a mechanism to compose shapes. It will probably come on some point. However, this future mechanism will not be at the core of Roassal. It should rather be done by having a small language on top of it. Is having an offset for shape be useful when come the time to have a FormBuilder? I have the impression that yes. I can work on it this week. Cheers, Alexandre On Sep 1, 2012, at 11:36 AM, Ben Coman [hidden email] wrote:My question was less about compositing and more about ROCircleLayout, so I've split my response into two posts. About compositing, really I'm not sure yet. However I have a couple of thoughts that may be easier prior to full compositing. Referring to the attached images, you can see that the children shapes overlap the label shape of the parent, and also multiples within the one shape overlap. IT would help to have a way to offset shapes, and as a default the children should be offset below the label. One way to do that would be being able to specify an offset for shapes, and have some way for the user to set up the specific linking of the bounds. For instance, perhaps adding two label shapes at the top with the children nodes below. The user would have to specifically define the offset of the Take for instance this code for Roassal Easel... n1 := ROElement spriteOn: 'XX___'. n1 + (ROLabel new text: #model). n1 + (ROLabel new text: #bounds ). rawView add: n1. ...where the two labels overlap. I think you would gain a lot if you could do something like the following... n1 := ROElement spriteOn: 'XX___'. n1 + (shape1 := ROLabel new text: #model). n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). rawView add: n1. This should handle shape1 being a multi-line label. As a second stage, there should be some way to add text under the children nodes. The perhaps (only a wild guess) means that ROChildrenShape should not inherit from RONullShape to be forced to appear at the end of the list of shapes. Or perhaps since ROChildrenShape might be more coupled to the internals than other shapes, something like.... n1 := ROElement spriteOn: 'XX___' n1 + (shape1 := ROLabel new text: #model). n1 + (ROLabel new text: #bounds; offset: [ (shape1 bottomLeftCorner) + (n1 childrenShape bottomLeftCorner) ] ). rawView add: n1. Perhaps this is fairly rough - but it at least makes things possible. hope that makes sense :) cheers -ben Alexandre Bergel wrote:Hi Ben, Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. How would you like to specific the layout? Cheers, Alexandre On Aug 30, 2012, at 6:10 PM, Ben Coman [hidden email] wrote:I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. How can these be made for the circle layout to leave spacing between the middle node1 nodes? cheers -ben -------------------- | view nodes1 | view := ROView new. view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). nodes1 do: [:n | n addShape: ROLabel]. nodes1 do: [ :node1 | ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: [ :x | node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). ]. ROGridLayout on: node1 elements. ]. ROCircleLayout on: nodes1. view openInWindow. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev<roassal simple composition.png><roassal children overlapping parent label.png>_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by abergel
Alexandre Bergel wrote:
> Thanks Ben for all the effort you are putting in Roassal. > > You are most welcome. Actually I have been meaning for a while to compliment your leadership of Roassal - by which I mean your enthusiastic and consistent response to discussion. In some respect perhaps I should not have spent time digging into some of corners of Roassal that I have, but you have made it very easy to be drawn in to improving it when I feel contributions are given reasonable consideration. cheers -ben _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
+1
On Sep 11, 2012, at 5:44 PM, Ben Coman wrote: > Alexandre Bergel wrote: >> Thanks Ben for all the effort you are putting in Roassal. >> >> > You are most welcome. Actually I have been meaning for a while to compliment your leadership of Roassal - by which I mean your enthusiastic and consistent response to discussion. In some respect perhaps I should not have spent time digging into some of corners of Roassal that I have, but you have made it very easy to be drawn in to improving it when I feel contributions are given reasonable consideration. > cheers -ben > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Ben Coman
I am very happy to hear these kind words in our little community. Please keep up the good spirit!
Cheers, Doru -- www.tudorgirba.com "Every thing has its own flow." On 11.09.2012, at 17:44, Ben Coman <[hidden email]> wrote: > Alexandre Bergel wrote: >> Thanks Ben for all the effort you are putting in Roassal. >> >> > You are most welcome. Actually I have been meaning for a while to compliment your leadership of Roassal - by which I mean your enthusiastic and consistent response to discussion. In some respect perhaps I should not have spent time digging into some of corners of Roassal that I have, but you have made it very easy to be drawn in to improving it when I feel contributions are given reasonable consideration. > cheers -ben > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
+1
:) On Sep 12, 2012, at 8:45 AM, Tudor Girba wrote: > I am very happy to hear these kind words in our little community. Please keep up the good spirit! > > Cheers, > Doru > > -- > www.tudorgirba.com > > "Every thing has its own flow." > > On 11.09.2012, at 17:44, Ben Coman <[hidden email]> wrote: > >> Alexandre Bergel wrote: >>> Thanks Ben for all the effort you are putting in Roassal. >>> >>> >> You are most welcome. Actually I have been meaning for a while to compliment your leadership of Roassal - by which I mean your enthusiastic and consistent response to discussion. In some respect perhaps I should not have spent time digging into some of corners of Roassal that I have, but you have made it very easy to be drawn in to improving it when I feel contributions are given reasonable consideration. >> cheers -ben >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Ben Coman
Hi Ben!
> ...where the two labels overlap. I think you would gain a lot if you could do something like the following... > n1 := ROElement spriteOn: 'XX___'. > n1 + (shape1 := ROLabel new text: #model). > n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). > rawView add: n1. I have improved the way shapes are drawn. If you update, you can then create the following class: -=-=-=-=-=-=-=-=-=-=-=-= ROShape subclass: #ROTranslatingShape instanceVariableNames: 'offset' initialize super initialize. offset := 0 @ 0 chainedDrawOn: aCanvas for: aROElement aROElement translateBy: offset negated. super chainedDrawOn: aCanvas for: aROElement. aROElement translateBy: offset. offset: aPoint offset := aPoint -=-=-=-=-=-=-=-=-=-=-=-= I've attached the .cs for convenience. You can then do the following: el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + ROBox . el extent: 50 @ 50. el @ RODraggable. rawView add: el. Without the translation, you have el := ROElement new + ROBorder + ROBox . el extent: 50 @ 50. el @ RODraggable @ ROPopup. rawView add: el. I haven't included ROTranslatingShape in Roassal. I first would like to see use cases of it. Let me know how it goes. Cheers, Alexandre > > > Alexandre Bergel wrote: >> Hi Ben, >> >> Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. >> >> How would you like to specific the layout? >> >> Cheers, >> Alexandre >> >> >> On Aug 30, 2012, at 6:10 PM, Ben Coman >> <[hidden email]> >> wrote: >> >> >> >>> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. >>> How can these be made for the circle layout to leave spacing between the middle node1 nodes? >>> >>> cheers -ben >>> >>> -------------------- >>> | view nodes1 | >>> view := ROView new. >>> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). >>> nodes1 do: [:n | n addShape: ROLabel]. >>> nodes1 do: >>> [ :node1 | >>> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: >>> [ :x | >>> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). >>> ]. >>> ROGridLayout on: node1 elements. >>> ]. >>> >>> ROCircleLayout on: nodes1. >>> view openInWindow. >>> _______________________________________________ >>> Moose-dev mailing list >>> >>> [hidden email] >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>> >>> >>> >> >> >> > > <roassal simple composition.png><roassal children overlapping parent label.png>_______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev ShapeTranslation.1.cs (1K) Download Attachment Screen Shot 2012-09-15 at 9.55.39 AM.png (9K) Download Attachment Screen Shot 2012-09-15 at 10.02.19 AM.png (9K) Download Attachment |
Thanks. Got to crash right now. Will look at it in the morning.
Alexandre Bergel wrote: Hi Ben!...where the two labels overlap. I think you would gain a lot if you could do something like the following... n1 := ROElement spriteOn: 'XX___'. n1 + (shape1 := ROLabel new text: #model). n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). rawView add: n1.I have improved the way shapes are drawn. If you update, you can then create the following class: -=-=-=-=-=-=-=-=-=-=-=-= ROShape subclass: #ROTranslatingShape instanceVariableNames: 'offset' initialize super initialize. offset := 0 @ 0 chainedDrawOn: aCanvas for: aROElement aROElement translateBy: offset negated. super chainedDrawOn: aCanvas for: aROElement. aROElement translateBy: offset. offset: aPoint offset := aPoint -=-=-=-=-=-=-=-=-=-=-=-= I've attached the .cs for convenience. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
> Thanks. Got to crash right now. Will look at it in the morning.
Let me know how it goes! Cheers, Alexandre > > Alexandre Bergel wrote: >> Hi Ben! >> >> >> >>> ...where the two labels overlap. I think you would gain a lot if you could do something like the following... >>> n1 := ROElement spriteOn: 'XX___'. >>> n1 + (shape1 := ROLabel new text: #model). >>> n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). >>> rawView add: n1. >>> >>> >> >> I have improved the way shapes are drawn. If you update, you can then create the following class: >> >> -=-=-=-=-=-=-=-=-=-=-=-= >> ROShape subclass: #ROTranslatingShape >> instanceVariableNames: 'offset' >> >> initialize >> super initialize. >> offset := 0 @ 0 >> >> chainedDrawOn: aCanvas for: aROElement >> aROElement translateBy: offset negated. >> super chainedDrawOn: aCanvas for: aROElement. >> aROElement translateBy: offset. >> >> offset: aPoint >> offset := aPoint >> -=-=-=-=-=-=-=-=-=-=-=-= >> >> I've attached the .cs for convenience. >> >> >> >> >> >> You can then do the following: >> >> el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + ROBox . >> el extent: 50 @ 50. >> el @ RODraggable. >> rawView add: el. >> >> >> >> >> >> <Mail Attachment.png> >> >> >> >> Without the translation, you have >> >> el := ROElement new + ROBorder + ROBox . >> el extent: 50 @ 50. >> el @ RODraggable @ ROPopup. >> rawView add: el. >> >> >> >> >> >> <Mail Attachment.png> >> >> >> >> >> I haven't included ROTranslatingShape in Roassal. I first would like to see use cases of it. >> Let me know how it goes. >> >> Cheers, >> Alexandre >> >> >> >> >>> Alexandre Bergel wrote: >>> >>> >>>> Hi Ben, >>>> >>>> Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. >>>> >>>> How would you like to specific the layout? >>>> >>>> Cheers, >>>> Alexandre >>>> >>>> >>>> On Aug 30, 2012, at 6:10 PM, Ben Coman >>>> >>>> <[hidden email]> >>>> >>>> wrote: >>>> >>>> >>>> >>>> >>>> >>>>> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. >>>>> How can these be made for the circle layout to leave spacing between the middle node1 nodes? >>>>> >>>>> cheers -ben >>>>> >>>>> -------------------- >>>>> | view nodes1 | >>>>> view := ROView new. >>>>> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). >>>>> nodes1 do: [:n | n addShape: ROLabel]. >>>>> nodes1 do: >>>>> [ :node1 | >>>>> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: >>>>> [ :x | >>>>> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). >>>>> ]. >>>>> ROGridLayout on: node1 elements. >>>>> ]. >>>>> >>>>> ROCircleLayout on: nodes1. >>>>> view openInWindow. >>>>> _______________________________________________ >>>>> Moose-dev mailing list >>>>> >>>>> >>>>> [hidden email] >>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> <roassal simple composition.png><roassal children overlapping parent label.png>_______________________________________________ >>> Moose-dev mailing list >>> >>> [hidden email] >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>> >>> >>> >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list >> >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> >> > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by abergel
Attached is "ShapeTranslation-20120916a-bencoman.st" containing some simple use cases for ROTranslatingShape as well as "ROTranslatingShape-usecases.png" containing compiled screenshots. Having worked through those use cases, it seems that how the offset shapes affect the element extent needs to be considered - particular in relation to mouse events. For example, if an element is made up of two shapes at opposite corners, then the blank space at the other two corners remains selectable to drag the element, which might not be quite right. So as wild and uninformed speculation... I wonder if rather than the element registering for events, the individual shapes might register for events and forward them on to the element for processing. cheers -ben Alexandre Bergel wrote: Hi Ben!...where the two labels overlap. I think you would gain a lot if you could do something like the following... n1 := ROElement spriteOn: 'XX___'. n1 + (shape1 := ROLabel new text: #model). n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). rawView add: n1.I have improved the way shapes are drawn. If you update, you can then create the following class: -=-=-=-=-=-=-=-=-=-=-=-= ROShape subclass: #ROTranslatingShape instanceVariableNames: 'offset' initialize super initialize. offset := 0 @ 0 chainedDrawOn: aCanvas for: aROElement aROElement translateBy: offset negated. super chainedDrawOn: aCanvas for: aROElement. aROElement translateBy: offset. offset: aPoint offset := aPoint -=-=-=-=-=-=-=-=-=-=-=-= I've attached the .cs for convenience. ROShape subclass: #ROTranslatingShape instanceVariableNames: 'offset' classVariableNames: '' poolDictionaries: '' category: 'RoassalTest'! !ROTranslatingShape methodsFor: 'rendering' stamp: 'BenComan 9/16/2012 13:35'! chainedDrawOn: aCanvas for: aROElement aROElement translateBy: self offset negated. super chainedDrawOn: aCanvas for: aROElement. aROElement translateBy: self offset. ! ! !ROTranslatingShape methodsFor: 'initialize' stamp: 'AlexandreBergel 9/15/2012 09:51'! initialize super initialize. offset := 0 @ 0! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 11:24'! offset ^ offset value! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 11:24'! offset: aBlockReturningPoint offset := aBlockReturningPoint! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 12:35'! usecase1 " self new usecase1 " " More showing how it operates than a use case. Showing that all shapes to the right of ROTranslatingShape are shifted. However cannot drag element using the point just below top border. " | rawView el | rawView := ROView new. el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + (ROCircle color: Color blue) + (ROBox) . el extent: 50 @ 50. el @ RODraggable. rawView add: el. rawView open! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:19'! usecase2 " self new usecase2 " " At the moment, the prime need for offset capability is showing the parent label above child elements. It is good that when dragging a child element upwards the label also moves up. However the dragging of elements is offset, eg the point just above bottom border does not drag the element. Note the ROBorder that is commented out. Not critical, but it would be good to put border around the ROLabel where it sits above the ROChildrenContainer, except without the bottom of it cutting across child container. Might be useful to be able to re-use that Shape>>draw:For: methods with a custom bounds rather than getting it from the element. " | rawView outer outerLabel | rawView := ROView new. outer := (ROElement on: 'Child nodes should not overlap this heading text') + ROBorder + (ROTranslatingShape new offset: 0 @ -20) + ROLabel "+ ROBorder". 1 to: 6 do: [ :n | outer add: (ROElement spriteOn: n). ]. outer extent: 50 @ 50. outer @ RODraggable. rawView add: outer. ROGridLayout new applyOn: outer elements. rawView open! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:27'! usecase3 " self new usecase3 " " Also later may want to put put labels below the child element area. " | view outer outerLabel | view := ROView new. outer := (ROElement on: 'Child nodes should not overlap this HEADER text. Try menu on view background.'). outerLabel := ROLabel new. outer + ROBorder + (ROTranslatingShape new offset: [ 0 @ (outerLabel heightFor: outer) negated ] ) + (ROLabel new text: [ :el | el model asString]) . 1 to: 2 do: [ :n | outer add: (ROElement spriteOn: n). ]. outer extent: 50 @ 50. outer @ RODraggable. view add: outer. view @ (ROMenuActivable new item: 'Change text' action: [ outer model: 'Child nodes should not overlap this HEADER text even when it dynamically changes to multiple lines'. outer signalUpdate] ). ROVerticalLineLayout new applyOn: outer elements. view open.! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:27'! usecase4 " self new usecase4 " " Dragging elements 1 & 2 upwards moves doesn't overlap labels with outer label - good. However inital layout has element 2 label overlapped by bottoms of element 1. " | view outer outerLabel | view := ROView new. outer := (ROElement on: 'Child nodes should not overlap this HEADER text'). outerLabel := ROLabel new. outer + ROBorder + (ROTranslatingShape new offset: [ 0 @ (outerLabel heightFor: outer) negated ] ) + (ROLabel new text: [ :el | el model asString]) . 1 to: 2 do: [ :n | | el | el := (ROElement spriteOn: n). el + (ROTranslatingShape new offset: [ 0 @ (ROLabel new heightFor: el) negated ] ) + (ROLabel new text: [ :el3 | el3 model asString, ' should not be overlapped' ]). outer add: el. 1 to: 2 do: [ :n2 | | el2 | el2 := (ROElement spriteOn: n*n2). el add: el2. ]. ROHorizontalLineLayout new applyOn: el elements. ]. outer extent: 50 @ 50. outer @ RODraggable. view add: outer. view @ (ROMenuActivable new item: 'Change text' action: [ outer model: outer model, ' even when it dynamically changes to multiple lines'. outer signalUpdate] ). ROVerticalLineLayout new applyOn: outer elements. view open.! ! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:37'! usecase5 " self new usecase5 " " Maybe later want to put labels below the child element area. Probably want to reference 'ROChildrenShape>>extent' rather than 'outer extent' since other shaps translations may alter the extent of the element. This doesn't opearte as expected, which should be to have three elements laid out in the column " | view outer outerLabel | view := ROView new. outer := (ROElement on: 'Child nodes should not overlap this FOOTER text, even when nodes are added - see menu. '). outerLabel := ROLabel new. outer + ROBorder + (ROTranslatingShape new offset: [ 0 @ (outer extent y) ] ) + (ROLabel new text: [ :el | el model asString]) . 1 to: 2 do: [ :n | outer add: (ROElement spriteOn: n) + ROLabel. ]. outer extent: 50 @ 50. outer @ RODraggable. view add: outer. view @ (ROMenuActivable new item: 'Add node' action: [ outer add: (ROElement spriteOn: 'extra') + ROBorder + ROLabel. ROVerticalLineLayout new applyOn: outer elements. outer signalUpdate ] ). ROVerticalLineLayout new applyOn: outer elements. view open.! ! _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev ROTranslatingShape-usecases.png (41K) Download Attachment |
Another use case: centering a label on an object, in this case a circle
shape.
Not sure if this is the most appropriate use but just brainstorming... see attached file-in. Ben Coman wrote: Thanks for looking at this Alexandre. That is an interesting approach. I had been considering that each shape might just store an offset internally that cold be set. Attached is "ShapeTranslation-20120916a-bencoman.st" containing some simple use cases for ROTranslatingShape as well as "ROTranslatingShape-usecases.png" containing compiled screenshots. Having worked through those use cases, it seems that how the offset shapes affect the element extent needs to be considered - particular in relation to mouse events. For example, if an element is made up of two shapes at opposite corners, then the blank space at the other two corners remains selectable to drag the element, which might not be quite right. So as wild and uninformed speculation... I wonder if rather than the element registering for events, the individual shapes might register for events and forward them on to the element for processing. cheers -ben Alexandre Bergel wrote: > Hi Ben! > > >> ...where the two labels overlap. I think you would gain a lot if you could do something like the following... >> n1 := ROElement spriteOn: 'XX___'. >> n1 + (shape1 := ROLabel new text: #model). >> n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). >> rawView add: n1. >> > > I have improved the way shapes are drawn. If you update, you can then create the following class: > > -=-=-=-=-=-=-=-=-=-=-=-= > ROShape subclass: #ROTranslatingShape > instanceVariableNames: 'offset' > > initialize > super initialize. > offset := 0 @ 0 > > chainedDrawOn: aCanvas for: aROElement > aROElement translateBy: offset negated. > super chainedDrawOn: aCanvas for: aROElement. > aROElement translateBy: offset. > > offset: aPoint > offset := aPoint > -=-=-=-=-=-=-=-=-=-=-=-= > > I've attached the .cs for convenience. > > -------------------------------------------------------------------------------- > > > > You can then do the following: > > el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + ROBox . > el extent: 50 @ 50. > el @ RODraggable. > rawView add: el. > > > > -------------------------------------------------------------------------------- > > -------------------------------------------------------------------------------- > > > > Without the translation, you have > > el := ROElement new + ROBorder + ROBox . > el extent: 50 @ 50. > el @ RODraggable @ ROPopup. > rawView add: el. > > > > -------------------------------------------------------------------------------- > > -------------------------------------------------------------------------------- > > > > > I haven't included ROTranslatingShape in Roassal. I first would like to see use cases of it. > Let me know how it goes. > > Cheers, > Alexandre > > > >> Alexandre Bergel wrote: >> >>> Hi Ben, >>> >>> Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. >>> >>> How would you like to specific the layout? >>> >>> Cheers, >>> Alexandre >>> >>> >>> On Aug 30, 2012, at 6:10 PM, Ben Coman >>> [hidden email] >>> wrote: >>> >>> >>> >>> >>>> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. >>>> How can these be made for the circle layout to leave spacing between the middle node1 nodes? >>>> >>>> cheers -ben >>>> >>>> -------------------- >>>> | view nodes1 | >>>> view := ROView new. >>>> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). >>>> nodes1 do: [:n | n addShape: ROLabel]. >>>> nodes1 do: >>>> [ :node1 | >>>> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: >>>> [ :x | >>>> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). >>>> ]. >>>> ROGridLayout on: node1 elements. >>>> ]. >>>> >>>> ROCircleLayout on: nodes1. >>>> view openInWindow. >>>> _______________________________________________ >>>> 'From Pharo1.4 of 18 April 2012 [Latest update: #14457] on 16 September 2012 at 8:20:35 pm'! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 20:20'! usecase6 " self new usecase6 " " Place the ROLabel central to the element. However I can't work out how to get the label both centered as well as drawn in front of the circle. In the first try, the text is centered on but behind the circle. In the second second try, the text is in front but not centered on the circle. Properly the offset should be something like (circle center - circleLabel center), but not sure how to do the latter Also center-justified text would be good at some point. " | view circle circleLabel | view := ROView new. circle := (ROElement on: 'this is near the center'). circleLabel := ROLabel new text: [ :el | el model asString]. circle extent: 200 @ 200. circle @ RODraggable. circle + ROBorder + (ROCircle new color: (Color lightGreen alpha: 0.8) )+ (ROTranslatingShape new offset: (circle center) ) + circleLabel . "first try" "circle + ROBorder + (ROTranslatingShape new offset: (circle center) ) + circleLayout + (ROCircle new color: (Color lightGreen alpha: 0.8) ) . " "second try" "circleLabel inspect." "btw, if you comment this line, you will see that the extent of the circleLayout has not been updated from default 5@5" view add: circle . view open.! ! _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
A further use case #7: drawing an electrical transformer and
associated labeling.
[1] shows many more shapes I need to draw - however upon reflection, perhaps these are better implemented using primitives in a #drawOn:For: method for each. [1] http://www.red-bag.com/imageslib/BN-DS-E2_02.pdf Ben Coman wrote: Another use case #6: centering a label on an object, in this case a circle shape. Not sure if this is the most appropriate use but just brainstorming... see attached file-in. Ben Coman wrote: > Thanks for looking at this Alexandre. That is an interesting approach. I had > been considering that each shape might just store an offset internally that cold > be set. > > Attached is "ShapeTranslation-20120916a-bencoman.st" containing some simple use > cases for ROTranslatingShape > as well as "ROTranslatingShape-usecases.png" containing compiled screenshots. > > Having worked through those use cases, it seems that how the offset shapes > affect the element extent needs to be considered - particular in relation to > mouse events. For example, if an element is made up of two shapes at opposite > corners, then the blank space at the other two corners remains selectable to > drag the element, which might not be quite right. So as wild and uninformed > speculation... I wonder if rather than the element registering for events, the > individual shapes might register for events and forward them on to the element > for processing. > > cheers -ben > > Alexandre Bergel wrote: > > Hi Ben! > > > > > >> ...where the two labels overlap. I think you would gain a lot if you could do something like the following... > >> n1 := ROElement spriteOn: 'XX___'. > >> n1 + (shape1 := ROLabel new text: #model). > >> n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). > >> rawView add: n1. > >> > > > > I have improved the way shapes are drawn. If you update, you can then create the following class: > > > > -=-=-=-=-=-=-=-=-=-=-=-= > > ROShape subclass: #ROTranslatingShape > > instanceVariableNames: 'offset' > > > > initialize > > super initialize. > > offset := 0 @ 0 > > > > chainedDrawOn: aCanvas for: aROElement > > aROElement translateBy: offset negated. > > super chainedDrawOn: aCanvas for: aROElement. > > aROElement translateBy: offset. > > > > offset: aPoint > > offset := aPoint > > -=-=-=-=-=-=-=-=-=-=-=-= > > > > I've attached the .cs for convenience. > > > > -------------------------------------------------------------------------------- > > > > > > > > You can then do the following: > > > > el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + ROBox . > > el extent: 50 @ 50. > > el @ RODraggable. > > rawView add: el. > > > > > > > > -------------------------------------------------------------------------------- > > > > -------------------------------------------------------------------------------- > > > > > > > > Without the translation, you have > > > > el := ROElement new + ROBorder + ROBox . > > el extent: 50 @ 50. > > el @ RODraggable @ ROPopup. > > rawView add: el. > > > > > > > > -------------------------------------------------------------------------------- > > > > -------------------------------------------------------------------------------- > > > > > > > > > > I haven't included ROTranslatingShape in Roassal. I first would like to see use cases of it. > > Let me know how it goes. > > > > Cheers, > > Alexandre > > > > > > > >> Alexandre Bergel wrote: > >> > >>> Hi Ben, > >>> > >>> Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. > >>> > >>> How would you like to specific the layout? > >>> > >>> Cheers, > >>> Alexandre > >>> > >>> > >>> On Aug 30, 2012, at 6:10 PM, Ben Coman > >>> [hidden email] > >>> wrote: > >>> > >>> > >>> > >>> > >>>> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. > >>>> How can these be made for the circle layout to leave spacing between the middle node1 nodes? > >>>> > >>>> cheers -ben > >>>> > >>>> -------------------- > >>>> | view nodes1 | > >>>> view := ROView new. > >>>> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). > >>>> nodes1 do: [:n | n addShape: ROLabel]. > >>>> nodes1 do: > >>>> [ :node1 | > >>>> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: > >>>> [ :x | > >>>> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). > >>>> ]. > >>>> ROGridLayout on: node1 elements. > >>>> ]. > >>>> > >>>> ROCircleLayout on: nodes1. > >>>> view openInWindow. > >>>> _______________________________________________ > >>>> > > > > -------------------------------------------------------------------------------- > > -------------------------------------------------------------------------------- > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev 'From Pharo1.4 of 18 April 2012 [Latest update: #14457] on 16 September 2012 at 9:08:32 pm'! ROShape subclass: #ROCircle instanceVariableNames: 'borderColor borderWidth' classVariableNames: '' poolDictionaries: '' category: 'Roassal-Core'! !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 21:06'! usecase7 " self new usecase7 " " Need to have elements that represent electrical symbols: eg http://www.red-bag.com/imageslib/BN-DS-E2_02.pdf Here we implement a transformer as an example - see page 11. " | view circle circleLabel transformer transformerLabel | view := ROView new. transformer := (ROElement on: 'N080111' ) @ RODraggable. "N080111 is an example equipment tag for a particular transformer" transformer attributes at: #rating put: '7MVA'. "Properly these attributes would be ivars of the transformer model, but fake it for demo purposes" transformer attributes at: #impedance put: '15%'. transformerLabel := ROLabel new text: [ :element | (element attributes at: #rating ifAbsent: '??MVA') asString, String crlf, (element attributes at: #impedance ifAbsent: '??%') asString. ]. transformer + (ROCircle new borderOnly extent: 50@50 ) + (ROTranslatingShape new offset: 25@0) + (ROCircle new borderOnly extent: 50@50). transformer + (ROTranslatingShape new offset: [ (transformer width / 8) negated @ (transformer height) ] ) + transformerLabel. view add: transformer . view open.! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:08'! borderColor ^ borderColor ! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:07'! borderColor: aColor borderColor := aColor.! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/16/2012 20:38'! borderOnly self borderWidth: 1. self borderColor: Color black. self color: Color transparent. ! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:08'! borderWidth ^borderWidth ! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:06'! borderWidth: anInteger borderWidth := anInteger. ! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:06'! drawOn: aCanvas for: aROElement aCanvas fillOval: aROElement bounds color: color borderWidth: borderWidth borderColor: borderColor! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/16/2012 15:45'! extent: anExtentPoint | max | max := anExtentPoint x max: anExtentPoint y. extent := max @ max. next extent: anExtentPoint! ! !ROCircle methodsFor: 'rendering' stamp: 'BenComan 9/3/2012 02:05'! initialize super initialize. borderWidth := 0. borderColor := Color black.! ! ROCircle removeSelector: #borederOnly! _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Ben Coman
I have added the translating shape in the core of Roassal. Let see how it evolves.
You can now specific a one-arg block as an offset. This solves the problem you experienced. Regarding the mouse events, you are absolutely right. I will try to fix this today. Cheers, Alexandre On Sep 16, 2012, at 3:17 AM, Ben Coman <[hidden email]> wrote: > Thanks for looking at this Alexandre. That is an interesting approach. I had been considering that each shape might just store an offset internally that cold be set. > > Attached is "ShapeTranslation-20120916a-bencoman.st" containing some simple use cases for ROTranslatingShape > as well as "ROTranslatingShape-usecases.png" containing compiled screenshots. > > Having worked through those use cases, it seems that how the offset shapes affect the element extent needs to be considered - particular in relation to mouse events. For example, if an element is made up of two shapes at opposite corners, then the blank space at the other two corners remains selectable to drag the element, which might not be quite right. So as wild and uninformed speculation... I wonder if rather than the element registering for events, the individual shapes might register for events and forward them on to the element for processing. > > cheers -ben > > Alexandre Bergel wrote: >> Hi Ben! >> >> >> >>> ...where the two labels overlap. I think you would gain a lot if you could do something like the following... >>> n1 := ROElement spriteOn: 'XX___'. >>> n1 + (shape1 := ROLabel new text: #model). >>> n1 + (ROLabel new text: #bounds; offset: [ shape1 bottomLeftCorner ] ). >>> rawView add: n1. >>> >>> >> >> I have improved the way shapes are drawn. If you update, you can then create the following class: >> >> -=-=-=-=-=-=-=-=-=-=-=-= >> ROShape subclass: #ROTranslatingShape >> instanceVariableNames: 'offset' >> >> initialize >> super initialize. >> offset := 0 @ 0 >> >> chainedDrawOn: aCanvas for: aROElement >> aROElement translateBy: offset negated. >> super chainedDrawOn: aCanvas for: aROElement. >> aROElement translateBy: offset. >> >> offset: aPoint >> offset := aPoint >> -=-=-=-=-=-=-=-=-=-=-=-= >> >> I've attached the .cs for convenience. >> >> >> >> >> >> You can then do the following: >> >> el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + ROBox . >> el extent: 50 @ 50. >> el @ RODraggable. >> rawView add: el. >> >> >> >> >> >> <Mail Attachment.png> >> >> >> >> Without the translation, you have >> >> el := ROElement new + ROBorder + ROBox . >> el extent: 50 @ 50. >> el @ RODraggable @ ROPopup. >> rawView add: el. >> >> >> >> >> >> <Mail Attachment.png> >> >> >> >> >> I haven't included ROTranslatingShape in Roassal. I first would like to see use cases of it. >> Let me know how it goes. >> >> Cheers, >> Alexandre >> >> >> >> >>> Alexandre Bergel wrote: >>> >>> >>>> Hi Ben, >>>> >>>> Currently no. We definitely need a better way to specific layouts and their composition. However this will take time before we have this. >>>> >>>> How would you like to specific the layout? >>>> >>>> Cheers, >>>> Alexandre >>>> >>>> >>>> On Aug 30, 2012, at 6:10 PM, Ben Coman >>>> >>>> <[hidden email]> >>>> >>>> wrote: >>>> >>>> >>>> >>>> >>>> >>>>> I have been looking at the ROExample "Nesting" examples and expanded #nesting2 with another level as shown in the code below, such that there is the outer view, middle "#1" nodes and inner "#2" nodes. However the initial state of this has much of the middle node1 and inner node2 nodes overlapping. >>>>> How can these be made for the circle layout to leave spacing between the middle node1 nodes? >>>>> >>>>> cheers -ben >>>>> >>>>> -------------------- >>>>> | view nodes1 | >>>>> view := ROView new. >>>>> view add: (ROElement sprite addAll: (nodes1 := ROElement spritesOn: (1 to: 10))). >>>>> nodes1 do: [:n | n addShape: ROLabel]. >>>>> nodes1 do: >>>>> [ :node1 | >>>>> ( (node1 model) *100+1 to: (node1 model)*100+5 ) do: >>>>> [ :x | >>>>> node1 add: ( (ROElement spriteOn: x) addShape: ROLabel). >>>>> ]. >>>>> ROGridLayout on: node1 elements. >>>>> ]. >>>>> >>>>> ROCircleLayout on: nodes1. >>>>> view openInWindow. >>>>> _______________________________________________ >>>>> >>>>> > > <ROTranslatingShape-usecases.png>ROShape subclass: #ROTranslatingShape > instanceVariableNames: 'offset' > classVariableNames: '' > poolDictionaries: '' > category: 'RoassalTest'! > > !ROTranslatingShape methodsFor: 'rendering' stamp: 'BenComan 9/16/2012 13:35'! > chainedDrawOn: aCanvas for: aROElement > aROElement translateBy: self offset negated. > super chainedDrawOn: aCanvas for: aROElement. > aROElement translateBy: self offset. > ! ! > > > !ROTranslatingShape methodsFor: 'initialize' stamp: 'AlexandreBergel 9/15/2012 09:51'! > initialize > super initialize. > offset := 0 @ 0! ! > > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 11:24'! > offset > ^ offset value! ! > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 11:24'! > offset: aBlockReturningPoint > offset := aBlockReturningPoint! ! > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 12:35'! > usecase1 > " > self new usecase1 > " > " > More showing how it operates than a use case. Showing that all shapes to the right of ROTranslatingShape are shifted. > However cannot drag element using the point just below top border. > " > | rawView el | > rawView := ROView new. > > el := ROElement new + ROBorder + (ROTranslatingShape new offset: 20 @ 20) + (ROCircle color: Color blue) + (ROBox) . > el extent: 50 @ 50. > el @ RODraggable. > rawView add: el. > > rawView open! ! > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:19'! > usecase2 > " > self new usecase2 > " > " > At the moment, the prime need for offset capability is showing the parent label above child elements. > > It is good that when dragging a child element upwards the label also moves up. > > However the dragging of elements is offset, eg the point just above bottom border does not drag the element. > > Note the ROBorder that is commented out. Not critical, but it would be good to put border around the ROLabel where it sits above the ROChildrenContainer, except without the bottom of it cutting across child container. > Might be useful to be able to re-use that Shape>>draw:For: methods with a custom bounds rather than getting it from the element. > " > > | rawView outer outerLabel | > rawView := ROView new. > > outer := (ROElement on: 'Child nodes should not overlap this heading text') + ROBorder + (ROTranslatingShape new offset: 0 @ -20) + ROLabel "+ ROBorder". > 1 to: 6 do: > [ :n | > outer add: (ROElement spriteOn: n). > ]. > outer extent: 50 @ 50. > outer @ RODraggable. > rawView add: outer. > > ROGridLayout new applyOn: outer elements. > > rawView open! ! > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:27'! > usecase3 > " > self new usecase3 > " > " > Also later may want to put put labels below the child element area. > " > | view outer outerLabel | > view := ROView new. > > outer := (ROElement on: 'Child nodes should not overlap this HEADER text. Try menu on view background.'). > outerLabel := ROLabel new. > outer + ROBorder + (ROTranslatingShape new offset: [ 0 @ (outerLabel heightFor: outer) negated ] ) + (ROLabel new text: [ :el | el model asString]) . > 1 to: 2 do: > [ :n | > outer add: (ROElement spriteOn: n). > ]. > outer extent: 50 @ 50. > outer @ RODraggable. > view add: outer. > view @ (ROMenuActivable new item: 'Change text' action: [ > outer model: 'Child nodes should not overlap this HEADER text > even when > it dynamically changes > to multiple lines'. > outer signalUpdate] ). > > ROVerticalLineLayout new applyOn: outer elements. > > view open.! ! > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:27'! > usecase4 > " > self new usecase4 > " > " > Dragging elements 1 & 2 upwards moves doesn't overlap labels with outer label - good. > > However inital layout has element 2 label overlapped by bottoms of element 1. > " > | view outer outerLabel | > view := ROView new. > > outer := (ROElement on: 'Child nodes should not overlap this HEADER text'). > outerLabel := ROLabel new. > outer + ROBorder + (ROTranslatingShape new offset: [ 0 @ (outerLabel heightFor: outer) negated ] ) + (ROLabel new text: [ :el | el model asString]) . > 1 to: 2 do: > [ :n | | el | > el := (ROElement spriteOn: n). > el + (ROTranslatingShape new offset: [ 0 @ (ROLabel new heightFor: el) negated ] ) + (ROLabel new text: [ :el3 | el3 model asString, ' should not be overlapped' ]). > outer add: el. > 1 to: 2 do: > [ :n2 | | el2 | > el2 := (ROElement spriteOn: n*n2). > el add: el2. > ]. > ROHorizontalLineLayout new applyOn: el elements. > ]. > outer extent: 50 @ 50. > outer @ RODraggable. > view add: outer. > view @ (ROMenuActivable new item: 'Change text' action: [ > outer model: outer model, ' > even when > it dynamically changes > to multiple lines'. > outer signalUpdate] ). > > ROVerticalLineLayout new applyOn: outer elements. > > view open.! ! > > !ROTranslatingShape methodsFor: 'accessing' stamp: 'BenComan 9/16/2012 13:37'! > usecase5 > " > self new usecase5 > " > " > Maybe later want to put labels below the child element area. > > Probably want to reference 'ROChildrenShape>>extent' rather than 'outer extent' since other shaps translations may alter the extent of the element. > > This doesn't opearte as expected, which should be to have three elements laid out in the column > " > | view outer outerLabel | > view := ROView new. > > outer := (ROElement on: 'Child nodes should not overlap this FOOTER text, even when nodes are added - see menu. '). > outerLabel := ROLabel new. > outer + ROBorder + (ROTranslatingShape new offset: [ 0 @ (outer extent y) ] ) + (ROLabel new text: [ :el | el model asString]) . > 1 to: 2 do: > [ :n | > outer add: (ROElement spriteOn: n) + ROLabel. > ]. > outer extent: 50 @ 50. > outer @ RODraggable. > view add: outer. > view @ (ROMenuActivable new item: 'Add node' action: > [ outer add: (ROElement spriteOn: 'extra') + ROBorder + ROLabel. > ROVerticalLineLayout new applyOn: outer elements. > outer signalUpdate > ] ). > > ROVerticalLineLayout new applyOn: outer elements. > > view open.! ! > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |