add custom setter for settings
This commit is contained in:
parent
0848b2fe67
commit
e5f2bde6bc
@ -23,7 +23,15 @@ var ActionList = {
|
|||||||
name: 'Manually specify ratio',
|
name: 'Manually specify ratio',
|
||||||
arg: AspectRatio.Fixed,
|
arg: AspectRatio.Fixed,
|
||||||
customArg: true,
|
customArg: true,
|
||||||
hintHTML: '',
|
customSetter: (value) => {
|
||||||
|
const [width, height] = value.split(':');
|
||||||
|
|
||||||
|
if (width && height) {
|
||||||
|
return +width / +height;
|
||||||
|
}
|
||||||
|
return +width;
|
||||||
|
},
|
||||||
|
hintHTML: '<small>Enter the aspect ratio as {width}:{height} or a single number, e.g. "21:9", "2.35:1", or "2.35" (without quotes).</small>',
|
||||||
}],
|
}],
|
||||||
scopes: {
|
scopes: {
|
||||||
global: false,
|
global: false,
|
||||||
|
@ -59,7 +59,8 @@
|
|||||||
<div class="flex flex-grow flex-input">
|
<div class="flex flex-grow flex-input">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="w100"
|
class="w100"
|
||||||
v-model="customArgumentValue"
|
:value="customArgumentValue"
|
||||||
|
@input="setCustomValue($event.target.value, selectedArgument.customSetter)"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -122,6 +123,13 @@ export default {
|
|||||||
this.selectedArgument = ActionList[this.selectedAction].args.find(x => x.arg == arg);
|
this.selectedArgument = ActionList[this.selectedAction].args.find(x => x.arg == arg);
|
||||||
this.customArgumentValue = undefined;
|
this.customArgumentValue = undefined;
|
||||||
},
|
},
|
||||||
|
setCustomValue(value, customSetter) {
|
||||||
|
if (!customSetter) {
|
||||||
|
this.customArgumentValue = value;
|
||||||
|
} else {
|
||||||
|
this.customArgumentValue = customSetter(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
emitCommand() {
|
emitCommand() {
|
||||||
this.$emit(
|
this.$emit(
|
||||||
'set-command',
|
'set-command',
|
||||||
|
Loading…
Reference in New Issue
Block a user