//  Created by Joe Becker on 3/7/05.
//  Copyright 2005 __MyCompanyName__. All rights reserved.

#import "DragRect.h"

@implementation DragRect

- initFrom:(NSRect)theRect;
{
	[super init];         // Init the NSObject superclass!
	
//	myRect = NSIntegralRect(theRect);
	myRect = NSInsetRect(theRect, -1./360000., -1./360000.);
	
	start = NSMakePoint(0,0);
	end   = NSMakePoint(0,0);
	color = [[NSColor yellowColor] retain];	//FIXME: this color isn't shown...
	lineType = SOLID_LINE;
	return self;
}

- (NSRect)bounds 
{
	return(myRect);
	
	const float sloppyCoding = -1.; //FIXME: AppKit(???) has an "off by one" bug, leaves turds...
	return NSIntegralRect(NSInsetRect(myRect, sloppyCoding, sloppyCoding));
	
//	NSSize sz = [view convertSize:NSMakeSize(1,1) fromView:nil];
//	return NSIntegralRect(NSInsetRect(myRect, 1/sz.width, 1/sz.height));
	
}

- (void)stroke
{	
	[NSBezierPath strokeRect:myRect];
}


@end
