Commit 6bb9cfa7 authored by Jörg Richter's avatar Jörg Richter

Fix handling `setTopicPosition` websocket message

See dmx-platform/dmx-platform#384
parent d5eabe5c
Pipeline #10482 passed with stage
in 1 second
......@@ -70,8 +70,8 @@ export default class CytoscapeView {
writable ? eh.enable() : eh.disable()
selection = _selection
return svgReady.then(() => {
console.log('renderTopicmap', topicmap.id)
console.time('renderTopicmap')
// console.log('renderTopicmap', topicmap.id)
// console.time('renderTopicmap')
// Note 1: utilization of cy.batch() would have a detrimental effect on calculating aux node positions of parallel
// edges. This is because aux node positions of parallel edges are calculated several times.
// Note 2: the cytoscape-edge-connections extension expects an aux node still to exist at the time its edge is
......@@ -84,7 +84,7 @@ export default class CytoscapeView {
x: topicmap.viewProps['dmx.topicmaps.pan_x'],
y: topicmap.viewProps['dmx.topicmaps.pan_y']
}, topicmap.viewProps['dmx.topicmaps.zoom'])
console.timeEnd('renderTopicmap')
// console.timeEnd('renderTopicmap')
})
}
......
......@@ -325,10 +325,13 @@ const actions = {
_setTopicPosition (_, {topicmapId, topicId, pos}) {
if (topicmapId === _topicmap.id) {
const viewTopic = _topicmap.getTopic(topicId)
viewTopic.setPosition(pos) // update state
if (viewTopic.isVisible()) {
cyView.updateTopicPos(topicId, pos) // update view
// Note: the topic might not be in this topicmap because not readable by current user
const viewTopic = _topicmap.getTopicIfExists(topicId)
if (viewTopic) {
viewTopic.setPosition(pos) // update state
if (viewTopic.isVisible()) {
cyView.updateTopicPos(topicId, pos) // update view
}
}
}
},
......
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