58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Events = void 0;
|
|
const ClickEvent_1 = require("./ClickEvent");
|
|
const DivEvent_1 = require("./DivEvent");
|
|
const HoverEvent_1 = require("./HoverEvent");
|
|
const ResizeEvent_1 = require("./ResizeEvent");
|
|
const Utils_1 = require("../../../../Utils/Utils");
|
|
class Events {
|
|
constructor() {
|
|
this.onClick = new ClickEvent_1.ClickEvent();
|
|
this.onDiv = new DivEvent_1.DivEvent();
|
|
this.onHover = new HoverEvent_1.HoverEvent();
|
|
this.resize = new ResizeEvent_1.ResizeEvent();
|
|
}
|
|
get onclick() {
|
|
return this.onClick;
|
|
}
|
|
set onclick(value) {
|
|
this.onClick = value;
|
|
}
|
|
get ondiv() {
|
|
return this.onDiv;
|
|
}
|
|
set ondiv(value) {
|
|
this.onDiv = value;
|
|
}
|
|
get onhover() {
|
|
return this.onHover;
|
|
}
|
|
set onhover(value) {
|
|
this.onHover = value;
|
|
}
|
|
load(data) {
|
|
var _a, _b, _c;
|
|
if (!data) {
|
|
return;
|
|
}
|
|
this.onClick.load((_a = data.onClick) !== null && _a !== void 0 ? _a : data.onclick);
|
|
const onDiv = (_b = data.onDiv) !== null && _b !== void 0 ? _b : data.ondiv;
|
|
if (onDiv !== undefined) {
|
|
this.onDiv = (0, Utils_1.executeOnSingleOrMultiple)(onDiv, (t) => {
|
|
const tmp = new DivEvent_1.DivEvent();
|
|
tmp.load(t);
|
|
return tmp;
|
|
});
|
|
}
|
|
this.onHover.load((_c = data.onHover) !== null && _c !== void 0 ? _c : data.onhover);
|
|
if (typeof data.resize === "boolean") {
|
|
this.resize.enable = data.resize;
|
|
}
|
|
else {
|
|
this.resize.load(data.resize);
|
|
}
|
|
}
|
|
}
|
|
exports.Events = Events;
|