Skip to content

Commit

Permalink
grid size clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jchanvfx committed Jun 7, 2019
1 parent bbf94bb commit e50a60f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions NodeGraphQt/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
VIEWER_BG_COLOR = (35, 35, 35)
VIEWER_GRID_COLOR = (45, 45, 45)
VIEWER_GRID_OVERLAY = True
VIEWER_GRID_SIZE = 20

SCENE_AREA = 8000.0

Expand Down
6 changes: 3 additions & 3 deletions NodeGraphQt/widgets/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from NodeGraphQt import QtGui, QtCore, QtWidgets

from NodeGraphQt.constants import (VIEWER_BG_COLOR,
VIEWER_GRID_SIZE,
VIEWER_GRID_OVERLAY,
VIEWER_GRID_COLOR)

Expand Down Expand Up @@ -47,17 +48,16 @@ def drawBackground(self, painter, rect):
return

zoom = self.viewer().get_zoom()
grid_size = 20

if zoom > -0.5:
pen = QtGui.QPen(QtGui.QColor(*self.grid_color), 0.65)
self._draw_grid(painter, rect, pen, grid_size)
self._draw_grid(painter, rect, pen, VIEWER_GRID_SIZE)

color = bg_color.darker(150)
if zoom < -0.0:
color = color.darker(100 - int(zoom * 110))
pen = QtGui.QPen(color, 0.65)
self._draw_grid(painter, rect, pen, grid_size * 8)
self._draw_grid(painter, rect, pen, VIEWER_GRID_SIZE * 8)

# fix border issue on the scene edge.
pen = QtGui.QPen(bg_color, 2)
Expand Down

0 comments on commit e50a60f

Please sign in to comment.