Adjusted snap line thresholds so resizing feels less stupid

This commit is contained in:
Zakk 2016-12-29 09:33:53 -05:00
parent 827b2e0849
commit 0cef71dccb
4 changed files with 7 additions and 7 deletions

View file

@ -104,8 +104,8 @@
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSetLineWidth( currentContext, 2.0 );
CGContextSetStrokeColorWithColor(currentContext, [[NSColor blueColor] CGColor]);
CGContextSetLineWidth( currentContext, 1.0 );
CGContextSetStrokeColorWithColor(currentContext, [[NSColor cyanColor] CGColor]);
CGContextStrokeRect(currentContext, [self insetSelectionRect]);
if (self.renderControls && self.parentSource && self.previewView)

View file

@ -18,7 +18,7 @@
@class SourceLayout;
//@class InputSource;
#define SNAP_THRESHOLD 10.0f
#define SNAP_THRESHOLD 5.0f

View file

@ -926,7 +926,7 @@
if (_snap_x != -1)
{
_snap_x_accum += *dx;
if (fabs(_snap_x_accum) > SNAP_THRESHOLD*2)
if (fabs(_snap_x_accum) > SNAP_THRESHOLD)
{
_snap_x = -1;
*dx = _snap_x_accum;
@ -941,7 +941,7 @@
if (_snap_y != -1)
{
_snap_y_accum += *dy;
if (fabs(_snap_y_accum) > SNAP_THRESHOLD*2)
if (fabs(_snap_y_accum) > SNAP_THRESHOLD)
{
_snap_y = -1;
*dy = _snap_y_accum;
@ -962,7 +962,7 @@
NSPoint c_snap = c_snaps[j];
dist = [self pointDistance:s_snap b:c_snap];
if (!did_snap_x && (copysignf(dist.x, *dx) != dist.x) && (fabs(dist.x) < SNAP_THRESHOLD))
if (!did_snap_x && (copysignf(dist.x, *dx) != dist.x) && (fabs(dist.x) < SNAP_THRESHOLD*2))
{
if ((s_snap.x != c_snap.x) && (_snap_x == -1))
{
@ -973,7 +973,7 @@
}
}
if ((*dy != 0) && !did_snap_y && (copysignf(dist.y, *dy) != dist.y) && (fabs(dist.y) < SNAP_THRESHOLD))
if ((*dy != 0) && !did_snap_y && (copysignf(dist.y, *dy) != dist.y) && (fabs(dist.y) < SNAP_THRESHOLD*2))
{
if ((s_snap.y != c_snap.y) && (_snap_y == -1))