Hi Michel!
That’s a bug and thank you for bringing it to your attention!
But the good news is that you can still change the position of a connection to block. Here’s a sample action that creates two blocks and adds a connection between them. Then, we change the location of the endpoint’s connection with linkX and linkY instead of x and y. You would specifically want to look at the block under the comment “Change the endpoint location”.
linkX: 0 for left end of the block. 1 for right end of the block.
linkY: 0 for top end of the block. 1 for bottom end of the block.
client.registerAction('Add Blocks and line', async () => {
//Create two blocks
await client.loadBlockClasses(["ProcessBlock"]);
const page = viewport.getCurrentPage();
if (!page) return;
const size = {
h: 80,
w: 320,
};
let position = viewport.findAvailableSpace(size.w, size.h);
const block1 = position.page.addBlock({
className: "ProcessBlock",
boundingBox: {
x:position.x,
y:position.y,
h: 80,
w: 320,
},
});
position = viewport.findAvailableSpace(size.w, size.h);
const block2 = position.page.addBlock({
className: "ProcessBlock",
boundingBox: {
x:position.x,
y:position.y,
h: 80,
w: 320,
},
});
//Create a line that connects the two blocks
const line = position.page.addLine({
endpoint1: {
connection:block1,
linkX:1,
linkY:0
}
,
endpoint2:{
connection:block2,
linkX:0,
linkY:0
},
})
//Change the endpoint location.
line.setEndpoint1({
connection:block1,
linkX:0.5,
linkY:1
});
line.setEndpoint2({
connection:block2,
linkX:1,
linkY:0.5
});
});