transformmorph and submorph bounds
Hi, In GTInspector we use a TransformMorph inside the pager morph. It works fine, but spawning completion from a text morph that is placed inside this transform morph, the completion morphs appears in the wrong place. The issue comes from submorphBounds apparently not being right (this is what the completion morph relies on). Here is a simpler example, to exemplify what I am talking about: circle := CircleMorph new. morph := TransformMorph new. morph addMorph: circle. morph top: 100. morph left: 100. morph submorphBounds. "==> (100@100) corner: (140@140)" circle submorphBounds. "==> (0@0) corner: (40@40)" Ideally, "circle submorphBounds" should start at 100@100. Is this a bug, or am I doing something wrong? Cheers, Doru -- www.tudorgirba.com "Every thing has its own flow"
2014-07-23 8:00 GMT+02:00 Tudor Girba <tudor@tudorgirba.com>:
Hi,
In GTInspector we use a TransformMorph inside the pager morph. It works fine, but spawning completion from a text morph that is placed inside this transform morph, the completion morphs appears in the wrong place.
The issue comes from submorphBounds apparently not being right (this is what the completion morph relies on).
Here is a simpler example, to exemplify what I am talking about:
circle := CircleMorph new. morph := TransformMorph new. morph addMorph: circle. morph top: 100. morph left: 100. morph submorphBounds. "==> (100@100) corner: (140@140)" circle submorphBounds. "==> (0@0) corner: (40@40)"
This seems correct to me: a transformMorph is the one which shift its contents (and reset the origin to its top left corner ?). Why do you use a TransformMorph there? Thierry
Ideally, "circle submorphBounds" should start at 100@100. Is this a bug, or am I doing something wrong?
Cheers, Doru
-- www.tudorgirba.com
"Every thing has its own flow"
Hi, On Wed, Jul 23, 2014 at 9:52 AM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
2014-07-23 8:00 GMT+02:00 Tudor Girba <tudor@tudorgirba.com>:
Hi,
In GTInspector we use a TransformMorph inside the pager morph. It works fine, but spawning completion from a text morph that is placed inside this transform morph, the completion morphs appears in the wrong place.
The issue comes from submorphBounds apparently not being right (this is what the completion morph relies on).
Here is a simpler example, to exemplify what I am talking about:
circle := CircleMorph new. morph := TransformMorph new. morph addMorph: circle. morph top: 100. morph left: 100. morph submorphBounds. "==> (100@100) corner: (140@140)" circle submorphBounds. "==> (0@0) corner: (40@40)"
This seems correct to me: a transformMorph is the one which shift its contents (and reset the origin to its top left corner ?).
Not really. The contract of submorphBounds should be that it returns an absolute coordinate, as far as I understand.
Why do you use a TransformMorph there?
It is used for example in ScrollPane. This means that if you embed a TextMorph inside a ScrollPane, you will have the same problem with completion: scrollPane := ScrollPane new. pasteUpMorph := PasteUpMorph new. scrollPane scroller addMorph: pasteUpMorph. scrollPane openInWindow top: 100; left: 100. pasteUpMorph submorphBounds "(0@0) corner: (50@40)" Cheers, Doru
Thierry
Ideally, "circle submorphBounds" should start at 100@100. Is this a bug, or am I doing something wrong?
Cheers, Doru
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com "Every thing has its own flow"
2014-07-23 11:10 GMT+02:00 Tudor Girba <tudor@tudorgirba.com>:
Hi,
This seems correct to me: a transformMorph is the one which shift its contents (and reset the origin to its top left corner ?).
Not really. The contract of submorphBounds should be that it returns an absolute coordinate, as far as I understand.
In owner coordinates it says. (TransformMorph) However, it effectively returns a 0@0 origin.
Why do you use a TransformMorph there?
It is used for example in ScrollPane. This means that if you embed a TextMorph inside a ScrollPane, you will have the same problem with completion:
scrollPane := ScrollPane new. pasteUpMorph := PasteUpMorph new. scrollPane scroller addMorph: pasteUpMorph. scrollPane openInWindow top: 100; left: 100.
pasteUpMorph submorphBounds "(0@0) corner: (50@40)"
Yes. What do you want to do about it? Rewrite a scroll pane in a different way? Or make sure that everything which creates over-morphs ask for global coordinates? I guess this has also something to do with the glamour bug inside tabs, no? Thierry
Hi, On Wed, Jul 23, 2014 at 11:45 AM, Thierry Goubier <thierry.goubier@gmail.com
wrote:
2014-07-23 11:10 GMT+02:00 Tudor Girba <tudor@tudorgirba.com>:
Hi,
This seems correct to me: a transformMorph is the one which shift its contents (and reset the origin to its top left corner ?).
Not really. The contract of submorphBounds should be that it returns an absolute coordinate, as far as I understand.
In owner coordinates it says. (TransformMorph)
However, it effectively returns a 0@0 origin.
Why do you use a TransformMorph there?
It is used for example in ScrollPane. This means that if you embed a TextMorph inside a ScrollPane, you will have the same problem with completion:
scrollPane := ScrollPane new. pasteUpMorph := PasteUpMorph new. scrollPane scroller addMorph: pasteUpMorph. scrollPane openInWindow top: 100; left: 100.
pasteUpMorph submorphBounds "(0@0) corner: (50@40)"
Yes.
What do you want to do about it? Rewrite a scroll pane in a different way? Or make sure that everything which creates over-morphs ask for global coordinates?
Ahh. I found it. The proper selector should not be submorphBounds but positionInWorld. This one works properly.
I guess this has also something to do with the glamour bug inside tabs, no?
Not inside tabs, but inside the a Finder or a Pager. Now, completion work properly! Cheers, Doru
Thierry
-- www.tudorgirba.com "Every thing has its own flow"
participants (2)
-
Thierry Goubier -
Tudor Girba