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

apply min-width for vertical mode #59

Merged
merged 1 commit into from
Jul 21, 2024
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
5 changes: 5 additions & 0 deletions page/customize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type STYLE_JSON = {
BottomPadding: string
LeftPadding: string
LabelTextGap: string
VerticalMinWidth: string
HorizontalDividerWidth: string
}
Advanced: {
Expand All @@ -85,6 +86,7 @@ function lightToDark (light: string) {
}

const PANEL = '.fcitx-basic .fcitx-panel'
const PANEL_VERTICAL_CANDIDATE = `${PANEL}.fcitx-horizontal-tb .fcitx-vertical .fcitx-candidate`
const PANEL_HORIZONTAL_DIVIDER = `${PANEL} .fcitx-hoverables.fcitx-vertical .fcitx-divider`
const PANEL_HORIZONTAL_DIVIDER_SIDE = `${PANEL} .fcitx-hoverables.fcitx-vertical .fcitx-divider-side`
// left of prev paging button, same with MSPY
Expand Down Expand Up @@ -465,6 +467,9 @@ export function setStyle (style: string) {
rules[CANDIDATE_INNER]['padding-block-end'] = px(j.Size.BottomPadding)
rules[CANDIDATE_INNER]['padding-inline-start'] = px(j.Size.LeftPadding)
rules[CANDIDATE_INNER].gap = px(j.Size.LabelTextGap)
rules[PANEL_VERTICAL_CANDIDATE] = {
'min-inline-size': px(j.Size.VerticalMinWidth)
}
rules[PANEL_HORIZONTAL_DIVIDER] = {
'block-size': px(j.Size.HorizontalDividerWidth)
}
Expand Down
4 changes: 4 additions & 0 deletions page/macos.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ $dark-graphite: rgb(105 105 105);
font-size: 12px;
}

.fcitx-horizontal-tb .fcitx-vertical .fcitx-candidate {
min-inline-size: 200px; /* avoid abrupt enlarging when start typing. */
}

.fcitx-horizontal-tb .fcitx-horizontal .fcitx-paging.fcitx-arrow svg {
transform: rotate(90deg);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test-generic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ test('Set layout', async ({ page }) => {
expect(verticalBox).toMatchObject({
x: 25, y: 39 // shadow and inline-grid
})
expect(verticalBox.width).toBeGreaterThan(41)
expect(verticalBox.width).toBeLessThan(51)
expect(verticalBox.width).toBeGreaterThan(197)
expect(verticalBox.width).toBeLessThan(207)
expect(verticalBox.height).toBeGreaterThan(120)
expect(verticalBox.height).toBeLessThan(130)

Expand Down