Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 830 by [hidden email]: ROLabel dynamic text not  
updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

The code below results in the image attached, where you can see the  
ROBorder does not encompass the text.  The border should probably expand to  
encompass dynamically changing shapes. but not necessarily since you may  
want to have a border only around the label with the children having  no  
border.  The symptom is more that the width is inconsistent between each of  
the text nodes.

-----------------
| view rawView node1 node2 node3 node4  |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.

        node1 := ROElement new .
        node1 model:  'node1'.
        node1 addShape: ROBorder.
        node1 addShape: (ROLabel text: [ 'node1  ' , node1 bounds extent  
asString, '  ', node1 bounds asString ] ).
        node1 addInteraction: RODraggable.
        rawView add: node1.
       
        node2 := ROElement new .
        node2 model:  'node2'.
        node2 addShape: ROBorder.
        node2 addShape: (ROLabel text: [ 'node2 ', String crlf, node2 bounds  
extent asString, '  ', node2 bounds asString ] ).
        node2 addInteraction: RODraggable.
        rawView add: node2.

        node3 := ROElement new .
        node3 model:  'node3'.
        node3 addShape: ROBorder.
        node3 addShape: (ROLabel text: [ 'node3 ', String crlf, node3 bounds  
extent asString, String crlf, node3 bounds asString ] ).
        node3 addInteraction: RODraggable.
        rawView add: node3.

        node4 := ROElement  spriteOn:  'node4' .
        node4 addShape: (ROLabel text: [ 'node4 ', String crlf, node4 bounds  
extent asString, String crlf, String crlf, node4 bounds asString ] ).
        node4 addInteraction: RODraggable.
        rawView add: node4.

        ROVerticalLineLayout on: rawView elements.

ROEaselMorphic new populateMenuOn: view.
view noLayout.
view open

This is Moose4.7 with Roassal.283 on Windows 7.



Attachments:
        ROBorder does not encompass ROLabel text.png  17.6 KB

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

Ben Coman
In addition to logging this issue, I am curious why dragging node4 moves
twice as fast as the other 3 nodes.  I could not trace it back.

[hidden email] wrote:

> Status: New
> Owner: ----
> Labels: Type-Defect Priority-Medium
>
> New issue 830 by [hidden email]: ROLabel dynamic text not
> updating bounds/ROBorder properly
> http://code.google.com/p/moose-technology/issues/detail?id=830
>
> The code below results in the image attached, where you can see the
> ROBorder does not encompass the text.  The border should probably
> expand to encompass dynamically changing shapes. but not necessarily
> since you may want to have a border only around the label with the
> children having  no border.  The symptom is more that the width is
> inconsistent between each of the text nodes.
>
> -----------------
> | view rawView node1 node2 node3 node4  |
> rawView := ROView new.
> view := ROMondrianViewBuilder view: rawView.
>
>     node1 := ROElement new .
>     node1 model:  'node1'.
>     node1 addShape: ROBorder.
>     node1 addShape: (ROLabel text: [ 'node1  ' , node1 bounds extent
> asString, '  ', node1 bounds asString ] ).
>     node1 addInteraction: RODraggable.
>     rawView add: node1.
>    
>     node2 := ROElement new .
>     node2 model:  'node2'.
>     node2 addShape: ROBorder.
>     node2 addShape: (ROLabel text: [ 'node2 ', String crlf, node2
> bounds extent asString, '  ', node2 bounds asString ] ).
>     node2 addInteraction: RODraggable.
>     rawView add: node2.
>
>     node3 := ROElement new .
>     node3 model:  'node3'.
>     node3 addShape: ROBorder.
>     node3 addShape: (ROLabel text: [ 'node3 ', String crlf, node3
> bounds extent asString, String crlf, node3 bounds asString ] ).
>     node3 addInteraction: RODraggable.
>     rawView add: node3.
>
>     node4 := ROElement  spriteOn:  'node4' .
>     node4 addShape: (ROLabel text: [ 'node4 ', String crlf, node4
> bounds extent asString, String crlf, String crlf, node4 bounds
> asString ] ).
>     node4 addInteraction: RODraggable.
>     rawView add: node4.
>
>     ROVerticalLineLayout on: rawView elements.  
>
> ROEaselMorphic new populateMenuOn: view.
> view noLayout.
> view open
>
> This is Moose4.7 with Roassal.283 on Windows 7.
>
>
>
> Attachments:
>     ROBorder does not encompass ROLabel text.png  17.6 KB
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology
In reply to this post by moose-technology

