https://linen.dev logo
Join Discord
Powered by
# ceramic
  • b

    billowy-waiter-28954

    03/01/2023, 7:02 PM
    But that could be tricky, not sure field access restriction works well with my events macros
  • o

    orange-van-60470

    03/01/2023, 7:02 PM
    I expect it is not easier in the Kha api...if you look at how that is done.
  • o

    orange-van-60470

    03/01/2023, 7:02 PM
    that was suggestion to NotBilly
  • a

    ambitious-knife-25690

    03/01/2023, 7:03 PM
    I don't have the states context though afaik
  • b

    billowy-waiter-28954

    03/01/2023, 7:03 PM
    @ambitious-knife-25690 when in doubt about using some object api, feel free to double check with me that it won’t should you in the back 😁
  • a

    ambitious-knife-25690

    03/01/2023, 7:04 PM
    i think that's why kha needed a whole custom setup, because the logic had to be moved to the haxeui-kha side
  • b

    billowy-waiter-28954

    03/01/2023, 7:04 PM
    Yeah I don’t know how that is supposed to be on haxeui side so state might not be the right word
  • a

    ambitious-knife-25690

    03/01/2023, 7:05 PM
    yeah, i'm ignorant enough on both haxeui and ceramic to not be sure of my answers 😅
  • a

    ambitious-knife-25690

    03/01/2023, 7:06 PM
    but it seems like, if I can only get 1 event from a mouse interaction per hierarchy it isn't clear to me where to go from here
  • a

    ambitious-knife-25690

    03/01/2023, 7:07 PM
    because whilst i may get a visual with the interception route, i have no idea what said visual does or if it needs focus or not
  • b

    billowy-waiter-28954

    03/01/2023, 7:07 PM
    You can retrieve any visual in the hierachy from the hitting one, so imo everything is possible
  • b

    billowy-waiter-28954

    03/01/2023, 7:07 PM
    But @bright-gpu-74537, what are the rules regarding events in haxe ui?
  • a

    ambitious-knife-25690

    03/01/2023, 7:07 PM
    haxeui sends
    mouse_down
    flag to backend, backend spits out event
  • a

    ambitious-knife-25690

    03/01/2023, 7:08 PM
  • b

    billowy-waiter-28954

    03/01/2023, 7:08 PM
    When does haxeui send mouse_down flag?
  • a

    ambitious-knife-25690

    03/01/2023, 7:08 PM
    this is the current event map implementation
  • a

    ambitious-knife-25690

    03/01/2023, 7:09 PM
    from a component, that is in haxeui-core, not in haxeui-ceramic
  • o

    orange-van-60470

    03/01/2023, 7:10 PM
    You can do flat mouse api's ... for instance in Kha, you might find you need to do similar in ceramic?
  • o

    orange-van-60470

    03/01/2023, 7:10 PM
    there is a test demo link
  • b

    bright-gpu-74537

    03/01/2023, 7:11 PM
    so, when you say in haxeui "add a listener for down", it calls the backend mapEvent, this should only ever add one listener in the backend component, multiple events of the same type will be handled by core (from the single event in the backend). As for sending "mouse downs" or something, that never happens, haxeui simple restyles components based on events... the backend will never (by default) know its "down"
  • b

    billowy-waiter-28954

    03/01/2023, 7:12 PM
    Ah so haxeui is calling mapEvent once when the component is built I guess
  • b

    bright-gpu-74537

    03/01/2023, 7:12 PM
    well, once you call
    registerEvent
    , that in turn calls
    mapEvent
  • b

    billowy-waiter-28954

    03/01/2023, 7:12 PM
    Ok
  • b

    billowy-waiter-28954

    03/01/2023, 7:13 PM
    And the rule is: an event should be triggered on all elements in the hierarchy right?
  • b

    billowy-waiter-28954

    03/01/2023, 7:13 PM
    (Not just the deepest child)
  • b

    bright-gpu-74537

    03/01/2023, 7:13 PM
    if it has a listener, yeah - i think the best way to handle it is to recursively walk up the tree and see if you should redispatch the event ( @ambitious-knife-25690 )
  • b

    billowy-waiter-28954

    03/01/2023, 7:14 PM
    Yes that’s how it should be done I think
  • b

    bright-gpu-74537

    03/01/2023, 7:14 PM
    psuedo code:
  • b

    bright-gpu-74537

    03/01/2023, 7:14 PM
    Copy code
    haxe
    function checkRedispatch(x, y, event) {
        if (hasEventListner(event) && inBounds(x, y)) {
            dispatch(event);
        }
        parent.checkRedispatch(x, y, event);
    }
    
    function onMouse(event) {
        dispatch(event);
        parent.checkRedispatch(event.x, event.y, event);
    }
  • o

    orange-van-60470

    03/01/2023, 7:15 PM
    but is that bubbling up and down... that can be heavy in complex apps
1...899091...124Latest