Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the link underline less obtrusive; don't use it for pattern #8148

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/renderer/base/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,17 +913,18 @@ void Renderer::_PaintBufferOutputGridLineHelper(_In_ IRenderEngine* const pEngin
IRenderEngine::GridLines lines = Renderer::s_GetGridlines(textAttribute);

// For now, we dash underline patterns and switch to regular underline on hover
if (_pData->GetPatternId(coordTarget).size() > 0)
// Since we're only rendering pattern links on *hover*, there's no point in checking
// the pattern range if we aren't currently hovering.
if (_hoveredInterval.has_value())
{
if (_hoveredInterval.has_value() &&
_hoveredInterval.value().start <= til::point{ coordTarget } &&
til::point{ coordTarget } <= _hoveredInterval.value().stop)
const til::point coordTargetTil{ coordTarget };
if (_hoveredInterval->start <= coordTargetTil &&
coordTargetTil <= _hoveredInterval->stop)
{
lines |= IRenderEngine::GridLines::Underline;
}
else
{
lines |= IRenderEngine::GridLines::HyperlinkUnderline;
if (_pData->GetPatternId(coordTarget).size() > 0)
PankajBhojwani marked this conversation as resolved.
Show resolved Hide resolved
{
lines |= IRenderEngine::GridLines::Underline;
}
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/renderer/dx/DxRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,17 @@ static constexpr D2D1_ALPHA_MODE _dxgiAlphaToD2d1Alpha(DXGI_ALPHA_MODE mode) noe
_dashStrokeStyleProperties = D2D1_STROKE_STYLE_PROPERTIES{
D2D1_CAP_STYLE_SQUARE, // startCap
D2D1_CAP_STYLE_SQUARE, // endCap
D2D1_CAP_STYLE_SQUARE, // dashCap
D2D1_CAP_STYLE_FLAT, // dashCap
D2D1_LINE_JOIN_MITER, // lineJoin
0.f, // miterLimit
D2D1_DASH_STYLE_DASH, // dashStyle
D2D1_DASH_STYLE_CUSTOM, // dashStyle
0.f, // dashOffset
};
RETURN_IF_FAILED(_d2dFactory->CreateStrokeStyle(&_dashStrokeStyleProperties, nullptr, 0, &_dashStrokeStyle));
// Custom dashes:
// # # # #
// 1234123412341234
static constexpr std::array<float, 2> hyperlinkDashes{ 1.f, 3.f };
RETURN_IF_FAILED(_d2dFactory->CreateStrokeStyle(&_dashStrokeStyleProperties, hyperlinkDashes.data(), gsl::narrow_cast<UINT32>(hyperlinkDashes.size()), &_dashStrokeStyle));
_hyperlinkStrokeStyle = _dashStrokeStyle;

// If in composition mode, apply scaling factor matrix
Expand Down