UNPKG

vue-poster-editor

Version:

A poster editor based on Vue.js

60 lines (52 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function ObservablePoint(cb, scope, x, y) { this._x = x || 0; this._y = y || 0; this.cb = cb; this.scope = scope; } Object.defineProperties(ObservablePoint.prototype, { x: { get: function get() { return this._x; }, set: function set(value) { if (this._x !== value) { this._x = value; this.cb.call(this.scope); } } }, y: { get: function get() { return this._y; }, set: function set(value) { if (this._y !== value) { this._y = value; this.cb.call(this.scope); } } } }); ObservablePoint.prototype.set = function (x, y) { var _x = x || 0; var _y = y || (y !== 0 ? _x : 0); if (this._x !== _x || this._y !== _y) { this._x = _x; this._y = _y; this.cb.call(this.scope); } }; ObservablePoint.prototype.copy = function (point) { if (this._x !== point.x || this._y !== point.y) { this._x = point.x; this._y = point.y; this.cb.call(this.scope); } }; exports.default = ObservablePoint; module.exports = exports["default"];