Comment #1 on issue 830 by [hidden email]: ROLabel dynamic  
text not updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

image updated

Attachments:
        ROBorder does not encompass ROLabel text.png  19.8 KB

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology
Updates:
        Labels: Component-Roassal

Comment #2 on issue 830 by [hidden email]: ROLabel dynamic text not  
updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

Well spotted Ben!
I've added ROLabelTest>>testDynamicBounds to crystalize the problem

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology

Comment #3 on issue 830 by [hidden email]: ROLabel dynamic  
text not updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

Thanks Alex.  But hold your breath and get a load of the next one. Could
be a curly one :)
That might require some deep changes - but I think it is somewhat
critical, at least
for what I was trying to achieve with ROCircleLayout,
which is to have elements to pin different corners of themselves to the
circle
depending on which quadrant they are in.

cheers -ben

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

abergel
In reply to this post by Ben Coman
Hi Ben,

The reason is that node4 is a sprite, i.e., an draggable ROElement with a red border. Since you add the interaction for a second time, node4 is dragged 2 times faster.

Remove the line "node4 addInteraction: RODraggable."

Alexandre

On Sep 3, 2012, at 12:20 PM, Ben Coman <[hidden email]> wrote:

> In addition to logging this issue, I am curious why dragging node4 moves twice as fast as the other 3 nodes.  I could not trace it back.
>
> [hidden email] wrote:
>> Status: New
>> Owner: ----
>> Labels: Type-Defect Priority-Medium
>>
>> New issue 830 by [hidden email]: ROLabel dynamic text not updating bounds/ROBorder properly
>> http://code.google.com/p/moose-technology/issues/detail?id=830
>>
>> The code below results in the image attached, where you can see the ROBorder does not encompass the text.  The border should probably expand to encompass dynamically changing shapes. but not necessarily since you may want to have a border only around the label with the children having  no border.  The symptom is more that the width is inconsistent between each of the text nodes.
>>
>> -----------------
>> | view rawView node1 node2 node3 node4  |
>> rawView := ROView new.
>> view := ROMondrianViewBuilder view: rawView.
>>
>>    node1 := ROElement new .
>>    node1 model:  'node1'.
>>    node1 addShape: ROBorder.
>>    node1 addShape: (ROLabel text: [ 'node1  ' , node1 bounds extent asString, '  ', node1 bounds asString ] ).
>>    node1 addInteraction: RODraggable.
>>    rawView add: node1.
>>        node2 := ROElement new .
>>    node2 model:  'node2'.
>>    node2 addShape: ROBorder.
>>    node2 addShape: (ROLabel text: [ 'node2 ', String crlf, node2 bounds extent asString, '  ', node2 bounds asString ] ).
>>    node2 addInteraction: RODraggable.
>>    rawView add: node2.
>>
>>    node3 := ROElement new .
>>    node3 model:  'node3'.
>>    node3 addShape: ROBorder.
>>    node3 addShape: (ROLabel text: [ 'node3 ', String crlf, node3 bounds extent asString, String crlf, node3 bounds asString ] ).
>>    node3 addInteraction: RODraggable.
>>    rawView add: node3.
>>
>>    node4 := ROElement  spriteOn:  'node4' .
>>    node4 addShape: (ROLabel text: [ 'node4 ', String crlf, node4 bounds extent asString, String crlf, String crlf, node4 bounds asString ] ).
>>    node4 addInteraction: RODraggable.
>>    rawView add: node4.
>>
>>    ROVerticalLineLayout on: rawView elements.  
>> ROEaselMorphic new populateMenuOn: view.
>> view noLayout.
>> view open
>>
>> This is Moose4.7 with Roassal.283 on Windows 7.
>>
>>
>>
>> Attachments:
>>    ROBorder does not encompass ROLabel text.png  17.6 KB
>>
>> _______________________________________________
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology
In reply to this post by moose-technology

