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

fix: rework two-color-word effect & implement blinking 重作雙色字效果與實作閃爍 #102

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Commits on Dec 13, 2021

  1. feat: rework two-color-word effect & implement blinking

    Instead of overlaying a half of the two-color-word character,
    the two-color-word effect is now achieved
    by using two half-word pseudo elements (enabled by CSS class .o),
    one for the left half (::before; controlled by non-prefixed CSS classes)
    and one for the right half (::after; controlled by CSS classes prefixed with 'r'),
    so that the two halves of the word can be controlled independently.
    
    Additionally, to make the text selection appear normal,
    the real element is made invisible and placed on top of the pseudo elements.
    
    This greatly reduces the number of CSS classes needed.
    
    See Ptt-official-app/pttbbs-web#122
    for an explanation of a similar implementation.
    
    The blink effect for two-color-word characters is also implemented.
    
    The background color was dependent on both .b<bg> and .qq<bg> classes,
    which complicated the TwoColorWord blinking implementation.
    
    Therefore, the .qq<bg> classes are removed,
    while only the .qq class is left since it does not affect the background color.
    
    Since the color of two-color-word characters is now transparent,
    the color of hovered hyperlinks is now explicitly assigned as the color of q7
    to prevent the link text with the two-color-word effect from being invisible.
    IepIweidieng committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    d6ebaab View commit details
    Browse the repository at this point in the history

Commits on Jan 15, 2023

  1. fix(components/Row): fix black bg on two-color char tail not causing …

    …visual effects
    
    This issue was described in commit a75d550
    ("Fix two-color character rendering bug when the right-half is black.").
    
    This issue was caused by the HTML layout of two-color chars, e.g.:
    
    ```html
    <span class="q15 b1"> <!-- Non-black BG. -->
        <span class="q15 b1 rb0 wpadding" data-text="A" style="display: inline-block; width: 24px;">
            A
        </span> <!-- "Black" (transparent) right-half BG., appeared as non-black -->
        M
    </span>
    ```
    
    To fix this issue, WordSegmentBuilder is specialized for two-color chars
    (as JavaScript class TwoColorWordBuilder)
    so as to instead generate such layout as:
    
    ```html
    <span class="q15 b1 rb0 wpadding" data-text="A" style="display: inline-block; width: 24px;">
        A
    </span>
    <span class="q15 b1">
        M
    </span>
    ```
    
    This not only avoids the unwanted background color introduced by the outer span
    but also eliminates the unnecessary outer span for a sole two-color char.
    
    Note that this requires the fix introduced in commit d6ebaab
    ("feat: rework two-color-word effect & implement blinking")
    to make the un-nested span rendered expectedly.
    IepIweidieng committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    17fd980 View commit details
    Browse the repository at this point in the history