Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getMouseElement(event: MouseEvent): BaseModel {
var target = event.target as Element;
var diagramModel = this.model;
//is it a port
var element = Toolkit.closest(target, '.port[data-name]');
if (element) {
var nodeElement = Toolkit.closest(target, '.node[data-nodeid]') as HTMLElement;
return diagramModel.getNode(nodeElement.getAttribute('data-nodeid')).getPort(element.getAttribute('data-name'));
}
//look for a point
element = Toolkit.closest(target, '.point[data-id]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid')).getPointModel(element.getAttribute('data-id'));
}
//look for a link
element = Toolkit.closest(target, '[data-linkid]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid'));
}
}
//look for a point
element = Toolkit.closest(target, '.point[data-id]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid')).getPointModel(element.getAttribute('data-id'));
}
//look for a link
element = Toolkit.closest(target, '[data-linkid]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid'));
}
//look for a node
element = Toolkit.closest(target, '.node[data-nodeid]');
if (element) {
return diagramModel.getNode(element.getAttribute('data-nodeid'));
}
return null;
}
getMouseElement(event: MouseEvent): BaseModel {
var target = event.target as Element;
var diagramModel = this.model;
//is it a port
var element = Toolkit.closest(target, '.port[data-name]');
if (element) {
var nodeElement = Toolkit.closest(target, '.node[data-nodeid]') as HTMLElement;
return diagramModel.getNode(nodeElement.getAttribute('data-nodeid')).getPort(element.getAttribute('data-name'));
}
//look for a point
element = Toolkit.closest(target, '.point[data-id]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid')).getPointModel(element.getAttribute('data-id'));
}
//look for a link
element = Toolkit.closest(target, '[data-linkid]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid'));
}
//look for a node
element = Toolkit.closest(target, '.node[data-nodeid]');
if (element) {
return diagramModel.getNode(element.getAttribute('data-nodeid'));
}
getMouseElement(event: MouseEvent): BaseModel {
var target = event.target as Element;
var diagramModel = this.model;
//is it a port
var element = Toolkit.closest(target, '.port[data-name]');
if (element) {
var nodeElement = Toolkit.closest(target, '.node[data-nodeid]') as HTMLElement;
return diagramModel.getNode(nodeElement.getAttribute('data-nodeid')).getPort(element.getAttribute('data-name'));
}
//look for a point
element = Toolkit.closest(target, '.point[data-id]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid')).getPointModel(element.getAttribute('data-id'));
}
//look for a link
element = Toolkit.closest(target, '[data-linkid]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid'));
}
//look for a node
//is it a port
var element = Toolkit.closest(target, '.port[data-name]');
if (element) {
var nodeElement = Toolkit.closest(target, '.node[data-nodeid]') as HTMLElement;
return diagramModel.getNode(nodeElement.getAttribute('data-nodeid')).getPort(element.getAttribute('data-name'));
}
//look for a point
element = Toolkit.closest(target, '.point[data-id]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid')).getPointModel(element.getAttribute('data-id'));
}
//look for a link
element = Toolkit.closest(target, '[data-linkid]');
if (element) {
return diagramModel.getLink(element.getAttribute('data-linkid'));
}
//look for a node
element = Toolkit.closest(target, '.node[data-nodeid]');
if (element) {
return diagramModel.getNode(element.getAttribute('data-nodeid'));
}
return null;
}