public void DrawReleased(Map map, Point pixelPosition) { if (!ImageUtils.Intersects(map.CurrentLayer.Value.Group, pixelPosition)) { pixelPosition = ImageUtils.BindPoint(map.CurrentLayer.Value.Group, pixelPosition); } Point topLeft = GeometryUtils.TopLeftPoint(this.pressPoint, pixelPosition); Point bottomRight = GeometryUtils.BottomRightPoint(this.pressPoint, pixelPosition); Stack <Tile> tiles = DrawTiles(topLeft, bottomRight); DrawAction action = new DrawAction(this.ToolName, tiles); map.Draw(action); this.isDrawing = false; }
public void DrawPressed(Map map, Point pixelPosition) { if (!this.isDrawing) { this.pressPoint = pixelPosition; } else { Point topLeft = GeometryUtils.TopLeftPoint(this.pressPoint, pixelPosition); Point bottomRight = GeometryUtils.BottomRightPoint(this.pressPoint, pixelPosition); Stack <Tile> tiles = DrawTiles(topLeft, bottomRight); DrawAction action = new DrawAction(this.ToolName, tiles); map.Draw(action); } this.isDrawing = !this.isDrawing; }