diff --git a/src/common/components/EditShortcutButton.vue b/src/common/components/EditShortcutButton.vue new file mode 100644 index 0000000..74c4184 --- /dev/null +++ b/src/common/components/EditShortcutButton.vue @@ -0,0 +1,189 @@ + + + + + + diff --git a/src/common/components/EditableShortcutButton.vue b/src/common/components/EditableShortcutButton.vue deleted file mode 100644 index 7d144a4..0000000 --- a/src/common/components/EditableShortcutButton.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/src/common/js/KeyboardShortcutParser.ts b/src/common/js/KeyboardShortcutParser.ts index f87c86c..3e13e46 100644 --- a/src/common/js/KeyboardShortcutParser.ts +++ b/src/common/js/KeyboardShortcutParser.ts @@ -1,7 +1,7 @@ class KeyboardShortcutParser { static parseShortcut(keypress) { let shortcutCombo = ''; - + if (keypress.ctrlKey) { shortcutCombo += 'Ctrl + '; } @@ -21,6 +21,19 @@ class KeyboardShortcutParser { } return shortcutCombo; } + + static generateShortcutFromKeypress(event) { + return { + ctrlKey: event.ctrlKey, + shiftKey: event.altKey, + altKey: event.altKey, + code: event.code, + key: event.key, + keyup: true, + keydown: false, + type: event.type, // only needed for purposes of EditShortcutButton + } + } } -export default KeyboardShortcutParser; \ No newline at end of file +export default KeyboardShortcutParser; diff --git a/src/csui/src/PlayerUiPanels/VideoSettings.vue b/src/csui/src/PlayerUiPanels/VideoSettings.vue index 55f7aaa..10060a8 100644 --- a/src/csui/src/PlayerUiPanels/VideoSettings.vue +++ b/src/csui/src/PlayerUiPanels/VideoSettings.vue @@ -50,48 +50,58 @@ -
-
- Editing options for {{editModeOptions?.crop?.selected?.label}} -
- - - - -
- -- todo: edit keyboard shortcut --
- -
- ------------
> - present items:
> - editModeOptions? {{!!editModeOptions}}
- .crop? {{!!editModeOptions?.crop}}
- .selected? {{!!editModeOptions?.crop?.selected}}
-
- selected action:
{{editModeOptions?.crop?.selected}} -
- -
@@ -297,6 +307,7 @@ import Button from '../../../common/components/Button.vue' import KeyboardShortcutParser from '../../../common/js/KeyboardShortcutParser'; import ShortcutButton from '../../../common/components/ShortcutButton'; +import EditShortcutButton from '../../../common/components/EditShortcutButton'; import ComputeActionsMixin from '../../../common/mixins/ComputeActionsMixin'; import ExecAction from '../ui-libs/ExecAction'; import BrowserDetect from '../../../ext/conf/BrowserDetect'; @@ -319,7 +330,8 @@ export default { y: 0 }, editMode: true, - editModeOptions: {}, + editModeOptions: { + }, resizerConfig: { crop: null, stretch: null, @@ -357,6 +369,7 @@ export default { }, components: { ShortcutButton, + EditShortcutButton, Button, AlignmentOptionsControlComponent }, @@ -521,6 +534,18 @@ export default { console.error(`[Ultrawidify] there's a problem with VideoSettings.vue::editAction():`, e); } }, + + updateSelectedShortcut(shortcut, actionType) { + try { + if (!this.editModeOptions[actionType]?.selected) { + return; + } else { + this.editModeOptions[actionType].selected.shortcut = shortcut + } + } catch (e) { + console.error(`[Ultrawidify] there's a problem with VideoSettings.vue::updateShortcut():`, e); + } + }, //#endregion //#region comms and bus @@ -588,4 +613,13 @@ export default { padding-bottom: 16px; padding-top: 8px; } + +.edit-action-area { + background-color: rgba($blackBg,0.5); + padding: 0.5rem; + + .edit-action-area-header { + border-bottom: 1px solid rgba(255,255,255,0.5); + } +} diff --git a/src/csui/src/res-common/_variables.scss b/src/csui/src/res-common/_variables.scss index c93342d..3ef31ef 100644 --- a/src/csui/src/res-common/_variables.scss +++ b/src/csui/src/res-common/_variables.scss @@ -3,3 +3,7 @@ $warning-color: #d6ba4a; $primary: rgb(255, 147, 85); $primaryBrighter: rgb(255, 174, 127); $primaryBg: rgba(54, 31, 21, 0.5); + +$blackBg: rgb(11,11,11); +$normalTransparentOpacity: 0.5; +$hoverTransparentOpacity: 0.9; diff --git a/src/csui/src/res-common/common.scss b/src/csui/src/res-common/common.scss index c7d29e8..d1abdc5 100644 --- a/src/csui/src/res-common/common.scss +++ b/src/csui/src/res-common/common.scss @@ -31,13 +31,18 @@ h1, h2, h3 { } .button { - background-color: rgba(11,11,11,0.5); + background-color: rgba($blackBg, $normalTransparentOpacity); + + padding: 0.5rem 2rem; + margin: 3px; + color: #aaa; border: 1px solid transparent; + user-select: none !important; &:hover { color: #fff; - background-color: rgba(11,11,11,0.9); + background-color: rgba($blackBg, $hoverTransparentOpacity); border-bottom: 1px solid rgba($primary, 0.5); } @@ -51,3 +56,47 @@ h1, h2, h3 { margin: 0.25rem; padding: 0.5rem 2rem; } + +.field { + display: flex; + flex-direction: row; + flex-wrap: wrap; + + margin-top: 0.5rem; + margin-bottom: 0.5rem; + padding-top: 0.5rem; + + align-items: center; + + .label { + flex: 0 0 25%; + text-align: right; + padding-right: 1rem; + } + .input { + flex: 0 0 70%; + background-color: rgba($blackBg, $normalTransparentOpacity); + border: 1px solid transparent; + border-bottom: 1px solid rgba(255,255,255,0.5); + padding-top: 0.25rem; + padding-bottom: 0.25rem; + + &:active, &:focus, &:focus-within { + border-bottom: 1px solid rgba($primary, 0.5); + } + + input { + width: 100%; + outline: none; + border: 1px solid transparent; + background-color: transparent; + color: #fff; + } + } + .hint { + padding-left: calc(25% + 1rem); + font-size: 0.8rem; + opacity: 0.7; + margin-top: 0.25rem; + } +} diff --git a/src/res/css/common.scss b/src/res/css/common.scss index 5b11612..ca3175f 100644 --- a/src/res/css/common.scss +++ b/src/res/css/common.scss @@ -226,18 +226,16 @@ small { } .button { - /*display: inline-block;*/ - // padding-top: 8px; - // padding-bottom: 3px; - //padding-left: 5px; - //padding-right: 5px; - border: 1px solid rgb(39, 39, 39); + border: 1px solid transparent; + padding: 0.5rem 2rem; + margin-top: 3px; margin-bottom: 3px; + color: $text-dim; text-align: center; cursor: pointer; - user-select: none;; + user-select: none; }