Comment #4 on issue 830 by [hidden email]: ROLabel dynamic text not  
updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

Fixed in Roassal 1.109.

However, your example will not work. The reason is that in your block  
provided to #text: you use #bounds. And you should not since #bounds use  
#text to compute its bounds. It simply loops.

Try with the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view el |
view := ROView new.

el := ROElement new + ROBorder red.
el @ RODraggable.
el + (ROLabel text: [ :v | v position asString ]).

view add: el.

view open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology
Updates:
        Status: Fixed

Comment #5 on issue 830 by [hidden email]: ROLabel dynamic text not  
updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

(No comment was entered for this change.)

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

abergel
In reply to this post by moose-technology
Ben,
I think I fixed the problem.
http://code.google.com/p/moose-technology/issues/detail?id=830

However, your example will not work. The reason is that in your block provided to #text: you use #bounds. And you should not since #bounds use #text to compute its bounds. It simply loops.

Try with the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view el |
view := ROView new.

el := ROElement new + ROBorder red.
el @ RODraggable.
el + (ROLabel text: [ :v | v position asString ]).

view add: el.

view open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Let me know how it goes.

I will look at the Circle problem soon.

Cheers,
Alexandre


On Sep 4, 2012, at 12:41 PM, [hidden email] wrote:

>
> Comment #3 on issue 830 by [hidden email]: ROLabel dynamic text not updating bounds/ROBorder properly
> http://code.google.com/p/moose-technology/issues/detail?id=830
>
> Thanks Alex.  But hold your breath and get a load of the next one. Could
> be a curly one :)
> That might require some deep changes - but I think it is somewhat
> critical, at least
> for what I was trying to achieve with ROCircleLayout,
> which is to have elements to pin different corners of themselves to the
> circle
> depending on which quadrant they are in.
>
> cheers -ben
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

moose-technology
In reply to this post by moose-technology
Updates:
        Labels: Milestone-4.7

Comment #6 on issue 830 by [hidden email]: ROLabel dynamic text not  
updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

(No comment was entered for this change.)

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

Ben Coman
In reply to this post by abergel
Alexandre Bergel wrote:
Ben,
I think I fixed the problem. 
http://code.google.com/p/moose-technology/issues/detail?id=830

However, your example will not work. The reason is that in your block provided to #text: you use #bounds. And you should not since #bounds use #text to compute its bounds. It simply loops.

Try with the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view el |
view := ROView new.

el := ROElement new + ROBorder red.
el @ RODraggable.
el + (ROLabel text: [ :v | v position asString ]).

view add: el.

view open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Let me know how it goes.

I will look at the Circle problem soon.

Cheers,
Alexandre


On Sep 4, 2012, at 12:41 PM, [hidden email] wrote:

  
Comment #3 on issue 830 by [hidden email] ROLabel dynamic text not updating bounds/ROBorder properly
http://code.google.com/p/moose-technology/issues/detail?id=830

Thanks Alex.  But hold your breath and get a load of the next one. Could
be a curly one :)
That might require some deep changes - but I think it is somewhat
critical, at least
for what I was trying to achieve with ROCircleLayout,
which is to have elements to pin different corners of themselves to the
circle
depending on which quadrant they are in.

cheers -ben

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
    

  
Thanks Alexandre.  You probably already know what I present here, but I got curious about how the recursion was occurring (another chance to learn more digging into the system) and I learn better if I have to get it down in writing.  I also have a fix if the overhead was acceptable.

The attachment shows recursion starting at ROLabel>>extentFor:. You can see the rough fix I implemented. (Note the snapshot is from after I implemented the fix, so for this snapshot I cheated and manually forced (blockRecurion:=nil) in the debugger for one step.)  btw, to find the right place to debug for the recursion without locking up the system, I used the following Workspace code. The whole thing needs to be executed in one go so that the context of the 'xx' variable is the same throughout.

