I am having some trouble figuring out the correct way to determine the bounds of NZBezierPath for redrawing correctly.
As you can see from the picture below the thin border line seems to be falling outside the NSBezierPath.bounds rectangle.
The code for handling the object dragging is as follows:
func offsetItemLocationBy(item: DItem, x: CGFloat, y:CGFloat)
{
// tell the display to redraw the old rect
let oldBounds = item.bounds // NSBezierPath.bounds
// since the offset can be generated by both mouse moves
// and moveUp:, moveDown:, etc.. actions, we'll invert
// the deltaY amount based on if the view is flipped or
// not.
let invertDeltaY: CGFloat = self.isFlipped ? -1.0: 1.0
let y1=y*invertDeltaY
item.offsetLocationBy(x: x, y: y1) // Creates a new NSBezierPath
self.setNeedsDisplay(oldBounds)
// invalidate the new rect location so that it'll
// be redrawn
self.setNeedsDisplay(item.bounds)
}
Should I be using some other method to calculate the bounds of NSBezierPath?