繁体   English   中英

在Glamour浏览器中在Roassal可视化中使边缘不可单击

[英]Make edges not clickable in Roassal visualization from within a Glamour browser

我在Pharo 2.0的Glamour浏览器中使用Roassal绘制了动态书法。

默认情况下,不仅可以单击节点,还可以单击边缘。

由于我没有其他信息可显示边缘,因此我希望它们不可单击。 如何删除“可点击性”?

这就是我从Glamor浏览器中绘制书法的方式:

methodsUnderTestAsCallGraphIn: constructor
    constructor roassal
        painting: [ :view :testFailure | 
                    view shape rectangle
                        size: 30;
                        fillColor: ThreeColorLinearNormalizer new.
                    view nodes: (tests methodsUnderTest: testFailure).
                    view shape arrowedLine.
                    view edges: (tests methodsUnderTest: testFailure) from: #yourself toAll: #outgoingCalls.
                    view treeLayout ];
        title: 'Callgraph of methods under test'

我认为GLMRoassalPresentation >> renderOn:负责添加“可点击性”:

[...]

    self shouldPopulateSelection ifTrue: [   
        aView raw allElementsDo: [:each | 
            each on: ROMouseClick do: [:event | self selection: each model ]] ].

[...]

我想保持这种行为的节点,但不是边缘。

有一个独立的示例来阐明您想要的行为会有所帮助,因此我重新提出了您的问题。

通过两条注释行,我想这是您不想要的行为。 取消注释这两行是否提供您想要的行为?

browser := GLMTabulator new.
browser column: #myRoassal ; column: #mySelection.
browser transmit 
    to: #myRoassal ;
    andShow: 
    [   : aGLMPresentation |
        aGLMPresentation roassal
            painting:
            [   : view : numbers |  |edges|
                view shape rectangle ; withText ; size: 30.
                view nodes: numbers.
                view interaction noPopup.
                view edges: numbers from:  [ :x | x / 2] to: [ :x | x ].
"               view edges do: [ :edge | edge model:#doNotSelectMe ]."
                view treeLayout.
            ].
    ].
browser transmit 
    to: #mySelection ;
    from: #myRoassal ;
"   when: [ :selection | selection ~= #doNotSelectMe ] ;"
    andShow: 
    [   : aGLMPresentation |
        aGLMPresentation text
            display: [ : selectedItem | selectedItem asString ]
    ].
browser openOn: (1 to: 10).

不幸的是,目前无法实现此操作,因为单击已在GLMRoassalPresentation中进行了硬编码。 但是,您是对的,我们应该找到解决方案,所以我提出了一个问题: http : //code.google.com/p/moose-technology/issues/detail?id=981

我不确定“可点击性”是什么意思。 您没有定义任何交互,因此默认交互是一个简单的弹出窗口。 如果要删除弹出窗口,则只需插入“视图交互noPopup”。 在新鲜的Roassal画架中尝试以下操作:

view shape rectangle size: 40.
view nodes: #(1 2).

view interaction noPopup.
view edgesFrom: 1 to: 2.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM