def _render_box(self, component, gc, view_bounds=None, mode='normal'): # draw the arrow if necessary if self.arrow_visible: if self._cached_arrow is None: if self.arrow_root in self._root_positions: ox, oy = self._root_positions[self.arrow_root] else: if self.arrow_root == "auto": arrow_root = self.label_position else: arrow_root = self.arrow_root pos = self._position_root_map.get(arrow_root, "DUMMY") ox, oy = self._root_positions.get(pos, (self.x + self.width / 2, self.y + self.height / 2)) if type(ox) == str: ox = getattr(self, ox) oy = getattr(self, oy) self._cached_arrow = draw_arrow(gc, (ox, oy), self._screen_coords, self.arrow_color_, arrowhead_size=self.arrow_size, offset1=3, offset2=self.marker_size + 3, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) else: draw_arrow(gc, None, None, self.arrow_color_, arrow=self._cached_arrow, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) # layout and render the label itself ToolTip.overlay(self, component, gc, view_bounds, mode)
def overlay(self, component, gc, view_bounds=None, mode="normal"): """ Draws the tooltip overlaid on another component. Overrides and extends ToolTip.overlay() """ if self.clip_to_plot: gc.save_state() c = component gc.clip_to_rect(c.x, c.y, c.width, c.height) self.do_layout() # draw the arrow if necessary if self.arrow_visible: if self._cached_arrow is None: if self.arrow_root in self._root_positions: ox, oy = self._root_positions[self.arrow_root] else: if self.arrow_root == "auto": arrow_root = self.label_position else: arrow_root = self.arrow_root ox, oy = self._root_positions.get( self._position_root_map.get(arrow_root, "DUMMY"), (self.x + self.width / 2, self.y + self.height / 2)) if type(ox) == str: ox = getattr(self, ox) oy = getattr(self, oy) self._cached_arrow = draw_arrow(gc, (ox, oy), self._screen_coords, self.arrow_color_, arrowhead_size=self.arrow_size, offset1=3, offset2=self.marker_size + 3, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) else: draw_arrow(gc, None, None, self.arrow_color_, arrow=self._cached_arrow, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) # layout and render the label itself ToolTip.overlay(self, component, gc, view_bounds, mode) # draw the marker if self.marker_visible: render_markers(gc, [self._screen_coords], self.marker, self.marker_size, self.marker_color_, self.marker_line_width, self.marker_line_color_, self.custom_symbol) if self.clip_to_plot: gc.restore_state()
def overlay(self, component, gc, view_bounds=None, mode="normal"): """ Draws the tooltip overlaid on another component. Overrides and extends ToolTip.overlay() """ if self.clip_to_plot: gc.save_state() c = component gc.clip_to_rect(c.x, c.y, c.width, c.height) self.do_layout() # draw the arrow if necessary if self.arrow_visible: if self._cached_arrow is None: if self.arrow_root in self._root_positions: ox, oy = self._root_positions[self.arrow_root] else: if self.arrow_root == "auto": arrow_root = self.label_position else: arrow_root = self.arrow_root ox, oy = self._root_positions.get( self._position_root_map.get(arrow_root, "DUMMY"), (self.x+self.width/2, self.y+self.height/2) ) if type(ox) == str: ox = getattr(self, ox) oy = getattr(self, oy) self._cached_arrow = draw_arrow(gc, (ox, oy), self._screen_coords, self.arrow_color_, arrowhead_size=self.arrow_size, offset1=3, offset2=self.marker_size+3, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) else: draw_arrow(gc, None, None, self.arrow_color_, arrow=self._cached_arrow, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) # layout and render the label itself ToolTip.overlay(self, component, gc, view_bounds, mode) # draw the marker if self.marker_visible: render_markers(gc, [self._screen_coords], self.marker, self.marker_size, self.marker_color_, self.marker_line_width, self.marker_line_color_, self.custom_symbol) if self.clip_to_plot: gc.restore_state()
def _render_box(self, component, gc, view_bounds=None, mode='normal'): # draw the arrow if necessary if self.arrow_visible: if self._cached_arrow is None: if self.arrow_root in self._root_positions: ox, oy = self._root_positions[self.arrow_root] else: if self.arrow_root == "auto": arrow_root = self.label_position else: arrow_root = self.arrow_root pos = self._position_root_map.get(arrow_root, "DUMMY") ox, oy = self._root_positions.get( pos, (self.x + self.width / 2, self.y + self.height / 2)) if type(ox) == str: ox = getattr(self, ox) oy = getattr(self, oy) self._cached_arrow = draw_arrow(gc, (ox, oy), self._screen_coords, self.arrow_color_, arrowhead_size=self.arrow_size, offset1=3, offset2=self.marker_size + 3, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) else: draw_arrow(gc, None, None, self.arrow_color_, arrow=self._cached_arrow, minlen=self.arrow_min_length, maxlen=self.arrow_max_length) # layout and render the label itself ToolTip.overlay(self, component, gc, view_bounds, mode)