Compare commits

...

2 commits

2 changed files with 28 additions and 4 deletions

View file

@ -315,10 +315,8 @@ const Create = {
Create.newSynapse.description = $(this).val() Create.newSynapse.description = $(this).val()
}) })
$('#synapse_desc').focusout(function() { $('#synapse_desc').focusout(function(e) {
if (Create.newSynapse.beingCreated) { Create.newSynapse.hide()
Synapse.createSynapseLocally()
}
}) })
$('#synapse_desc').keydown(function(e) { $('#synapse_desc').keydown(function(e) {

View file

@ -33,6 +33,7 @@ const JIT = {
dragFlag: 0, dragFlag: 0,
dragTolerance: 0, dragTolerance: 0,
virtualPointer: {}, virtualPointer: {},
autoCreateSynapseTimeoutId: null,
events: { events: {
topicDrag: 'Metamaps:JIT:events:topicDrag', topicDrag: 'Metamaps:JIT:events:topicDrag',
@ -895,7 +896,28 @@ const JIT = {
}) })
temp.setData('dim', 35, 'current') temp.setData('dim', 35, 'current')
Visualize.mGraph.plot() Visualize.mGraph.plot()
// if they hold the mouse over the topic, auto create the synapse after 1000ms
if (JIT.autoCreateSynapseTimeoutId === null) {
JIT.autoCreateSynapseTimeoutId = window.setTimeout(() => {
Create.newSynapse.description = ''
Create.newSynapse.topic2id = temp.getData('topic').id
Synapse.createSynapseLocally()
JIT.tempNode = null
JIT.tempNode2 = null
JIT.tempInit = false
Mouse.synapseStartCoordinates = []
Mouse.synapseEndCoordinates = null
temp.setData('dim', 25, 'current')
JIT.autoCreateSynapseTimeoutId = null
}, 1000)
}
} else if (!temp) { } else if (!temp) {
window.clearTimeout(JIT.autoCreateSynapseTimeoutId)
JIT.autoCreateSynapseTimeoutId = null
JIT.tempNode2 = null JIT.tempNode2 = null
Visualize.mGraph.graph.eachNode(function(n) { Visualize.mGraph.graph.eachNode(function(n) {
n.setData('dim', 25, 'current') n.setData('dim', 25, 'current')
@ -926,6 +948,8 @@ const JIT = {
if (JIT.tempNode2) JIT.tempNode2.setData('dim', 25, 'current') if (JIT.tempNode2) JIT.tempNode2.setData('dim', 25, 'current')
JIT.tempNode2 = null JIT.tempNode2 = null
JIT.tempInit = false JIT.tempInit = false
window.clearTimeout(JIT.autoCreateSynapseTimeoutId)
JIT.autoCreateSynapseTimeoutId = null
// reset the draw synapse positions to false // reset the draw synapse positions to false
Mouse.synapseStartCoordinates = [] Mouse.synapseStartCoordinates = []
Mouse.synapseEndCoordinates = null Mouse.synapseEndCoordinates = null
@ -967,6 +991,8 @@ const JIT = {
$('#new_synapse').css('left', pixelPos.x + 'px') $('#new_synapse').css('left', pixelPos.x + 'px')
$('#new_synapse').css('top', pixelPos.y + 'px') $('#new_synapse').css('top', pixelPos.y + 'px')
Create.newSynapse.open() Create.newSynapse.open()
window.clearTimeout(JIT.autoCreateSynapseTimeoutId)
JIT.autoCreateSynapseTimeoutId = null
JIT.tempNode = null JIT.tempNode = null
JIT.tempNode2 = null JIT.tempNode2 = null
JIT.tempInit = false JIT.tempInit = false