JS Функция отвеса подключения не принимает параметры - PullRequest
0 голосов
/ 24 марта 2020
instance.connect({
  source: "src",
  target: "tar",
  endpoint: ["Dot", {
    radius: 5,
    cssClass: "hasInfluencedEndpointStrong"
  }],
  anchor: "Center",
  paintStyle: {
    width: 25,
    height: 21,
    fill: "transparent"
  },
  scope: "hasInfluencedStrong",
  isSource: true,
  reattach: true,
  maxConnections: -1,
  connectorStyle: {
    stroke: "#708088",
    strokeWidth: 2.6,
    outlineStroke: "transparent",
    outlineWidth: 4
  },
  connectorOverlays: [
    ["Arrow", {
      location: -15.5,
      id: "arrow",
      length: 14,
      width: 14,
      foldback: 1,
      direction: 1
    }]
  ],
  isTarget: true,
})

Я передал этот объект в функцию jsplumb connect. Он не работает так, как ожидается. Я хочу настроить ширину линии и тип стрелки. Есть ли для этого альтернатива?

ОБНОВЛЕНИЕ: Я пытался подключиться, используя uuid конечных точек, и сначала добавлялся uuid конечных точек, после этого пытался соединить их и утешал как uuid, так и конечную точку, то же самое uuid, но все равно получал исходный код. ошибка не существует. введите описание изображения здесь

1 Ответ

0 голосов
/ 24 марта 2020

у меня так получилось

let e1 = instance.addEndpoint("src", {
  endpoint: ["Dot", { radius: 5,  cssClass:"hasInfluencedEndpointStrong" }], 
  anchor: "Center", 
  paintStyle: { 
    width: 25, 
    height: 21, 
    fill:"transparent"
  }, 
  scope: "hasInfluencedStrong", 
  isSource: true, 
  reattach: true,
  maxConnections: -1, 
  connectorStyle: { 
    stroke: "#708088", 
    strokeWidth: 2.6, 
    outlineStroke: "transparent", 
    outlineWidth: 4 
  }, 
  connectorOverlays:[ 
    [ "Arrow", { location: -15.5, id: "arrow", length: 14, width:14, foldback: 1, direction:1 } ] 
  ]
});

let e2 = instance.addEndpoint("target", {
  endpoint: ["Dot", { radius: 5,  cssClass:"hasInfluencedEndpointStrong" }], 
  anchor: "Center", 
  paintStyle: { 
    width: 25, 
    height: 21, 
    fill:"transparent"
  }, 
  scope: "hasInfluencedStrong", 
  isTarget: true, 
  reattach: true,
  maxConnections: -1, 
  connectorStyle: { 
    stroke: "#708088", 
    strokeWidth: 2.6, 
    outlineStroke: "transparent", 
    outlineWidth: 4 
  }, 
  connectorOverlays:[ 
    [ "Arrow", { location: -15.5, id: "arrow", length: 14, width:14, foldback: 1, direction:1 } ] 
  ]
});

и затем подключите эти конечные точки:

instance.connect({
  source:e1,
  target:e2
});
...