Molstar 更改 Focus representation 的 扩展半径

更多内容请查看

背景说明:

Focus representation 是指在结构可视化中,当用户选中某个结构元素(如原子、残基、链等)时,会在可视化界面中显示一个突出的表示,以便用户能够更清晰地看到选中的元素。 默认情况下,Focus representation 会扩展一定的半径,以确保选中的元素能够在可视化界面中被突出显示。 但在某些情况下,用户可能希望调整 Focus representation 的扩展半径,以满足特定的可视化需求。

TypeScript 复制代码
export const StructureFocusRepresentation = PluginBehavior.create({
  name: "create-structure-focus-representation",
  display: { name: "Structure Focus Representation" },
  category: "interaction",
  ctor: StructureFocusRepresentationBehavior,
  params: (_, plugin) => StructureFocusRepresentationParams(plugin),
});

方案 1:在初始化 Behavior 时传递参数

TypeScript 复制代码
behaviors: [
  // ...
  PluginSpec.Behavior(StructureFocusRepresentation, { expandRadius: 8 }), // 这里设置扩展半径为8,具体的参数可以根据具体情况进行调整
];

方案 2:在运行时动态修改参数

TypeScript 复制代码
this.plugin.state.updateBehavior(StructureFocusRepresentation, (p) => {
  p.expandRadius = 8; // 这里设置扩展半径为8,具体的参数可以根据具体情况进行调整
});
相关推荐
FRing037 小时前
vue3干货总结3(defineOptions(Vue3.3)、defineModel(Vue3.4)、Pinia)
开发语言·前端·vue.js·vue3
Bczheng17 小时前
组件化服务端渲染模式SSR
前端
whitelbwwww8 小时前
CUDA C++实战--中级
开发语言·前端·c++
张紫娃8 小时前
Chrome插件-Stylus(屏蔽博客广告)
前端·chrome·stylus
Yannik8 小时前
在 Apple Silicon Mac 上用 Jenkins + Fastlane 搭建 iOS CI:从自动打包到 MR 检查流水线的完整实践
前端
Nayana9 小时前
《Web 到 HarmonyOS》-- 打包:Vite 产物 → HAP / HAR / HSP
前端
inksci9 小时前
用飞帆做了个小网页
前端·javascript·css·html
去伪存真9 小时前
被 pnpm 打包坑惨后,我彻底盘明白了硬链接与软链接
前端·electron
zhensherlock9 小时前
Protocol Launcher 系列:CodeHub 移动端 GitHub 协作利器
前端·javascript·typescript·node.js·自动化·github·js
多加点辣也没关系12 小时前
JavaScript|第40章:JavaScript 工程化实践
开发语言·javascript·ecmascript