cocopon / tweakpane

:control_knobs: Compact GUI for fine-tuning parameters and monitoring value changes
https://tweakpane.github.io/docs/
MIT License
3.43k stars 86 forks source link

type error #379

Closed jonlepage closed 2 years ago

jonlepage commented 2 years ago

buttongrid seem not support event. image

ex:

        pane.addBlade( {
            label: 'moveTo',
            view: 'buttongrid',
            size: [ 3, 3 ],
            cells: ( x:number, y:number ) => ( {
                title: [
                    [ 'NW', 'N', 'NE' ],
                    [ 'W', '*', 'E' ],
                    [ 'SW', 'S', 'SE' ],
                ][y][x],
            } ),
        } ).on( 'click', ( v ) => $.transform.position.set( ( $._sceneW / 2 ) * v.index[0], ( $._sceneH / 2 ) * v.index[1] ) );
    } )( $Camera );
cocopon commented 2 years ago

This is by design. BladeApi interface doesn't have a method on, you should cast it to the specific API. Ref: https://github.com/cocopon/tweakpane/issues/355#issuecomment-950285742

BTW, the repository of Button Grid is here: https://github.com/tweakpane/plugin-essentials