Added parent containment option for draggable. (#1006)

* added parent containment option for draggable

* taking Nick's suggestion, #main-container it is
This commit is contained in:
TJKoury 2016-10-02 17:45:49 -04:00 committed by Nick O'Leary
parent 15f1e2c85c
commit 54036a2b4d
1 changed files with 3 additions and 1 deletions

View File

@ -227,18 +227,20 @@ RED.palette = (function() {
appendTo: 'body',
revert: true,
revertDuration: 50,
containment:'#main-container',
start: function() {RED.view.focus();},
stop: function() { d3.select('.link_splice').classed('link_splice',false); if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null;}},
drag: function(e,ui) {
// TODO: this is the margin-left of palette node. Hard coding
// it here makes me sad
//console.log(ui.helper.position());
ui.position.left += 17.5;
if (def.inputs > 0 && def.outputs > 0) {
mouseX = ui.position.left+(ui.helper.width()/2) - chartOffset.left + chart.scrollLeft();
mouseY = ui.position.top+(ui.helper.height()/2) - chartOffset.top + chart.scrollTop();
if (!spliceTimer) {
spliceTimer = setTimeout(function() {
var nodes = [];