Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::editor::FlashDecorations Class Reference

Per-view transient source-change highlights. More...

#include "donner/editor/FlashDecorations.h"

Public Types

using Clock = std::chrono::steady_clock
using TimePoint = Clock::time_point

Public Member Functions

void flash (SourceByteRange byteRange, TimePoint now, std::size_t bufferSize)
 Add a flash for byteRange.
void applySourceEdit (std::size_t offset, std::size_t removedLength, std::size_t insertedLength, std::size_t newBufferSize)
 Shift or drop existing flashes after a source edit.
void tick (TimePoint now)
 Remove expired flashes.
std::vector< ActiveFlashactiveBackgrounds (TimePoint now) const
 Return visible flashes for the current frame.
std::optional< float > nextWakeSeconds (TimePoint now) const
 Return seconds until the next fade frame should be drawn.

Static Public Attributes

static constexpr std::size_t kMaxFlashes = 64
 Maximum number of simultaneous flashes retained by the view.
static constexpr float kDurationSeconds = 0.4f
 Default fade duration for a source flash.

Detailed Description

Per-view transient source-change highlights.

Member Function Documentation

◆ activeBackgrounds()

std::vector< ActiveFlash > donner::editor::FlashDecorations::activeBackgrounds ( TimePoint now) const
nodiscard

Return visible flashes for the current frame.

Parameters
nowCurrent time.

◆ applySourceEdit()

void donner::editor::FlashDecorations::applySourceEdit ( std::size_t offset,
std::size_t removedLength,
std::size_t insertedLength,
std::size_t newBufferSize )

Shift or drop existing flashes after a source edit.

Parameters
offsetEdit start offset in the old buffer.
removedLengthRemoved byte count in the old buffer.
insertedLengthInserted byte count in the new buffer.
newBufferSizeSource buffer size after the edit.

◆ flash()

void donner::editor::FlashDecorations::flash ( SourceByteRange byteRange,
TimePoint now,
std::size_t bufferSize )

Add a flash for byteRange.

Parameters
byteRangeSource range to highlight.
nowStart time for the flash.
bufferSizeCurrent source buffer size for clamping.

◆ nextWakeSeconds()

std::optional< float > donner::editor::FlashDecorations::nextWakeSeconds ( TimePoint now) const
nodiscard

Return seconds until the next fade frame should be drawn.

Parameters
nowCurrent time.

◆ tick()

void donner::editor::FlashDecorations::tick ( TimePoint now)

Remove expired flashes.

Parameters
nowCurrent time.

The documentation for this class was generated from the following file: