Skip to content

Commit

Permalink
(#1142) snap_var2 -> snap_var2seg
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed Nov 24, 2019
1 parent 06d6269 commit 0b443f4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/game/level/level_editor/rect_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void snap_var(float *x, // the value we are snapping
}

static
void snap_var2(float *x, float y,
void snap_var2seg(float *x, float y,
float xo, float yo,
float st)
{
Expand Down Expand Up @@ -601,7 +601,7 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(x, x + w), vec(b.x, b.x + b.w))) {
snap_var2(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
snap_var2seg(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
}
}

Expand All @@ -619,7 +619,7 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(y, y + h), vec(b.y, b.y + b.h))) {
snap_var2(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
snap_var2seg(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
}
}

Expand All @@ -638,11 +638,11 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(y, y + h), vec(b.y, b.y + b.h))) {
snap_var2(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
snap_var2seg(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
}

if (segment_overlap(vec(x, x + w), vec(b.x, b.x + b.w))) {
snap_var2(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
snap_var2seg(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
}
}

Expand All @@ -660,7 +660,7 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(x, x + w), vec(b.x, b.x + b.w))) {
snap_var2(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
snap_var2seg(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
}
}

Expand All @@ -680,11 +680,11 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(y, y + h), vec(b.y, b.y + b.h))) {
snap_var2(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
snap_var2seg(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
}

if (segment_overlap(vec(x, x + w), vec(b.x, b.x + b.w))) {
snap_var2(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
snap_var2seg(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
}
}

Expand All @@ -703,7 +703,7 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(y, y + h), vec(b.y, b.y + b.h))) {
snap_var2(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
snap_var2seg(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
}
}

Expand All @@ -723,11 +723,11 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(y, y + h), vec(b.y, b.y + b.h))) {
snap_var2(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
snap_var2seg(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
}

if (segment_overlap(vec(x, x + w), vec(b.x, b.x + b.w))) {
snap_var2(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
snap_var2seg(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
}
}

Expand All @@ -747,11 +747,11 @@ static int rect_layer_event_resize(RectLayer *layer,

const Rect b = rects[i];
if (segment_overlap(vec(y, y + h), vec(b.y, b.y + b.h))) {
snap_var2(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
snap_var2seg(&x, b.x, 0, b.w, SNAPPING_THRESHOLD);
}

if (segment_overlap(vec(x, x + w), vec(b.x, b.x + b.w))) {
snap_var2(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
snap_var2seg(&y, b.y, 0, b.h, SNAPPING_THRESHOLD);
}
}

Expand Down

0 comments on commit 0b443f4

Please sign in to comment.