mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Update NumberStepper
This commit is contained in:
parent
95881dd241
commit
33c3b2810a
13
dist/better-xcloud.lite.user.js
vendored
13
dist/better-xcloud.lite.user.js
vendored
@ -789,10 +789,12 @@ class SettingElement {
|
|||||||
}), $wrapper.appendChild($range), options.ticks || options.exactTicks) {
|
}), $wrapper.appendChild($range), options.ticks || options.exactTicks) {
|
||||||
let markersId = `markers-${key}`, $markers = CE("datalist", { id: markersId });
|
let markersId = `markers-${key}`, $markers = CE("datalist", { id: markersId });
|
||||||
if ($range.setAttribute("list", markersId), options.exactTicks) {
|
if ($range.setAttribute("list", markersId), options.exactTicks) {
|
||||||
let start = Math.max(Math.floor(MIN / options.exactTicks), 1) * options.exactTicks;
|
let start = Math.max(Math.floor(setting.min / options.exactTicks), 1) * options.exactTicks;
|
||||||
if (start === MIN) start += options.exactTicks;
|
if (start === setting.min) start += options.exactTicks;
|
||||||
for (let i = start;i < MAX; i += options.exactTicks)
|
for (let i = start;i < setting.max; i += options.exactTicks)
|
||||||
$markers.appendChild(CE("option", { value: i }));
|
$markers.appendChild(CE("option", {
|
||||||
|
value: options.reverse ? -i : i
|
||||||
|
}));
|
||||||
} else for (let i = MIN + options.ticks;i < MAX; i += options.ticks)
|
} else for (let i = MIN + options.ticks;i < MAX; i += options.ticks)
|
||||||
$markers.appendChild(CE("option", { value: i }));
|
$markers.appendChild(CE("option", { value: i }));
|
||||||
$wrapper.appendChild($markers);
|
$wrapper.appendChild($markers);
|
||||||
@ -1383,9 +1385,10 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
type: "number-stepper",
|
type: "number-stepper",
|
||||||
default: 4,
|
default: 4,
|
||||||
min: 4,
|
min: 4,
|
||||||
max: 40,
|
max: 60,
|
||||||
steps: 4,
|
steps: 4,
|
||||||
params: {
|
params: {
|
||||||
|
exactTicks: 20,
|
||||||
reverse: !0,
|
reverse: !0,
|
||||||
customTextValue(value) {
|
customTextValue(value) {
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
|
13
dist/better-xcloud.user.js
vendored
13
dist/better-xcloud.user.js
vendored
@ -812,10 +812,12 @@ class SettingElement {
|
|||||||
}), $wrapper.appendChild($range), options.ticks || options.exactTicks) {
|
}), $wrapper.appendChild($range), options.ticks || options.exactTicks) {
|
||||||
let markersId = `markers-${key}`, $markers = CE("datalist", { id: markersId });
|
let markersId = `markers-${key}`, $markers = CE("datalist", { id: markersId });
|
||||||
if ($range.setAttribute("list", markersId), options.exactTicks) {
|
if ($range.setAttribute("list", markersId), options.exactTicks) {
|
||||||
let start = Math.max(Math.floor(MIN / options.exactTicks), 1) * options.exactTicks;
|
let start = Math.max(Math.floor(setting.min / options.exactTicks), 1) * options.exactTicks;
|
||||||
if (start === MIN) start += options.exactTicks;
|
if (start === setting.min) start += options.exactTicks;
|
||||||
for (let i = start;i < MAX; i += options.exactTicks)
|
for (let i = start;i < setting.max; i += options.exactTicks)
|
||||||
$markers.appendChild(CE("option", { value: i }));
|
$markers.appendChild(CE("option", {
|
||||||
|
value: options.reverse ? -i : i
|
||||||
|
}));
|
||||||
} else for (let i = MIN + options.ticks;i < MAX; i += options.ticks)
|
} else for (let i = MIN + options.ticks;i < MAX; i += options.ticks)
|
||||||
$markers.appendChild(CE("option", { value: i }));
|
$markers.appendChild(CE("option", { value: i }));
|
||||||
$wrapper.appendChild($markers);
|
$wrapper.appendChild($markers);
|
||||||
@ -1406,9 +1408,10 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
type: "number-stepper",
|
type: "number-stepper",
|
||||||
default: 4,
|
default: 4,
|
||||||
min: 4,
|
min: 4,
|
||||||
max: 40,
|
max: 60,
|
||||||
steps: 4,
|
steps: 4,
|
||||||
params: {
|
params: {
|
||||||
|
exactTicks: 20,
|
||||||
reverse: !0,
|
reverse: !0,
|
||||||
customTextValue(value) {
|
customTextValue(value) {
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
|
@ -248,22 +248,24 @@ export class SettingElement {
|
|||||||
|
|
||||||
if (options.ticks || options.exactTicks) {
|
if (options.ticks || options.exactTicks) {
|
||||||
const markersId = `markers-${key}`;
|
const markersId = `markers-${key}`;
|
||||||
const $markers = CE('datalist', {'id': markersId});
|
const $markers = CE('datalist', {id: markersId});
|
||||||
$range.setAttribute('list', markersId);
|
$range.setAttribute('list', markersId);
|
||||||
|
|
||||||
if (options.exactTicks) {
|
if (options.exactTicks) {
|
||||||
let start = Math.max(Math.floor(MIN / options.exactTicks), 1) * options.exactTicks;
|
let start = Math.max(Math.floor(setting.min! / options.exactTicks), 1) * options.exactTicks;
|
||||||
|
|
||||||
if (start === MIN) {
|
if (start === setting.min!) {
|
||||||
start += options.exactTicks;
|
start += options.exactTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = start; i < MAX; i += options.exactTicks) {
|
for (let i = start; i < setting.max!; i += options.exactTicks) {
|
||||||
$markers.appendChild(CE<HTMLOptionElement>('option', {'value': i}));
|
$markers.appendChild(CE<HTMLOptionElement>('option', {
|
||||||
|
value: options.reverse ? -i : i,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = MIN + options.ticks!; i < MAX; i += options.ticks!) {
|
for (let i = MIN + options.ticks!; i < MAX; i += options.ticks!) {
|
||||||
$markers.appendChild(CE<HTMLOptionElement>('option', {'value': i}));
|
$markers.appendChild(CE<HTMLOptionElement>('option', {value: i}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$wrapper.appendChild($markers);
|
$wrapper.appendChild($markers);
|
||||||
|
@ -394,9 +394,10 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
|
|||||||
type: SettingElementType.NUMBER_STEPPER,
|
type: SettingElementType.NUMBER_STEPPER,
|
||||||
default: 4,
|
default: 4,
|
||||||
min: 4,
|
min: 4,
|
||||||
max: 40,
|
max: 60,
|
||||||
steps: 4,
|
steps: 4,
|
||||||
params: {
|
params: {
|
||||||
|
exactTicks: 20,
|
||||||
reverse: true,
|
reverse: true,
|
||||||
customTextValue(value: any) {
|
customTextValue(value: any) {
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user