Handles a brush event, toggling the display of foreground lines.
966037
function brush() {
      var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }),
          extents = actives.map(function(p) { return y[p].brush.extent(); }),
          selectedPaths = foregroundPaths.filter(function(d) {
            return actives.every(function(p, i) {
              return extents[i][0] <= d[p] && d[p] <= extents[i][1];
            });
          });
      foregroundPaths.style('display', 'none');
      selectedPaths.style('display', null);
      model.selectedData = selectedPaths.data();
    }
853086
def paintEvent( self, event ):
        
        lines = []
        count = 20
        
        # calculate the lines
        if ( self.orientation() == Qt.Vertical ):
            x = self._resizeGrip.pos().x()
            h = self.height()
            spacing = int(float(self._resizeGrip.width()) / count)
            
            for i in range(count):
                lines.append(QLine(x, 0, x, h))
                x += spacing
        else:
            y = self._resizeGrip.pos().y()
            w = self.width()
            spacing = int(float(self._resizeGrip.height()) / count)
            
            for i in range(count):
                lines.append(QLine(0, y, w, y))
                y += spacing
            
        # draw the lines
        with XPainter(self) as painter:
            pal = self.palette()
            painter.setPen(pal.color(pal.Window).darker(120))
            painter.drawLines(lines)
554954
protected void onDrawFrame( SurfaceView view , Canvas canvas ) {

		// Code below is usefull when debugging display issues
//		Paint paintFill = new Paint();
//		paintFill.setColor(Color.RED);
//		paintFill.setStyle(Paint.Style.FILL);
//		Paint paintBorder = new Paint();
//		paintBorder.setColor(Color.BLUE);
//		paintBorder.setStyle(Paint.Style.STROKE);
//		paintBorder.setStrokeWidth(6*displayMetrics.density);
//
//		Rect r = new Rect(0,0,view.getWidth(),view.getHeight());
//		canvas.drawRect(r,paintFill);
//		canvas.drawRect(r,paintBorder);
		switch( bitmapMode) {
			case UNSAFE:
				canvas.drawBitmap(this.bitmap, imageToView, null);
				break;

			case DOUBLE_BUFFER:
				bitmapLock.lock();
				try{
					canvas.drawBitmap(this.bitmap, imageToView, null);
				} finally {
					bitmapLock.unlock();
				}
				break;
		}
	}
696599
private void init() {
        _smoothed                  = true;
        _chartType                 = ChartType.LINE;
        _subDivisions              = 16;
        _snapToTicks               = false;
        _selectorFillColor         = Color.WHITE;
        _selectorStrokeColor       = Color.RED;
        _selectorSize              = 10;
        _decimals                  = 2;
        _interactive               = true;
        _tooltipTimeout            = 2000;
        formatString               = "%.2f";
        strokePaths                = new ArrayList<>();
        clickHandler               = e -> select(e);
        endOfTransformationHandler = e -> selectorTooltip.hide();
        seriesListener             = change -> {
            while (change.next()) {
                if (change.wasAdded()) {
                    change.getAddedSubList().forEach(addedItem -> {
                        final Series<X, Y> series     = addedItem;
                        final Path         strokePath = (Path) ((Group) series.getNode()).getChildren().get(1);
                        final Path         fillPath   = (Path) ((Group) series.getNode()).getChildren().get(0);
                        fillPath.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
                        strokePath.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
                        strokePaths.add(strokePath);

                        series.getData().forEach(data -> data.YValueProperty().addListener(o -> layoutPlotChildren()));
                    });
                } else if (change.wasRemoved()) {
                    change.getRemoved().forEach(removedItem -> {
                        final Series<X, Y> series     = removedItem;
                        final Path         strokePath = (Path) ((Group) series.getNode()).getChildren().get(1);
                        final Path         fillPath   = (Path) ((Group) series.getNode()).getChildren().get(0);
                        fillPath.removeEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
                        strokePath.removeEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
                        strokePaths.remove(strokePath);
                    });
                }
            }
        };

        // Add selector to chart
        selector = new Circle();
        selector.setFill(_selectorFillColor);
        selector.setStroke(_selectorStrokeColor);
        selector.setOpacity(0);

        selectorTooltip = new Tooltip("");
        Tooltip.install(selector, selectorTooltip);

        FadeTransition fadeIn = new FadeTransition(Duration.millis(100), selector);
        fadeIn.setFromValue(0);
        fadeIn.setToValue(1);

        timeBeforeFadeOut = new PauseTransition(Duration.millis(_tooltipTimeout));

        FadeTransition fadeOut = new FadeTransition(Duration.millis(100), selector);
        fadeOut.setFromValue(1);
        fadeOut.setToValue(0);

        fadeInFadeOut = new SequentialTransition(fadeIn, timeBeforeFadeOut, fadeOut);
        fadeInFadeOut.setOnFinished(endOfTransformationHandler);

        chartPlotBackground = getChartPlotBackground();
        chartPlotBackground.widthProperty().addListener(o -> resizeSelector());
        chartPlotBackground.heightProperty().addListener(o -> resizeSelector());
        chartPlotBackground.layoutYProperty().addListener(o -> resizeSelector());

        Path horizontalGridLines = getHorizontalGridLines();
        if (null != horizontalGridLines) { horizontalGridLines.setMouseTransparent(true); }

        Path verticalGridLines = getVerticalGridLines();
        if (null != verticalGridLines) { verticalGridLines.setMouseTransparent(true); }

        getChartChildren().addAll(selector);
    }
