Commit de0c64bb authored by Richard Marston's avatar Richard Marston
Browse files

Fix context menu

parent 6c68bd02
Pipeline #71319 passed with stages
in 7 minutes and 34 seconds
......@@ -230,7 +230,7 @@ var contextmenu = new tag('nav').
c(new tag('li').
a('class', '"context-menu-item"').
c(new tag('a').
a('class').a('onclick', '"cimcontextmenu.removeComponent()"').
a('class').a('onclick', '"currentCimsvg().getContextMenu().removeComponent()"').
t("Delete Component"))))
var main = new tag('div').a('id', '"main"').c(diagram).c(floating_menu).c(contextmenu)
......
......@@ -27,6 +27,7 @@ cimsvg.setCimsvg(cimsvgInstance);
let contextMenu = new contextmenu(document.getElementById("context-menu"), "context-menu")
contextMenu.resizeListener(window);
contextMenu.keyUpListener(window);
cimsvgInstance.setContextMenu(contextMenu);
document.oncontextmenu = function(e){
if(e.preventDefault != undefined) {
......
......@@ -46,8 +46,17 @@ class cimsvg {
this.rdfFileCount = 0;
this.rdfFileReceived = 0;
this.jsonBaseData = null;
this.contextMenu = null;
}
setContextMenu(menu) {
this.contextMenu = menu;
};
getContextMenu() {
return this.contextMenu;
};
/*
* How many pieces the data will be arriving in
*/
......
......@@ -19,12 +19,10 @@
class contextmenu {
constructor(menu, label) {
console.log(menu, label);
this.menuList = { [label]: menu };
this.menuState = {};
this.id;
this.type;
console.log(this.menuList);
}
keyUpListener(_window) {
......@@ -70,7 +68,6 @@ class contextmenu {
* Positions the menu.
*/
positionMenu(pos, menuName) {
console.log(menuName)
this.menuList[menuName].style.left = pos.x + "px";
this.menuList[menuName].style.top = pos.y + "px";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment