-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add feature: auto hide controls island #1534
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
5d39a93
bcdbad7
2f5562b
98981fd
91c6ad2
a2b65bc
a41440a
b944bd8
0597d3f
c29304c
577b945
a0e185e
72492c1
4c4ea5c
33ea17a
6018619
a76fb38
9d35be2
7773b30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,23 @@ | ||
| <script setup lang="ts"> | ||
| import { all } from '@proj-airi/i18n' | ||
| import { isStageTamagotchi } from '@proj-airi/stage-shared' | ||
| import { useAnalytics } from '@proj-airi/stage-ui/composables/use-analytics' | ||
| import { isPosthogAvailableInBuild } from '@proj-airi/stage-ui/stores/analytics' | ||
| import { useSettings } from '@proj-airi/stage-ui/stores/settings' | ||
| import { FieldCheckbox, FieldCombobox, useTheme } from '@proj-airi/ui' | ||
| import { useSettings, useSettingsControlsIsland } from '@proj-airi/stage-ui/stores/settings' | ||
| import { FieldCheckbox, FieldCombobox, FieldRange, useTheme } from '@proj-airi/ui' | ||
| import { computed } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| const props = withDefaults(defineProps<{ | ||
| needsControlsIslandIconSizeSetting?: boolean | ||
| needsAutoHideControlsIslandSetting?: boolean | ||
| }>(), { | ||
| needsControlsIslandIconSizeSetting: import.meta.env.RUNTIME_ENVIRONMENT === 'electron', | ||
| needsAutoHideControlsIslandSetting: isStageTamagotchi(), | ||
| }) | ||
|
|
||
| const settings = useSettings() | ||
| const settingsControlsIsland = useSettingsControlsIsland() | ||
|
|
||
| const showControlsIsland = computed(() => props.needsControlsIslandIconSizeSetting) | ||
| const showAutoHideControlsIsland = computed(() => props.needsAutoHideControlsIslandSetting) | ||
| const showAnalyticsSettings = computed(() => isPosthogAvailableInBuild()) | ||
| const analyticsToggleValue = computed({ | ||
| get: () => showAnalyticsSettings.value ? settings.analyticsEnabled : false, | ||
|
|
@@ -59,24 +61,62 @@ const languages = computed(() => { | |
| :options="languages" | ||
| /> | ||
|
|
||
| <FieldCombobox | ||
| v-if="showControlsIsland" | ||
| v-model="settings.controlsIslandIconSize" | ||
| <FieldCheckbox | ||
| v-if="showAutoHideControlsIsland" | ||
| v-model="settingsControlsIsland.autoHideControlsIsland" | ||
| v-motion | ||
| :initial="{ opacity: 0, y: 10 }" | ||
| :enter="{ opacity: 1, y: 0 }" | ||
| :duration="250 + (4 * 10)" | ||
| :delay="4 * 50" | ||
| :class="['transition-all', 'ease-in-out', 'duration-250']" | ||
| :label="t('settings.controls-island.icon-size.title')" | ||
| :description="t('settings.controls-island.icon-size.description')" | ||
| :options="[ | ||
| { value: 'auto', label: t('settings.controls-island.icon-size.auto') }, | ||
| { value: 'large', label: t('settings.controls-island.icon-size.large') }, | ||
| { value: 'small', label: t('settings.controls-island.icon-size.small') }, | ||
| ]" | ||
| :duration="250 + (5 * 10)" | ||
| :delay="5 * 50" | ||
| label="Auto-hide controls island" | ||
| description="Hide controls island after mouse leaves, show after mouse enters" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里的 References
|
||
| /> | ||
|
|
||
| <template v-if="showAutoHideControlsIsland && settingsControlsIsland.autoHideControlsIsland"> | ||
| <FieldRange | ||
| v-model.number="settingsControlsIsland.autoHideDelay" | ||
| v-motion | ||
| :initial="{ opacity: 0, y: 10 }" | ||
| :enter="{ opacity: 1, y: 0 }" | ||
| :duration="250 + (6 * 10)" | ||
| :delay="6 * 50" | ||
| :min="0" | ||
| :max="5" | ||
| :step="0.1" | ||
| :format-value="v => `${v}s`" | ||
| label="Hide delay" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| /> | ||
|
|
||
| <FieldRange | ||
| v-model.number="settingsControlsIsland.autoShowDelay" | ||
| v-motion | ||
| :initial="{ opacity: 0, y: 10 }" | ||
| :enter="{ opacity: 1, y: 0 }" | ||
| :duration="250 + (7 * 10)" | ||
| :delay="7 * 50" | ||
| :min="0" | ||
| :max="5" | ||
| :step="0.1" | ||
| :format-value="v => `${v}s`" | ||
| label="Show delay" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| /> | ||
|
|
||
| <FieldRange | ||
| v-model.number="settingsControlsIsland.autoHideOpacity" | ||
| v-motion | ||
| :initial="{ opacity: 0, y: 10 }" | ||
| :enter="{ opacity: 1, y: 0 }" | ||
| :duration="250 + (8 * 10)" | ||
| :delay="8 * 50" | ||
| :min="0" | ||
| :max="100" | ||
| :step="1" | ||
| :format-value="v => `${v}%`" | ||
| label="Hidden opacity" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| /> | ||
| </template> | ||
|
|
||
| <FieldCheckbox | ||
| v-model="analyticsToggleValue" | ||
| v-motion | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处使用了硬编码的字符串。为了保持项目的一致性并支持多语言,请使用
t()函数配合 i18n 翻译键。