Oldes / Rebol-issues

Issue tracker for https://github.com/oldes/Rebol3
4 stars 0 forks source link

MAP-OUTER always returning top-most gob (not relative to given gob) #303

Open Siskin-Bot opened 4 years ago

Siskin-Bot commented 4 years ago

Submitted by: oldes

The result of map-outer always return gob of the window. It shoult return gob relative to given gob.

win: make gob! [size: 640x480 color: 100.100.100]
g1: make gob! [offset: 50x50 size: 200x200 color: 255.0.0]
g2: make gob! [offset: 5x5 size: 100x100 color: 0.255.0]
append g1 g2
append win g1
view/options win [
    offset: 'center
    handler: [
        name: 'my-handler
        priority: 10
        handler: func [event] [
            switch event/type  [
                close [quit]
                down [
                    print "win:"
                    inner: map-inner win event/offset
                    outer: map-outer win event/offset
                    ? inner
                    ? outer
                    print "g1:"
                    inner: map-inner g1 event/offset
                    outer: map-outer g1 event/offset
                    ? inner
                    ? outer
                    print "g2:"
                    inner: map-inner g2 event/offset
                    outer: map-outer g2 event/offset
                    ? inner
                    ? outer
                ]
            ]
            none
        ]
    ]
]

Imported from: CureCode [ Version: alpha 31 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:none ] Imported from: https://github.com/rebol/rebol-issues/issues/303

Comments:

Rebolbot commented on Sep 24, 2007:

Submitted by: admin

Please clarify this bug. -Carl

Maybe you should first clarify, what is the first 'gob argument used for. If this function is used just to get root, it should be probably renamed. Or there is some extra refinement... because if it should return root of the gob, why there is the position? Or if it should return root from position, why there is the gob?

I understand it like map-inner/first which would return first (outer) gob, which is inside the given gob under given position. So it could be used to find my own gob window, which holds many gobs inside (so I can for example focus this window (which is not OS based!)) Now when I use map-inner, I would get just the inner-most gob and traverse back manually.


Rebolbot commented on Jan 15, 2009:

Submitted by: BrianH

MAP-OUTER and MAP-INNER have been replaced with MAP-GOB-OFFSET.


Rebolbot added the Type.bug on Jan 12, 2016


Oldes commented 4 years ago

As BrianH commented, there is now map-gob-offset and so the example could be rewritten as:

view/options win [
    offset: 'center
    handler: [
        name: 'my-handler
        priority: 10
        handler: func [event] [
            switch event/type  [
                close [quit]
                down [
                    print "win:"
                    inner: map-gob-offset win event/offset
                    outer: map-gob-offset/reverse win event/offset
                    ? inner
                    ? outer
                    print "g1:"
                    inner: map-gob-offset g1 event/offset
                    outer: map-gob-offset/reverse g1 event/offset
                    ? inner
                    ? outer
                    print "g2:"
                    inner: map-gob-offset g2 event/offset
                    outer: map-gob-offset/reverse g2 event/offset
                    ? inner
                    ? outer
                ]
            ]
            none
        ]
    ]
]

But the problem is still there... the outer is always the win gob! When clicked on the green box (g2), I expect the outer be it's parent, which is the red box (g1).