stuff
This commit is contained in:
parent
ede9931cd1
commit
835a846c53
|
@ -6234,7 +6234,9 @@
|
||||||
InternalComponents.NativeSubComponents.FavButton = BDFDB.ModuleUtils.findByName("GIFFavButton");
|
InternalComponents.NativeSubComponents.FavButton = BDFDB.ModuleUtils.findByName("GIFFavButton");
|
||||||
InternalComponents.NativeSubComponents.KeybindRecorder = BDFDB.ModuleUtils.findByName("KeybindRecorder");
|
InternalComponents.NativeSubComponents.KeybindRecorder = BDFDB.ModuleUtils.findByName("KeybindRecorder");
|
||||||
InternalComponents.NativeSubComponents.MenuCheckboxItem = BDFDB.ModuleUtils.findByName("MenuCheckboxItem");
|
InternalComponents.NativeSubComponents.MenuCheckboxItem = BDFDB.ModuleUtils.findByName("MenuCheckboxItem");
|
||||||
|
InternalComponents.NativeSubComponents.MenuControlItem = BDFDB.ModuleUtils.findByName("MenuControlItem");
|
||||||
InternalComponents.NativeSubComponents.MenuItem = BDFDB.ModuleUtils.findByName("MenuItem");
|
InternalComponents.NativeSubComponents.MenuItem = BDFDB.ModuleUtils.findByName("MenuItem");
|
||||||
|
InternalComponents.NativeSubComponents.MenuSlider = BDFDB.ModuleUtils.findByString("minValue", "maxValue", "sliderContainer");
|
||||||
InternalComponents.NativeSubComponents.PopoutContainer = BDFDB.ModuleUtils.findByName("Popout");
|
InternalComponents.NativeSubComponents.PopoutContainer = BDFDB.ModuleUtils.findByName("Popout");
|
||||||
InternalComponents.NativeSubComponents.QuickSelect = BDFDB.ModuleUtils.findByName("QuickSelectWrapper");
|
InternalComponents.NativeSubComponents.QuickSelect = BDFDB.ModuleUtils.findByName("QuickSelectWrapper");
|
||||||
InternalComponents.NativeSubComponents.RadioGroup = BDFDB.ModuleUtils.findByName("RadioGroup");
|
InternalComponents.NativeSubComponents.RadioGroup = BDFDB.ModuleUtils.findByName("RadioGroup");
|
||||||
|
@ -7522,13 +7524,29 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// REMOVE
|
InternalComponents.LibraryComponents.MenuItems.MenuSliderItem = InternalBDFDB.loadPatchedComp("MenuItems.MenuSliderItem") || reactInitialized && class BDFDB_MenuSliderItem extends LibraryModules.React.Component {
|
||||||
InternalComponents.LibraryComponents.ContextMenuItems = {};
|
handleChange(value) {
|
||||||
InternalComponents.LibraryComponents.ContextMenuItems.Group = InternalComponents.LibraryComponents.MenuItems.MenuGroup;
|
if (this.props.state) {
|
||||||
InternalComponents.LibraryComponents.ContextMenuItems.Item = InternalComponents.LibraryComponents.MenuItems.MenuItem;
|
this.props.state.value = Math.round(BDFDB.NumberUtils.mapRange([0, 100], [this.props.minValue, this.props.maxValue], value) * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
|
||||||
InternalComponents.LibraryComponents.ContextMenuItems.Slider = InternalComponents.LibraryComponents.MenuItems.MenuControlItem;
|
if (typeof this.props.onChange == "function") this.props.onChange(this.props.state.value, this);
|
||||||
InternalComponents.LibraryComponents.ContextMenuItems.Sub = InternalComponents.LibraryComponents.MenuItems.MenuSeparator;
|
}
|
||||||
InternalComponents.LibraryComponents.ContextMenuItems.Toggle = InternalComponents.LibraryComponents.MenuItems.MenuItem;
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
let value = this.props.state && this.props.state.value || 0;
|
||||||
|
return BDFDB.ReactUtils.createElement(InternalComponents.NativeSubComponents.MenuControlItem, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
|
||||||
|
label: typeof this.props.renderLabel == "function" ? this.props.renderLabel(Math.round(value * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits)) : this.props.label,
|
||||||
|
control: (menuItemProps, ref) => {
|
||||||
|
return BDFDB.ReactUtils.createElement(InternalComponents.NativeSubComponents.MenuSlider, Object.assign({}, menuItemProps, {
|
||||||
|
ref: ref,
|
||||||
|
value: Math.round(BDFDB.NumberUtils.mapRange([this.props.minValue, this.props.maxValue], [0, 100], value) * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits),
|
||||||
|
onChange: this.handleChange.bind(this)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}), "digits", "renderLabel"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
InternalBDFDB.setDefaultProps(InternalComponents.LibraryComponents.MenuItems.MenuSliderItem, {minValue:0, maxValue:100, digits:0});
|
||||||
|
|
||||||
InternalComponents.LibraryComponents.MessageGroup = BDFDB.ModuleUtils.findByName("ChannelMessage");
|
InternalComponents.LibraryComponents.MessageGroup = BDFDB.ModuleUtils.findByName("ChannelMessage");
|
||||||
|
|
||||||
|
@ -8086,20 +8104,20 @@
|
||||||
|
|
||||||
InternalComponents.LibraryComponents.Slider = InternalBDFDB.loadPatchedComp("Slider") || reactInitialized && class BDFDB_Slider extends LibraryModules.React.Component {
|
InternalComponents.LibraryComponents.Slider = InternalBDFDB.loadPatchedComp("Slider") || reactInitialized && class BDFDB_Slider extends LibraryModules.React.Component {
|
||||||
handleValueChange(value) {
|
handleValueChange(value) {
|
||||||
let newvalue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange([0, 100], this.props.edges, value) : value;
|
let newValue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange([0, 100], this.props.edges, value) : value;
|
||||||
if (typeof this.props.digits == "number") newvalue = Math.round(newvalue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
|
if (typeof this.props.digits == "number") newValue = Math.round(newValue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
|
||||||
this.props.defaultValue = newvalue;
|
this.props.defaultValue = newValue;
|
||||||
if (typeof this.props.onValueChange == "function") this.props.onValueChange(newvalue, this);
|
if (typeof this.props.onValueChange == "function") this.props.onValueChange(newValue, this);
|
||||||
BDFDB.ReactUtils.forceUpdate(this);
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
}
|
}
|
||||||
handleValueRender(value) {
|
handleValueRender(value) {
|
||||||
let newvalue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange([0, 100], this.props.edges, value) : value;
|
let newValue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange([0, 100], this.props.edges, value) : value;
|
||||||
if (typeof this.props.digits == "number") newvalue = Math.round(newvalue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
|
if (typeof this.props.digits == "number") newValue = Math.round(newValue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
|
||||||
if (typeof this.props.onValueRender == "function") {
|
if (typeof this.props.onValueRender == "function") {
|
||||||
let tempReturn = this.props.onValueRender(newvalue, this);
|
let tempReturn = this.props.onValueRender(newValue, this);
|
||||||
if (tempReturn != undefined) newvalue = tempReturn;
|
if (tempReturn != undefined) newValue = tempReturn;
|
||||||
}
|
}
|
||||||
return newvalue;
|
return newValue;
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
let defaultValue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange(this.props.edges, [0, 100], this.props.defaultValue) : this.props.defaultValue;
|
let defaultValue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange(this.props.edges, [0, 100], this.props.defaultValue) : this.props.defaultValue;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ var ImageZoom = (_ => {
|
||||||
return class ImageZoom {
|
return class ImageZoom {
|
||||||
getName () {return "ImageZoom";}
|
getName () {return "ImageZoom";}
|
||||||
|
|
||||||
getVersion () {return "1.1.2";}
|
getVersion () {return "1.1.3";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ var ImageZoom = (_ => {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
this.changelog = {
|
||||||
"fixed":[["Styling && Functionality","Fixed the style for the new image modal layout"]]
|
"fixed":[["Context Menu Update","Fixes for the context menu update, yaaaaaay"]]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchedModules = {
|
this.patchedModules = {
|
||||||
|
@ -41,8 +41,8 @@ var ImageZoom = (_ => {
|
||||||
|
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
settings: {
|
settings: {
|
||||||
zoomlevel: {value:2, digits:1, edges:[1, 10], unit:"x", label:"ACCESSIBILITY_ZOOM_LEVEL_LABEL"},
|
zoomlevel: {value:2, digits:1, minValue: 1, maxValue: 10, unit:"x", label:"ACCESSIBILITY_ZOOM_LEVEL_LABEL"},
|
||||||
lensesize: {value:200, digits:0, edges:[50, 1000], unit:"px", label:"context_lensesize_text"}
|
lensesize: {value:200, digits:0, minValue: 50, maxValue: 1000, unit:"px", label:"context_lensesize_text"}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -101,20 +101,16 @@ var ImageZoom = (_ => {
|
||||||
let openContext = event => {
|
let openContext = event => {
|
||||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||||
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||||
children: Object.keys(settings).map(type => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuControlItem, {
|
children: Object.keys(settings).map(type => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSliderItem, Object.assign({
|
||||||
defaultValue: settings[type],
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, type),
|
||||||
digits: this.defaults.settings[type].digits,
|
value: settings[type],
|
||||||
edges: this.defaults.settings[type].edges,
|
|
||||||
renderLabel: value => {
|
renderLabel: value => {
|
||||||
return (this.labels[this.defaults.settings[type].label] || BDFDB.LanguageUtils.LanguageStrings[this.defaults.settings[type].label]) + ": " + value + this.defaults.settings[type].unit;
|
return (this.labels[this.defaults.settings[type].label] || BDFDB.LanguageUtils.LanguageStrings[this.defaults.settings[type].label]) + ": " + value + this.defaults.settings[type].unit;
|
||||||
},
|
},
|
||||||
onValueRender: value => {
|
onChange: value => {
|
||||||
return value + this.defaults.settings[type].unit;
|
|
||||||
},
|
|
||||||
onValueChange: value => {
|
|
||||||
BDFDB.DataUtils.save(value, this, "settings", type);
|
BDFDB.DataUtils.save(value, this, "settings", type);
|
||||||
}
|
}
|
||||||
}))
|
}, BDFDB.ObjectUtils.extract(this.defaults.settings[type], "digits", "minValue", "maxValue"))))
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
children[index] = BDFDB.ReactUtils.createElement("span", {
|
children[index] = BDFDB.ReactUtils.createElement("span", {
|
||||||
|
|
Loading…
Reference in New Issue