Commit 1a033cff authored by Jörg Richter's avatar Jörg Richter

Fix: disable create-assoc gesture when no WRITE permission

See dmx-platform/dmx-platform#296
parent a636c86c
Pipeline #8163 passed with stage
in 2 seconds
......@@ -25,6 +25,7 @@ const svgReady = dm5.restClient.getXML(fa).then(svg => {
let cy // Cytoscape instance
let ec // cytoscape-edge-connections API object
let eh // cytoscape-edgehandles API object
let parent // the dm5-topicmap-panel (a Vue instance); used as event emitter
let box // the measurement box
let modifiers // modifier keys
......@@ -52,15 +53,16 @@ export default class CytoscapeView {
dispatch = _dispatch
cy = instantiateCy(container)
ec = cy.edgeConnections()
eh = edgeHandles()
cy.autopanOnDrag()
contextMenus(contextCommands)
edgeHandles()
eventHandlers()
}
// -------------------------------------------------------------------------------------------------------- Public API
renderTopicmap (topicmap, _selection) {
renderTopicmap (topicmap, writable, _selection) {
writable ? eh.enable() : eh.disable()
selection = _selection
return svgReady.then(() => {
console.log('renderTopicmap', topicmap.id)
......@@ -441,7 +443,7 @@ function size (idLists) {
// Edge Handles
function edgeHandles () {
cy.edgehandles({
return cy.edgehandles({
preview: false,
handlePosition (node) {
return !isAuxNode(node) ? 'middle top' : 'middle middle'
......
......@@ -26,7 +26,10 @@ let _topicmapWritable // true if the current user has WRITE permission for the
let _object // the selected object (dm5.DMXObject)
let cyView // the CytoscapeView instance, initialized by "_initCytoscape" action
let cyView // The CytoscapeView instance, initialized by "_initCytoscape" action.
// The instance lives as long as the Cytoscape Renderer is active. That is when switching
// between topicmaps the same instance is (re)used. Only when switching from the Geomap Renderer
// to the Cytoscape Renderer a new instance is created.
let ele // The single selection: a selected Cytoscape element (node or edge). Undefined if there is no
// single selection.
// The selected element's details are displayed in-map. On unselect the details disappear
......@@ -83,7 +86,7 @@ const actions = {
ele = undefined
state.selection = selection
state.details = {}
return cyView.renderTopicmap(topicmap, selection).then(showPinnedDetails)
return cyView.renderTopicmap(topicmap, writable, selection).then(showPinnedDetails)
},
// Topicmap type specific actions
......
Markdown is supported
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