{"comment":{"created_at":"2011-10-08T17:39:58Z","body":"Ah, an important bit of info, and this points to @peller as being the most knowledgeable about 'cursorOnly': it looks like the cursorOnly logic is there to support the dynamic creation of the black vertical bar drop point when doing interactive dragging on the canvas when using flow layout. My analysis about charting out the code paths was when I was testing out *absolute* layout.\r\n\r\nNevertheless, we need to do some code cleanup.","updated_at":"2011-10-08T17:39:58Z","url":"https://api.github.com/repos/maqetta/maqetta/issues/comments/2333015","id":2333015,"user":{"avatar_url":"https://secure.gravatar.com/avatar/7d36042b898a8cb379cab49328f3f231?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/JonFerraiolo","id":706721,"login":"JonFerraiolo"}},"action":"created","issue":{"number":1066,"created_at":"2011-10-08T17:30:41Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"@billreed63, @peller\r\n\r\nThere is a cursorOnly flag passed into sometimes as a 3rd parameter to SelectTools.js:onExtentChange(), and tracing through with debugger, this looks like something we should clean up.\r\n\r\nIn Focus.js, the first lines of ```onMove``` look like this:\r\n\r\n```\r\n\tonMove: function(mover, box, event){\r\n\t\tif(this._nobIndex < 0){ // frame\r\n\t\t\tthis.move(box);\r\n\t\t\tthis._client = {x: event.clientX, y: event.clientY};\r\n\t\t\tif(!this._updateTarget){\r\n\t\t\t\tthis._updateTarget = setTimeout(dojo.hitch(this, function(){\r\n\t\t\t\t\tthis.onExtentChange(this, this._client, true);\r\n\t\t\t\t\tdelete this._updateTarget;\r\n\t\t\t\t}), 200);\r\n\t\t\t}\r\n\t\t}else{\r\n```\r\n\r\nFirst question here is why we need the setTimeout? Anyone know?\r\n\r\nAfter an intermediate stop in Context.js:onExtentChange(), the code flows into SelectTool.js:onExtentChange. Tracing through the debugger, I'm seeing that only the following lines of code get invoked when called from the above code in Focus.js:\r\n\r\n```\r\n\tonExtentChange: function(index, box, cursorOnly){\r\n\t\tvar selection = this._context.getSelection();\r\n\t\tvar newselection = [];\r\n\t\tif(selection.length <= index){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar widget = selection[index];\r\n\r\n\t\tvar command = undefined;\r\n                /* FOLLOWING IF BLOCK DOES NOT EXECUTE BECAUSE cursorOnly is true\r\n\t\tif(!cursorOnly && (\"w\" in box || \"h\" in box)){\r\n                   ...several lines...\r\n               */\r\n               }else{\r\n\r\n\t\t\tvar _node = widget.getStyleNode();\r\n\t\t\tif(cursorOnly && _node.style.position != \"absolute\"){\r\n\t\t\t\t// use mouse position for dropping in relative mode\r\n\t\t\t\tbox.l = box.x;\r\n\t\t\t\tbox.t = box.y;\r\n\t\t\t}\r\n                        /* FOLLOWING IF BLOCK DOES NOT EXECUTE BECAUSE box has x,y not l,t\r\n\t\t\tif(\"l\" in box && \"t\" in box) {\r\n                           ...many lines...\r\n                       }\r\n\t\t      */\r\n\t\t}\r\n\t\t/*FOLLOWING IF BLOCK DOES NOT EXECUTE BECAUSE \r\n                  no commands have been created\r\n                  and cursorOnly is true\r\n\t\tif(command){\r\n\t\t\tthis._context.getCommandStack().execute(command);\r\n\t\t\tdojo.forEach(newselection, function(w, i) {\r\n\t\t\t\tthis._context.select(w, i > 0);\r\n\t\t\t}, this);\t\t\t\r\n\t\t}else if(!cursorOnly){\r\n\t\t\tthis._context.select(widget); // update selection\r\n\t\t}\r\n                */\r\n\t},\r\n```\r\n\r\nwhich (if my analysis is correct) then only the following lines are executing:\r\n\r\n```\r\n\t\tvar selection = this._context.getSelection();\r\n\t\tvar newselection = [];\r\n\t\tif(selection.length <= index){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar widget = selection[index];\r\n\r\n\t\tvar command = undefined;\r\n\t\t\tvar _node = widget.getStyleNode();\r\n\t\t\tif(cursorOnly && _node.style.position != \"absolute\"){\r\n\t\t\t\t// use mouse position for dropping in relative mode\r\n\t\t\t\tbox.l = box.x;\r\n\t\t\t\tbox.t = box.y;\r\n\t\t\t}\r\n```\r\n\r\nwhich seems like a no-op, but maybe I'm missing something.","comments":1,"title":"Cleanup: cursorOnly logic in Focus.js and SelectTool.js","updated_at":"2011-10-08T17:39:58Z","url":"https://api.github.com/repos/maqetta/maqetta/issues/1066","id":1853086,"assignee":{"avatar_url":"https://secure.gravatar.com/avatar/7d36042b898a8cb379cab49328f3f231?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/JonFerraiolo","id":706721,"login":"JonFerraiolo"},"milestone":{"number":10,"created_at":"2011-04-29T19:02:19Z","due_on":"2011-11-18T08:00:00Z","title":"M4","creator":{"avatar_url":"https://secure.gravatar.com/avatar/7aea57b6d1c49e9daf17743533d06e76?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jhpedemonte","id":711365,"login":"jhpedemonte"},"url":"https://api.github.com/repos/maqetta/maqetta/milestones/10","open_issues":170,"closed_issues":23,"description":"","state":"open"},"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/7d36042b898a8cb379cab49328f3f231?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/JonFerraiolo","id":706721,"login":"JonFerraiolo"},"html_url":"https://github.com/maqetta/maqetta/issues/1066","labels":[{"name":"Priority Low","url":"https://api.github.com/repos/maqetta/maqetta/labels/Priority+Low","color":"FFE5FA"},{"name":"Visual Editor","url":"https://api.github.com/repos/maqetta/maqetta/labels/Visual+Editor","color":"444444"}],"state":"open"},"legacy":{"issue_id":1853086,"comment_id":2333015}}