Changeset - addcbaf1754f
[Not reviewed]
default
0 1 0
Laman - 6 years ago 2018-12-04 16:31:29

fix: BoardView padding now relative
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/gui/boardview.py
Show inline comments
 
@@ -58,26 +58,27 @@ class BoardView(ResizableCanvas):
 
	#
 
	#  @param r row coordinate, [0-18], counted from top
 
	#  @param c column coordinate, [0-18], counted from left
 
	#  @param color color indicator, go.BLACK or go.WHITE
 
	def _drawStone(self, r, c, color, label=""):
 
		if color==BLACK:
 
			hexCode='#000000'
 
			altCode='#ffffff'
 
			tag="black"
 
		elif color==WHITE:
 
			hexCode='#ffffff'
 
			altCode='#000000'
 
			tag="white"
 
		else: return False
 

	
 
		x=c*self._cellWidth+self._padding
 
		y=r*self._cellHeight+self._padding
 
		radius=self._cellWidth/2
 
		self.create_oval(x-radius,y-radius,x+radius,y+radius,tags=tag,fill=hexCode)
 
		if label:
 
			self.create_text(x,y,text=label,tags="label",fill=altCode)
 

	
 
	def _onResize(self,event):
 
		super()._onResize(event)
 
		self._padding=24*self._width/360
 
		self._cellWidth=(self._width-2*self._padding)/18
 
		self._cellHeight=(self._height-2*self._padding)/18
0 comments (0 inline, 0 general)