| view el xx |
xx := 2.
view := ROView new.
el := ROElement new + ROBorder red.
el @ RODraggable.
el + (ROLabel text:
[ :v | 
    xx := xx + 1.
    Transcript crShow: xx asString , '  ', v position asString.
    (xx = 1) ifTrue:
    [
        xx := xx + 1.
        self halt.   "debug recursion of next line"
        v extent asString .
    ]  ifFalse:
    [
        v position asString.
    ]
]) .
view add: el.
view open.
[ (Delay forSeconds: 2) wait. xx := 0. ] fork.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

ROLabel-extentFor-recursion.png (67K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

abergel
> Thanks Alexandre.  You probably already know what I present here, but I got curious about how the recursion was occurring (another chance to learn more digging into the system) and I learn better if I have to get it down in writing.  I also have a fix if the overhead was acceptable.

I have the impression that your fix is rather complicated.
Without trying to understand why it is so important to have a label that tells the size of itself, you could simply have:

-=--=-=--=-=--=-=--=-=--=
"Preambule. It includes the initialization. "
| rawView view node innerNode |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.
"enter your script below"
"-------------"
"-------------"


node := view node: 'foo'.
innerNode := ROElement new + (ROLabel text: [ :v | node bounds]).  
innerNode @ RODraggable.
node on: ROMouseDragging do: [ :ann | ROAdjustSizeOfNesting on: node ].
node add: innerNode.
ROAdjustSizeOfNesting on: node.
 
"-------------"
"-------------"
"Below is the initiation of the menu and opening the visualization"
ROEaselMorphic new populateMenuOn: view.
view open
-=--=-=--=-=--=-=--=-=--=

A label inside tells the size of its owner. Thus breaking the egg-chicken recursion.

> The attachment shows recursion starting at ROLabel>>extentFor:. You can see the rough fix I implemented. (Note the snapshot is from after I implemented the fix, so for this snapshot I cheated and manually forced (blockRecurion:=nil) in the debugger for one step.)  btw, to find the right place to debug for the recursion without locking up the system, I used the following Workspace code. The whole thing needs to be executed in one go so that the context of the 'xx' variable is the same throughout.

Using thread in that way is dangerous :-)

Alexandre

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



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 830 in moose-technology: ROLabel dynamic text not updating bounds/ROBorder properly

Ben Coman
Alexandre Bergel wrote:
Thanks Alexandre.  You probably already know what I present here, but I got curious about how the recursion was occurring (another chance to learn more digging into the system) and I learn better if I have to get it down in writing.  I also have a fix if the overhead was acceptable. 
    

I have the impression that your fix is rather complicated. 
Without trying to understand why it is so important to have a label that tells the size of itself, you could simply have:
  

It is not real important, just for debugging while I am playing with programming a layout.  I'll use you suggestion.

-=--=-=--=-=--=-=--=-=--=
"Preambule. It includes the initialization. "
| rawView view node innerNode |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.
"enter your script below"
"-------------"
"-------------" 


node := view node: 'foo'.
innerNode := ROElement new + (ROLabel text: [ :v | node bounds]).  
innerNode @ RODraggable.
node on: ROMouseDragging do: [ :ann | ROAdjustSizeOfNesting on: node ]. 
node add: innerNode.
ROAdjustSizeOfNesting on: node.
  
"-------------" 
"-------------"
"Below is the initiation of the menu and opening the visualization"
ROEaselMorphic new populateMenuOn: view.
view open
-=--=-=--=-=--=-=--=-=--=

A label inside tells the size of its owner. Thus breaking the egg-chicken recursion.

  
The attachment shows recursion starting at ROLabel>>extentFor:. You can see the rough fix I implemented. (Note the snapshot is from after I implemented the fix, so for this snapshot I cheated and manually forced (blockRecurion:=nil) in the debugger for one step.)  btw, to find the right place to debug for the recursion without locking up the system, I used the following Workspace code. The whole thing needs to be executed in one go so that the context of the 'xx' variable is the same throughout.
    

Using thread in that way is dangerous :-)
  

Point taken.

Alexandre

  


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev