forked from MapComplete/MapComplete
Add binoculars theme, auto reformat everything
This commit is contained in:
parent
38dea806c5
commit
78d6482c88
586 changed files with 115573 additions and 111842 deletions
|
@ -4,15 +4,15 @@ import Translations from "../i18n/Translations";
|
|||
import BaseUIElement from "../BaseUIElement";
|
||||
|
||||
export class FixedInputElement<T> extends InputElement<T> {
|
||||
public readonly IsSelected: UIEventSource<boolean> = new UIEventSource<boolean>(false);
|
||||
private readonly value: UIEventSource<T>;
|
||||
public readonly IsSelected : UIEventSource<boolean> = new UIEventSource<boolean>(false);
|
||||
private readonly _comparator: (t0: T, t1: T) => boolean;
|
||||
|
||||
private readonly _el : HTMLElement;
|
||||
|
||||
constructor(rendering: BaseUIElement | string,
|
||||
private readonly _el: HTMLElement;
|
||||
|
||||
constructor(rendering: BaseUIElement | string,
|
||||
value: T,
|
||||
comparator: ((t0: T, t1: T) => boolean ) = undefined) {
|
||||
comparator: ((t0: T, t1: T) => boolean) = undefined) {
|
||||
super();
|
||||
this._comparator = comparator ?? ((t0, t1) => t0 == t1);
|
||||
this.value = new UIEventSource<T>(value);
|
||||
|
@ -21,19 +21,15 @@ export class FixedInputElement<T> extends InputElement<T> {
|
|||
this._el = document.createElement("span")
|
||||
this._el.addEventListener("mouseout", () => selected.setData(false))
|
||||
const e = Translations.W(rendering)?.ConstructElement()
|
||||
if(e){
|
||||
this._el.appendChild( e)
|
||||
if (e) {
|
||||
this._el.appendChild(e)
|
||||
}
|
||||
|
||||
|
||||
this.onClick(() => {
|
||||
selected.setData(true)
|
||||
})
|
||||
}
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
return this._el;
|
||||
}
|
||||
|
||||
GetValue(): UIEventSource<T> {
|
||||
return this.value;
|
||||
}
|
||||
|
@ -42,5 +38,9 @@ export class FixedInputElement<T> extends InputElement<T> {
|
|||
return this._comparator(t, this.value.data);
|
||||
}
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
return this._el;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue