简体   繁体   English

如何使组不可见但其内容在gojs中可见?

[英]How to make groups invisible but their contents visible in gojs?

I've followed go.js example ( http://gojs.net/latest/intro/layers.html ) of using layers and now I want to modify it, so I can assign all groups to the same new layer while keeping the contents of the group in a separate layer. 我遵循了使用图层的go.js示例( http://gojs.net/latest/intro/layers.html ),现在我想对其进行修改,因此我可以将所有组分配给同一新图层,同时保持组的内容位于单独的层中。 This seems to be working, as I can see, that depending on addLayerBefore or addLayerAfter being called the group overlay is displayed in front or behind the group contents. 如我所见,这似乎是有效的,取决于addLayerBeforeaddLayerAfter被调用,组覆盖图显示在组内容的前面或后面。 Now unfortunately, when I set the group layer invisible the group contents also become invisible. 现在,不幸的是,当我将组图层设置为不可见时,组内容也变为不可见。 This is bad, as my whole idea to put the group and its contents to the separate layers, was in order to be able to add button, that toggle displaying group overlay, while keeping group contents always visible. 这很不好,因为我的整个想法是将组及其内容放置在单独的图层中,以便能够添加按钮,以切换显示组覆盖,同时保持组内容始终可见。 Is there any way to achieve this functionality? 有什么方法可以实现此功能?

The easiest way would be to set a group's or layer's opacity to 0 , instead of using the visible property of Parts or Layers. 最简单的方法是将组或图层的opacity0 ,而不是使用“零件”或“图层”的visible属性。

visible has specific rules about hiding other objects, such as a Group's member parts, connected Links, etc. opacity is always only cosmetic. visible具有有关隐藏其他对象(例如,组的成员部分,连接的链接等)的特定规则。 opacity始终只是装饰性的。

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

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