60663
protected void triggerSubplotSelectEvent(PlotItem it) {
    // forward event to all listeners.
    for(ActionListener actionListener : actionListeners) {
      actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it));
    }
  }
1294615
def onpress(self, event):
        
        if event.key == 'c':  # clears all the contours
            for patch in self.region_patches:
                patch.remove()
            self.region_patches = []
            self.fig.canvas.draw_idle()
        elif event.key == "u":  # undo a label
            self.undobutton_action()
79200
function handleBrushEnd() {
            if (!d3Selection.event.sourceEvent) {
                return; // Only transition after input.
            }

            let dateExtentRounded = [null, null];
            const selection = d3Selection.event.selection;

            if (selection) {
                let dateExtent = selection.map(xScale.invert);

                dateExtentRounded = dateExtent.map(timeIntervals[roundingTimeInterval].round);

                // If empty when rounded, use floor & ceil instead.
                if (dateExtentRounded[0] >= dateExtentRounded[1]) {
                    dateExtentRounded[0] = timeIntervals[roundingTimeInterval].floor(dateExtent[0]);
                    dateExtentRounded[1] = timeIntervals[roundingTimeInterval].offset(dateExtentRounded[0]);
                }

                d3Selection.select(this)
                    .transition()
                    .call(d3Selection.event.target.move, dateExtentRounded.map(xScale));
            }

            dispatcher.call('customBrushEnd', this, dateExtentRounded);
        }
1187553
def paintEvent(self, event):
        
        painter = QtGui.QPainter()
        painter.begin(self)
        try:
            x = 0
            y = 2
            w = self.width() - 1
            h = self.height() - 3
            palette = self.palette()
            clr = palette.color(palette.WindowText)
            clr.setAlpha(100)
            painter.setPen(QtGui.QPen(clr))

            if not self.isActive() and not self._hovered:
                painter.setBrush(palette.color(palette.Button))
            else:
                painter.setBrush(palette.color(palette.Window))

            painter.fillRect(x, y, w, h, painter.brush())
            painter.drawLine(x, y, w, y)
            painter.drawLine(w, y, w, h + 2)

            if self.parent().indexOf(self) == 0:
                painter.drawLine(x, y, x, h + 2)


            # draw the drag buttons
            if not self._locked:
                center = self._dragLabel.geometry().center()
                x = 6
                y = center.y()
                width = 3

                painter.setBrush(palette.color(palette.Window).lighter(120))

                painter.drawRect(x - width / 2, (y - width - 2) - width / 2, width, width)
                painter.drawRect(x - width / 2, y - width / 2, width, width)
                painter.drawRect(x - width / 2, (y + width + 2) - width / 2, width, width)

        finally:
            painter.end()
9706
def update(self, event, annotation):
        """"""
        # Decide whether or not to hide previous highlights...
        for artist in self.highlights.values():
            if self.display == 'multiple':
                continue
            if self.display == 'one-per-axes':
                if event.artist.axes is not artist.axes:
                    continue
            artist.set_visible(False)
        self.show_highlight(event.artist)
        DataCursor.update(self, event, annotation)
860964
function handleMousedown(event) {

  // get currently open dialogue
  var dialogue = getDialogueCurrent();

  if (dialogue.options.hardClose) {
    return;
  }

  var result = helper.isInside(event.target, dialogue.dialogue);
  if (!result) {
    closeInstance(dialogue);
  }
}
136197
private void paintCheckIconEnabledAndMouseOver(Graphics2D g, int width, int height) {
        g.setPaint(iconSelectedMouseOver);
        g.drawRoundRect(0, 1, width-1, height-2, 4, 4);
    }
486955
def mousePressEvent(self, event):
        
        line_number = self.editor.get_linenumber_from_mouse_event(event)
        self._pressed = line_number
        self._released = line_number
        self.editor.select_lines(self._pressed,
                                 self._released)
574895
def connect_event_handlers(self):
        """"""
        self.figure.canvas.mpl_connect('close_event', self.evt_release)
        self.figure.canvas.mpl_connect('pause_event', self.evt_toggle_pause)
800802
def _onIdle(self, evt):
        ''
        evt.Skip()
        FigureCanvasBase.idle_event(self, guiEvent=evt)
1057470
def setHoverBackground( self, column, brush ):
        
        self._hoverBackground[column] = QtGui.QBrush(brush)
521947
def paintEvent(self, event):
        """"""
        super(AutoParameterTableView, self).paintEvent(event)

        if self.dragline is not None:
            pen = QtGui.QPen(QtCore.Qt.blue)
            painter = QtGui.QPainter(self.viewport())
            painter.setPen(pen)
            painter.drawLine(self.dragline)
1156029
def paintEvent(self, event):
        
        pixmap = self.currentPixmap()
        rect   = self.currentPixmapRect()
        
        with XPainter(self) as painter:
            painter.drawPixmap(rect.x(), rect.y(), pixmap)