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,具体的参数可以根据具体情况进行调整
});
相关推荐
于航5 分钟前
分层上下文压缩,幻觉检测,错误累积概要
前端
数据掘金7 分钟前
鸿蒙统计的权限弹窗怎么适配?
前端
数据掘金10 分钟前
鸿蒙统计的多设备协同数据怎么打通?
前端
尘中远11 分钟前
Qwt7的曲线渲染平滑实现:高斯卷积、Savitzky-Golay 回归与特征保护
前端
Fly1 小时前
我来提需求,你带着 Codex 做项目:AI 全栈课程开始实战了
前端
集智飞行1 小时前
解决mavros2 ros2版本cpu占用高的问题
java·服务器·前端
w2sfot2 小时前
【JS加密在线】jsjiami.online(让JavaScript 更安全!)
开发语言·javascript·安全
HSunR2 小时前
ruoyi 若依 自定义注解 参数校验
java·前端·数据库
拆房老料3 小时前
ONLYOFFICE也能像Microsoft Word和WPS一样分别设置中西文字体
前端·html·word·开源软件·wps
Solis程序员4 小时前
Stripe 幂等表:把「不确定的重试」变成「查表返回」
前端·安全·bootstrap·php·agent