<commit_before>! Copyright (C) 2005, 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel namespaces ui.gadgets ui.gadgets.worlds
ui.gestures ;
IN: ui.gadgets.glass

TUPLE: glass < gadget ;

: <glass> ( child loc -- glass )
    >>loc glass new-gadget swap add-gadget ;

M: glass layout* gadget-child prefer ;

: hide-glass ( world -- )
    [ [ unparent ] when* f ] change-glass drop ;

: show-glass ( world child loc -- )
    <glass>
    [ [ hide-glass ] [ hand-clicked set-global ] bi* ]
    [ [ add-gadget ] [ >>glass ] bi drop ]
    2bi ;

\ glass H{
    { T{ button-down } [ find-world [ hide-glass ] when* ] }
    { T{ drag } [ update-clicked drop ] }
} set-gestures<commit_msg>Add hide-glass-hook<commit_after>! Copyright (C) 2005, 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel namespaces ui.gadgets ui.gadgets.worlds
ui.gestures ;
IN: ui.gadgets.glass

GENERIC: hide-glass-hook ( gadget -- )

M: gadget hide-glass-hook drop ;

TUPLE: glass < gadget ;

: <glass> ( child loc -- glass )
    >>loc glass new-gadget swap add-gadget ;

M: glass layout* gadget-child prefer ;

M: glass ungraft* gadget-child hide-glass-hook ;

: hide-glass ( world -- )
    [ [ unparent ] when* f ] change-glass drop ;

: show-glass ( world child loc -- )
    <glass>
    [ [ hide-glass ] [ hand-clicked set-global ] bi* ]
    [ [ add-gadget ] [ >>glass ] bi drop ]
    2bi ;

\ glass H{
    { T{ button-down } [ find-world [ hide-glass ] when* ] }
    { T{ drag } [ update-clicked drop ] }
} set-gestures
{'fraction_non_alphanumeric': 0.1514575411913815, 'fraction_numerical': 0.011406844106463879, 'mean_word_length': 2.7865707434052758, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '505296', 'n_tokens_mistral': 585, 'n_tokens_neox': 574, 'n_words': 152}