diff --git a/src/silx/gui/plot/backends/BackendBase.py b/src/silx/gui/plot/backends/BackendBase.py index 8d70286a8a..35aa429af7 100755 --- a/src/silx/gui/plot/backends/BackendBase.py +++ b/src/silx/gui/plot/backends/BackendBase.py @@ -216,6 +216,7 @@ def addMarker( text: str | None, color: str, symbol: str | None, + symbolsize: float, linestyle: str | tuple[float, tuple[float, ...] | None], linewidth: float, constraint: Callable[[float, float], tuple[float, float]] | None, diff --git a/src/silx/gui/plot/backends/BackendMatplotlib.py b/src/silx/gui/plot/backends/BackendMatplotlib.py index c6784050ef..7ca5533544 100755 --- a/src/silx/gui/plot/backends/BackendMatplotlib.py +++ b/src/silx/gui/plot/backends/BackendMatplotlib.py @@ -942,6 +942,7 @@ def addMarker( text, color, symbol, + symbolsize: float, linestyle, linewidth, constraint, @@ -968,7 +969,7 @@ def addMarker( marker = self._getMarkerFromSymbol(symbol) if x is not None and y is not None: line = ax.plot( - x, y, linestyle=" ", color=color, marker=marker, markersize=10.0 + x, y, linestyle=" ", color=color, marker=marker, markersize=symbolsize )[-1] if text is not None: diff --git a/src/silx/gui/plot/backends/BackendOpenGL.py b/src/silx/gui/plot/backends/BackendOpenGL.py index 4ee509d0ce..928424191f 100755 --- a/src/silx/gui/plot/backends/BackendOpenGL.py +++ b/src/silx/gui/plot/backends/BackendOpenGL.py @@ -110,6 +110,7 @@ def __init__( text, color, symbol, + symbolsize, linewidth, dashoffset, dashpattern, @@ -136,6 +137,7 @@ def __init__( "color": colors.rgba(color), "constraint": constraint if isConstraint else None, "symbol": symbol, + "symbolsize": symbolsize, "linewidth": linewidth, "dashoffset": dashoffset, "dashpattern": dashpattern, @@ -737,7 +739,7 @@ def _renderItems(self, overlay=False): (pixelPos[1],), marker=item["symbol"], color=color, - size=11, + size=item["symbolsize"], ) context.matrix = self.matScreenProj marker.render(context) @@ -1184,6 +1186,7 @@ def addMarker( text, color, symbol, + symbolsize: float, linestyle, linewidth, constraint, @@ -1201,6 +1204,7 @@ def addMarker( text, color, symbol, + symbolsize, linewidth, dashoffset, dashpattern, diff --git a/src/silx/gui/plot/items/marker.py b/src/silx/gui/plot/items/marker.py index b3da451f5a..6e5467a314 100755 --- a/src/silx/gui/plot/items/marker.py +++ b/src/silx/gui/plot/items/marker.py @@ -78,11 +78,19 @@ def __init__(self): self._x = None self._y = None + self._symbol_size = 10.0 self._bgColor: colors.RGBAColorType | None = None self._constraint = self._defaultConstraint self.__isBeingDragged = False - def _addRendererCall(self, backend, symbol=None, linestyle="-", linewidth=1): + def _addRendererCall( + self, + backend, + symbol=None, + symbolsize=10., + linestyle="-", + linewidth=1, + ): """Perform the update of the backend renderer""" return backend.addMarker( x=self.getXPosition(), @@ -90,6 +98,7 @@ def _addRendererCall(self, backend, symbol=None, linestyle="-", linewidth=1): text=self.getText(), color=self.getColor(), symbol=symbol, + symbolsize=symbolsize, linestyle=linestyle, linewidth=linewidth, constraint=self.getConstraint(), @@ -246,6 +255,9 @@ class Marker(MarkerBase, SymbolMixIn): _DEFAULT_SYMBOL = "+" """Default symbol of the marker""" + _DEFAULT_SYMBOL_SIZE = 10.0 + """Default size of marker's symbol""" + def __init__(self): MarkerBase.__init__(self) SymbolMixIn.__init__(self) @@ -254,7 +266,11 @@ def __init__(self): self._y = 0.0 def _addBackendRenderer(self, backend): - return self._addRendererCall(backend, symbol=self.getSymbol()) + return self._addRendererCall( + backend, + symbol=self.getSymbol(), + symbolsize=self.getSymbolSize(), + ) def _setConstraint(self, constraint): """Set the constraint function of the marker drag.