104 lines
4.1 KiB
JavaScript
104 lines
4.1 KiB
JavaScript
|
"use strict";
|
||
|
var __extends = (this && this.__extends) || (function () {
|
||
|
var extendStatics = function (d, b) {
|
||
|
extendStatics = Object.setPrototypeOf ||
|
||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||
|
return extendStatics(d, b);
|
||
|
};
|
||
|
return function (d, b) {
|
||
|
if (typeof b !== "function" && b !== null)
|
||
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||
|
extendStatics(d, b);
|
||
|
function __() { this.constructor = d; }
|
||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||
|
};
|
||
|
})();
|
||
|
var __read = (this && this.__read) || function (o, n) {
|
||
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||
|
if (!m) return o;
|
||
|
var i = m.call(o), r, ar = [], e;
|
||
|
try {
|
||
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||
|
}
|
||
|
catch (error) { e = { error: error }; }
|
||
|
finally {
|
||
|
try {
|
||
|
if (r && !r.done && (m = i["return"])) m.call(i);
|
||
|
}
|
||
|
finally { if (e) throw e.error; }
|
||
|
}
|
||
|
return ar;
|
||
|
};
|
||
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||
|
if (ar || !(i in from)) {
|
||
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||
|
ar[i] = from[i];
|
||
|
}
|
||
|
}
|
||
|
return to.concat(ar || Array.prototype.slice.call(from));
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.CommonMactionMixin = exports.TooltipData = void 0;
|
||
|
var string_js_1 = require("../../../util/string.js");
|
||
|
exports.TooltipData = {
|
||
|
dx: '.2em',
|
||
|
dy: '.1em',
|
||
|
postDelay: 600,
|
||
|
clearDelay: 100,
|
||
|
hoverTimer: new Map(),
|
||
|
clearTimer: new Map(),
|
||
|
stopTimers: function (node, data) {
|
||
|
if (data.clearTimer.has(node)) {
|
||
|
clearTimeout(data.clearTimer.get(node));
|
||
|
data.clearTimer.delete(node);
|
||
|
}
|
||
|
if (data.hoverTimer.has(node)) {
|
||
|
clearTimeout(data.hoverTimer.get(node));
|
||
|
data.hoverTimer.delete(node);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
function CommonMactionMixin(Base) {
|
||
|
return (function (_super) {
|
||
|
__extends(class_1, _super);
|
||
|
function class_1() {
|
||
|
var args = [];
|
||
|
for (var _i = 0; _i < arguments.length; _i++) {
|
||
|
args[_i] = arguments[_i];
|
||
|
}
|
||
|
var _this = _super.apply(this, __spreadArray([], __read(args), false)) || this;
|
||
|
var actions = _this.constructor.actions;
|
||
|
var action = _this.node.attributes.get('actiontype');
|
||
|
var _a = __read(actions.get(action) || [(function (_node, _data) { }), {}], 2), handler = _a[0], data = _a[1];
|
||
|
_this.action = handler;
|
||
|
_this.data = data;
|
||
|
_this.getParameters();
|
||
|
return _this;
|
||
|
}
|
||
|
Object.defineProperty(class_1.prototype, "selected", {
|
||
|
get: function () {
|
||
|
var selection = this.node.attributes.get('selection');
|
||
|
var i = Math.max(1, Math.min(this.childNodes.length, selection)) - 1;
|
||
|
return this.childNodes[i] || this.wrap(this.node.selected);
|
||
|
},
|
||
|
enumerable: false,
|
||
|
configurable: true
|
||
|
});
|
||
|
class_1.prototype.getParameters = function () {
|
||
|
var offsets = this.node.attributes.get('data-offsets');
|
||
|
var _a = __read((0, string_js_1.split)(offsets || ''), 2), dx = _a[0], dy = _a[1];
|
||
|
this.dx = this.length2em(dx || exports.TooltipData.dx);
|
||
|
this.dy = this.length2em(dy || exports.TooltipData.dy);
|
||
|
};
|
||
|
class_1.prototype.computeBBox = function (bbox, recompute) {
|
||
|
if (recompute === void 0) { recompute = false; }
|
||
|
bbox.updateFrom(this.selected.getOuterBBox());
|
||
|
this.selected.setChildPWidths(recompute);
|
||
|
};
|
||
|
return class_1;
|
||
|
}(Base));
|
||
|
}
|
||
|
exports.CommonMactionMixin = CommonMactionMixin;
|
||
|
//# sourceMappingURL=maction.js.map
|