ericabouaf / wireit

A javascript wiring library to create web wirable interfaces for dataflow applications, visual programming languages or graphical modeling.
http://neyric.github.io/wireit/docs/
Other
520 stars 90 forks source link

A negative pos in addModule() could give you an undraggable Module #38

Closed damipoo closed 14 years ago

damipoo commented 14 years ago

Hi, I found out that if you don't completely drag the module from the ModuleList into the editor, if either element in the pos argument is negative, you could end up with a module that is undraggable.

At least that happens with the FormContainer when the title area is off limits. I made a simple patch to WiringEditor.addModule() adding a simple boundary check.

Greetings.


diff --git a/plugins/editor/js/WiringEditor.js b/plugins/editor/js/WiringEditor.js
index 3ddf29f..2b1c9f7 100644
--- a/plugins/editor/js/WiringEditor.js
+++ b/plugins/editor/js/WiringEditor.js
@@ -193,6 +193,8 @@ lang.extend(WireIt.WiringEditor, WireIt.BaseEditor, {
         */
        addModule: function(module, pos) {
            try {
+              if (pos[0] < 0) pos[0] = 0;
+              if (pos[1] < 0) pos[1] = 0;
               var containerConfig = module.container;
               containerConfig.position = pos;
               containerConfig.title = module.name;
ericabouaf commented 14 years ago

thanks, I applied you fix