subset of synapse creation changes (#970)
* esc cancels topic and synapse creation now * close topic/synapse creation on right click * backspace and delete don't close synapse creation anymore * hitting tab saves the synapse you're creating
This commit is contained in:
parent
6129a27ecf
commit
1ba339b3be
2 changed files with 23 additions and 7 deletions
|
@ -140,7 +140,13 @@ const Create = {
|
|||
},
|
||||
newTopic: {
|
||||
init: function() {
|
||||
$('#topic_name').keyup(function() {
|
||||
$('#topic_name').keyup(function(e) {
|
||||
const ESC = 27
|
||||
|
||||
if (e.keyCode === ESC) {
|
||||
Create.newTopic.hide()
|
||||
} // if
|
||||
|
||||
Create.newTopic.name = $(this).val()
|
||||
})
|
||||
|
||||
|
@ -301,13 +307,11 @@ const Create = {
|
|||
|
||||
$('#synapse_desc').keyup(function(e) {
|
||||
const ESC = 27
|
||||
const BACKSPACE = 8
|
||||
const DELETE = 46
|
||||
if (e.keyCode === BACKSPACE && $(this).val() === '' ||
|
||||
e.keyCode === DELETE && $(this).val() === '' ||
|
||||
e.keyCode === ESC) {
|
||||
|
||||
if (e.keyCode === ESC) {
|
||||
Create.newSynapse.hide()
|
||||
} // if
|
||||
|
||||
Create.newSynapse.description = $(this).val()
|
||||
})
|
||||
|
||||
|
@ -317,6 +321,14 @@ const Create = {
|
|||
}
|
||||
})
|
||||
|
||||
$('#synapse_desc').keydown(function(e) {
|
||||
const TAB = 9
|
||||
if (Create.newSynapse.beingCreated && e.keyCode === TAB) {
|
||||
e.preventDefault()
|
||||
Synapse.createSynapseLocally()
|
||||
}
|
||||
})
|
||||
|
||||
$('#synapse_desc').bind('typeahead:select', function(event, datum, dataset) {
|
||||
if (datum.id) { // if they clicked on an existing synapse get it
|
||||
Synapse.getSynapseFromAutocomplete(datum.id)
|
||||
|
|
|
@ -420,6 +420,8 @@ const JIT = {
|
|||
$('.rightclickmenu').remove()
|
||||
|
||||
if (Mouse.boxStartCoordinates) {
|
||||
Create.newSynapse.hide()
|
||||
Create.newTopic.hide()
|
||||
Visualize.mGraph.busy = false
|
||||
Mouse.boxEndCoordinates = eventInfo.getPos()
|
||||
JIT.selectWithBox(e)
|
||||
|
@ -434,7 +436,9 @@ const JIT = {
|
|||
} else if (node && !node.nodeFrom) {
|
||||
JIT.selectNodeOnRightClickHandler(node, e)
|
||||
} else {
|
||||
// console.log('right clicked on open space')
|
||||
// right click open space
|
||||
Create.newSynapse.hide()
|
||||
Create.newTopic.hide()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue