diff --git a/MainForm.pas b/MainForm.pas index 6f45ce1..d58286f 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -5029,8 +5029,8 @@ end; procedure TMainForm.PositionVfoOverlay; var - VfoX, FilterEndX, OW, NewLeft, NewTop: Integer; - HiHz: Double; + VfoX, FilterStartX, FilterEndX, OW, NewLeft, NewTop: Integer; + LoHz, HiHz: Double; ViewCenter, ViewSpan: Double; begin if not Assigned(FVfoOverlay) or not FVfoOverlay.Visible then Exit; @@ -5044,20 +5044,31 @@ begin else VfoX := PbSpectrum.Width div 2; + // Кромки полосы фильтра относительно несущей (для выбора стороны накладки). case FController.FMode of - MODE_LSB: HiHz := -100; - MODE_USB: HiHz := FController.FFilterBW; + MODE_LSB: begin LoHz := -FController.FFilterBW; HiHz := -100; end; + MODE_USB: begin LoHz := 100; HiHz := FController.FFilterBW; end; else - HiHz := FController.FFilterBW / 2; + begin LoHz := -FController.FFilterBW / 2; HiHz := FController.FFilterBW / 2; end; end; if (PbSpectrum.Width > 0) and (ViewSpan > 0) then - FilterEndX := VfoX + Round(HiHz / ViewSpan * PbSpectrum.Width) + begin + FilterStartX := VfoX + Round(LoHz / ViewSpan * PbSpectrum.Width); + FilterEndX := VfoX + Round(HiHz / ViewSpan * PbSpectrum.Width); + end else - FilterEndX := VfoX; - FilterEndX := Max(0, Min(PbSpectrum.Width - 1, FilterEndX)); + begin + FilterStartX := VfoX; + FilterEndX := VfoX; + end; + FilterStartX := Max(0, Min(PbSpectrum.Width - 1, FilterStartX)); + FilterEndX := Max(0, Min(PbSpectrum.Width - 1, FilterEndX)); - // Всегда справа от правого края полосы фильтра. - NewLeft := Max(4, Min(PbSpectrum.Width - OW - 4, FilterEndX + 6)); + // По умолчанию справа от полосы фильтра; если не влезает — слева от неё. + NewLeft := FilterEndX + 6; + if NewLeft + OW > PbSpectrum.Width - 4 then + NewLeft := FilterStartX - 6 - OW; + NewLeft := Max(4, Min(PbSpectrum.Width - OW - 4, NewLeft)); NewTop := 16; if (FVfoOverlay.Left <> NewLeft) or (FVfoOverlay.Top <> NewTop) then begin