def drawCentralArea(self, layer): '''Draw the central area (第二中心区域).''' spacing = self.centralAreaSpacing descender = layer.descender ascender = layer.ascender if not self.centralAreaRotateState: width = self.centralAreaWidth height = ascender - descender x_mid = layer.width * self.centralAreaPosition / 100 (x0, y0) = (x_mid - spacing / 2 - width / 2, descender) (x1, y1) = (x_mid + spacing / 2 - width / 2, descender) else: width = layer.width height = self.centralAreaWidth y_mid = descender + (ascender - descender) * self.centralAreaPosition / 100 (x0, y0) = (0, y_mid - spacing / 2 - height / 2) (x1, y1) = (0, y_mid + spacing / 2 - height / 2) # TODO: color color = NSColor.systemGrayColor().colorWithAlphaComponent_(0.2) color.set() NSBezierPath.fillRect_(((x0, y0), (width, height))) NSBezierPath.fillRect_(((x1, y1), (width, height)))