Added offset to label's y-pos so that the label does not overflow the image (#324)

This commit is contained in:
ap193uee 2018-07-10 08:18:57 +05:30 committed by vdalv
parent 4f84f68b96
commit c88eb28e7c

View File

@ -18,6 +18,7 @@ DEFAULT_SELECT_LINE_COLOR = QColor(255, 255, 255)
DEFAULT_SELECT_FILL_COLOR = QColor(0, 128, 255, 155) DEFAULT_SELECT_FILL_COLOR = QColor(0, 128, 255, 155)
DEFAULT_VERTEX_FILL_COLOR = QColor(0, 255, 0, 255) DEFAULT_VERTEX_FILL_COLOR = QColor(0, 255, 0, 255)
DEFAULT_HVERTEX_FILL_COLOR = QColor(255, 0, 0) DEFAULT_HVERTEX_FILL_COLOR = QColor(255, 0, 0)
MIN_Y_LABEL = 10
class Shape(object): class Shape(object):
@ -124,6 +125,8 @@ class Shape(object):
painter.setFont(font) painter.setFont(font)
if(self.label == None): if(self.label == None):
self.label = "" self.label = ""
if(min_y < MIN_Y_LABEL):
min_y += MIN_Y_LABEL
painter.drawText(min_x, min_y, self.label) painter.drawText(min_x, min_y, self.label)
if self.fill: if self.fill: