feat(plot): lock axes and calculate marker levels in dB
This commit is contained in:
@@ -61,6 +61,12 @@ class PlotMath:
|
||||
def delta(self, a: float, b: float, multiplier: float = 1) -> float:
|
||||
return self.call(6, a, b, multiplier)[0]
|
||||
|
||||
def db_delta(self, a: float, b: float) -> Optional[float]:
|
||||
try:
|
||||
return self.call(7, a, b)[0]
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Viewport:
|
||||
@@ -68,12 +74,15 @@ class Viewport:
|
||||
y: float = 0.0
|
||||
width: float = 1.0
|
||||
height: float = 1.0
|
||||
locked: bool = False
|
||||
|
||||
def transform(self, core: PlotMath, zoom_x: float = 1, zoom_y: float = 1,
|
||||
pan_x: float = 0, pan_y: float = 0,
|
||||
focus_x: float = 0.5, focus_y: float = 0.5) -> "Viewport":
|
||||
if self.locked:
|
||||
return self
|
||||
return Viewport(*core.call(0, self.x, self.y, self.width, self.height,
|
||||
zoom_x, zoom_y, pan_x, pan_y, focus_x, focus_y))
|
||||
zoom_x, zoom_y, pan_x, pan_y, focus_x, focus_y), locked=self.locked)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in New Issue
Block a user