简体   繁体   English

将鼠标悬停在joint.js中的链接元素会消失。

[英]link elements in joint.js dissapear when mousing over them.

I am buillding an FSA application in joint.js using the fsa plugin. 我正在使用fsa插件在joint.js中构建FSA应用程序。 However, whenever I mouse over the links, they disappear. 但是,只要我将鼠标悬停在链接上,它们就会消失。

This is the relevant javascript code: 这是相关的javascript代码:

function link(source, target, label, maxsize) {
  var vertices = []
  if (source.id == target.id) {
       vertices = [{ x:source.attributes.position.x+10*maxsize, y:source.attributes.position.y-40 }, { x:source.attributes.position.x+10*maxsize, y:source.attributes.position.y+40 }]; 
  }   
  var w = parseInt(label,10);
  if (source.id == init.id || target.id == term.id) 
      label = ""; 
  var cell = new joint.shapes.fsa.Arrow({
      source: { id: source.id },
      target: { id: target.id },
       labels: [{ position: .5, attrs: { text: { text: label || '', 'font-weight': 'bold' } } }], 
      vertices: vertices || []
  }); 
  cell.weight = w;
  return cell;

} }

How do I fix this? 我该如何解决?

This seems you must be getting some error to the browser console. 看来您一定在浏览器控制台中遇到了一些错误。 Can you post it here? 你可以在这里张贴吗? It looks like something else is wrong, not the code that you posted. 看起来有些错误,而不是您发布的代码。 However, I see you're accessing source.attributes.position.x directly. 但是,我看到您正在直接访问source.attributes.position.x Note that this is not part of the public API. 请注意,这不是公共API的一部分。 You should use source.get('position').x. 您应该使用source.get('position')。x。

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

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