Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions engine/flowy.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
var flowy = function(canvas, grab, release, snapping, rearrange, spacing_x, spacing_y) {
if (!grab) {
grab = function() {};
}
if (!release) {
release = function() {};
}
if (!snapping) {
snapping = function() {
return true;
}
}
if (!rearrange) {
rearrange = function() {
return false;
}
}
if (!spacing_x) {
spacing_x = 20;
}
if (!spacing_y) {
spacing_y = 80;
}
grab = grab || function() {};
release = release || function() {};
snapping = snapping || function () { true; }
rearrange = rearrange || function () { false; }
spacing_x = typeof spacing_x == undefined ? 20 : spacing_x;
spacing_y = typeof spacing_y == undefined ? 20 : spacing_y;
Comment on lines +2 to +7
Copy link
Copy Markdown

@Jhoubert Jhoubert Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You code is breaking the normal behavior since is expecting a value, you're missing it, this is a working one-liner.

Suggested change
grab = grab || function() {};
release = release || function() {};
snapping = snapping || function () { true; }
rearrange = rearrange || function () { false; }
spacing_x = typeof spacing_x == undefined ? 20 : spacing_x;
spacing_y = typeof spacing_y == undefined ? 20 : spacing_y;
grab = grab || function() {};
release = release || function() {};
snapping = snapping || function () {return true; }
rearrange = rearrange || function () { return false; }
spacing_x = !spacing_x ? 20 : spacing_x;
spacing_y = !spacing_y ? 80: spacing_y;


if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector ||
Element.prototype.webkitMatchesSelector;
Expand Down