UNPKG

@true-directive/base

Version:

The set of base classes for the TrueDirective Grid

47 lines (46 loc) 1.5 kB
/** * Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company. * @link https://truedirective.com/ * @license MIT */ var UIActionType = /** @class */ (function () { function UIActionType(name) { this.name = name; } UIActionType.CLICK = new UIActionType('CLICK'); UIActionType.REORDER_COLUMN = new UIActionType('REORDER_COLUMN'); UIActionType.RESIZE_COLUMN = new UIActionType('RESIZE_COLUMN'); UIActionType.SELECT = new UIActionType('SELECT'); UIActionType.ROW_DRAG = new UIActionType('ROW_DRAG'); return UIActionType; }()); export { UIActionType }; var UIAction = /** @class */ (function () { function UIAction(action, target, x, y) { this.action = action; this.target = target; this.x = x; this.y = y; this.initialized = false; this.targetOffsetX = 0; this.targetOffsetY = 0; this.renderTarget = null; this.x0 = x; this.y0 = y; } UIAction.prototype.move = function (x, y) { if (x !== this.x || y !== this.y) { this.x = x; this.y = y; return true; } return false; }; UIAction.prototype.inItemRect = function (rect, itemRect) { var xx = this.x; var yy = this.y; return (xx >= rect.left) && (xx <= rect.right) && (xx >= itemRect.left) && (xx <= itemRect.right); }; return UIAction; }()); export { UIAction };