Can not remove element when drag to the paper.

This issue has been tracked since 2021-11-05.

Hi.
I drag the cell to the paper, but the elementTools.Remove() don't work, and i try to call elementView.model.remove() when element:contextmenu is fired. But it still not work.
ElementView.remove() worked, but graph still has this cell。
First element add to the graph when paper initialized.
2021-11-05 下午3 12 16

kumilingus wrote this answer on 2021-11-05

Is there any error in the browser console? How do you add the cell to the paper? Please provide some code.

ITfanheng wrote this answer on 2021-11-07

Thank you for your reply。No error console in browser. The code is on the company's computer,I will provide some code In the last few days。

ITfanheng wrote this answer on 2021-11-08
kumilingus wrote this answer on 2021-11-08

You added an element to the graph and immediately removed it.

circuitPaper.model.addCell(cloneCell);
cloneCell.remove();

I suppose the circuitPaper.model graph was not the same a cloneCell.graph.

Do not add the same model instance to more than one graph. Every element has a reference to the graph. It can not have 2 references. You need to clone it.

const clone = el.clone();
clone.set('id', el.id);

If you don't clone element an unexpected behaviour can be encountered.

ITfanheng wrote this answer on 2021-11-08

I got it. Thanks for your response.

More Details About Repo
Owner Name clientIO
Repo Name joint
Full Name clientIO/joint
Language JavaScript
Created Date 2009-09-11
Updated Date 2022-12-06
Star Count 3717
Watcher Count 155
Fork Count 817
Issue Count 53

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date