Removed non-required loop

This commit is contained in:
Tim Stallard 2017-02-21 10:55:34 +00:00
parent e0e7568667
commit 3f6b5ebaa5

View File

@ -4,7 +4,8 @@ var $ = require("jquery");
var uuid = require("node-uuid"); var uuid = require("node-uuid");
function blockPositionChange(event){ function blockPositionChange(event){
for(var block of diagram.state.filter((block)=>(block.dragging))){ var block = diagram.state.filter((block)=>(block.dragging))[0];
if(block){
block.position.x = event.pageX - $("#workspace").position().left - block.offset.x; block.position.x = event.pageX - $("#workspace").position().left - block.offset.x;
block.position.y = event.pageY - $("#workspace").position().top - block.offset.y; block.position.y = event.pageY - $("#workspace").position().top - block.offset.y;
@ -24,8 +25,8 @@ $("#blocks").on("mousedown", ".block>.main,.block>.inputs", function(event){
}, },
dragging: true, dragging: true,
offset: { offset: {
x: event.pageX - $(this).parent().offset().left, x: event.offsetX,
y: event.pageY - $(this).parent().offset().top y: event.offsetY
}, },
type: $(this).parent().data("type") type: $(this).parent().data("type")
} }