v-luck-draw
Version:
1,654 lines (1,470 loc) • 414 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ "00ee":
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__("b622");
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test = {};
test[TO_STRING_TAG] = 'z';
module.exports = String(test) === '[object z]';
/***/ }),
/***/ "0366":
/***/ (function(module, exports, __webpack_require__) {
var aFunction = __webpack_require__("1c0b");
// optional / simple context binding
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/***/ "06cf":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var createPropertyDescriptor = __webpack_require__("5c6c");
var toIndexedObject = __webpack_require__("fc6a");
var toPrimitive = __webpack_require__("c04e");
var has = __webpack_require__("5135");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};
/***/ }),
/***/ "06f8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Util_1 = __webpack_require__("9cb8");
var Animation_1 = __webpack_require__("ed3d");
var Node_1 = __webpack_require__("4971");
var Global_1 = __webpack_require__("d777");
var blacklist = {
node: 1,
duration: 1,
easing: 1,
onFinish: 1,
yoyo: 1
}, PAUSED = 1, PLAYING = 2, REVERSING = 3, idCounter = 0, colorAttrs = ['fill', 'stroke', 'shadowColor'];
var TweenEngine = (function () {
function TweenEngine(prop, propFunc, func, begin, finish, duration, yoyo) {
this.prop = prop;
this.propFunc = propFunc;
this.begin = begin;
this._pos = begin;
this.duration = duration;
this._change = 0;
this.prevPos = 0;
this.yoyo = yoyo;
this._time = 0;
this._position = 0;
this._startTime = 0;
this._finish = 0;
this.func = func;
this._change = finish - this.begin;
this.pause();
}
TweenEngine.prototype.fire = function (str) {
var handler = this[str];
if (handler) {
handler();
}
};
TweenEngine.prototype.setTime = function (t) {
if (t > this.duration) {
if (this.yoyo) {
this._time = this.duration;
this.reverse();
}
else {
this.finish();
}
}
else if (t < 0) {
if (this.yoyo) {
this._time = 0;
this.play();
}
else {
this.reset();
}
}
else {
this._time = t;
this.update();
}
};
TweenEngine.prototype.getTime = function () {
return this._time;
};
TweenEngine.prototype.setPosition = function (p) {
this.prevPos = this._pos;
this.propFunc(p);
this._pos = p;
};
TweenEngine.prototype.getPosition = function (t) {
if (t === undefined) {
t = this._time;
}
return this.func(t, this.begin, this._change, this.duration);
};
TweenEngine.prototype.play = function () {
this.state = PLAYING;
this._startTime = this.getTimer() - this._time;
this.onEnterFrame();
this.fire('onPlay');
};
TweenEngine.prototype.reverse = function () {
this.state = REVERSING;
this._time = this.duration - this._time;
this._startTime = this.getTimer() - this._time;
this.onEnterFrame();
this.fire('onReverse');
};
TweenEngine.prototype.seek = function (t) {
this.pause();
this._time = t;
this.update();
this.fire('onSeek');
};
TweenEngine.prototype.reset = function () {
this.pause();
this._time = 0;
this.update();
this.fire('onReset');
};
TweenEngine.prototype.finish = function () {
this.pause();
this._time = this.duration;
this.update();
this.fire('onFinish');
};
TweenEngine.prototype.update = function () {
this.setPosition(this.getPosition(this._time));
};
TweenEngine.prototype.onEnterFrame = function () {
var t = this.getTimer() - this._startTime;
if (this.state === PLAYING) {
this.setTime(t);
}
else if (this.state === REVERSING) {
this.setTime(this.duration - t);
}
};
TweenEngine.prototype.pause = function () {
this.state = PAUSED;
this.fire('onPause');
};
TweenEngine.prototype.getTimer = function () {
return new Date().getTime();
};
return TweenEngine;
}());
var Tween = (function () {
function Tween(config) {
var that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo, key;
if (typeof config.duration === 'undefined') {
duration = 0.3;
}
else if (config.duration === 0) {
duration = 0.001;
}
else {
duration = config.duration;
}
this.node = node;
this._id = idCounter++;
var layers = node.getLayer() ||
(node instanceof Global_1.Konva['Stage'] ? node.getLayers() : null);
if (!layers) {
Util_1.Util.error('Tween constructor have `node` that is not in a layer. Please add node into layer first.');
}
this.anim = new Animation_1.Animation(function () {
that.tween.onEnterFrame();
}, layers);
this.tween = new TweenEngine(key, function (i) {
that._tweenFunc(i);
}, easing, 0, 1, duration * 1000, yoyo);
this._addListeners();
if (!Tween.attrs[nodeId]) {
Tween.attrs[nodeId] = {};
}
if (!Tween.attrs[nodeId][this._id]) {
Tween.attrs[nodeId][this._id] = {};
}
if (!Tween.tweens[nodeId]) {
Tween.tweens[nodeId] = {};
}
for (key in config) {
if (blacklist[key] === undefined) {
this._addAttr(key, config[key]);
}
}
this.reset();
this.onFinish = config.onFinish;
this.onReset = config.onReset;
}
Tween.prototype._addAttr = function (key, end) {
var node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;
tweenId = Tween.tweens[nodeId][key];
if (tweenId) {
delete Tween.attrs[nodeId][tweenId][key];
}
start = node.getAttr(key);
if (Util_1.Util._isArray(end)) {
diff = [];
len = Math.max(end.length, start.length);
if (key === 'points' && end.length !== start.length) {
if (end.length > start.length) {
trueStart = start;
start = Util_1.Util._prepareArrayForTween(start, end, node.closed());
}
else {
trueEnd = end;
end = Util_1.Util._prepareArrayForTween(end, start, node.closed());
}
}
if (key.indexOf('fill') === 0) {
for (n = 0; n < len; n++) {
if (n % 2 === 0) {
diff.push(end[n] - start[n]);
}
else {
var startRGBA = Util_1.Util.colorToRGBA(start[n]);
endRGBA = Util_1.Util.colorToRGBA(end[n]);
start[n] = startRGBA;
diff.push({
r: endRGBA.r - startRGBA.r,
g: endRGBA.g - startRGBA.g,
b: endRGBA.b - startRGBA.b,
a: endRGBA.a - startRGBA.a
});
}
}
}
else {
for (n = 0; n < len; n++) {
diff.push(end[n] - start[n]);
}
}
}
else if (colorAttrs.indexOf(key) !== -1) {
start = Util_1.Util.colorToRGBA(start);
endRGBA = Util_1.Util.colorToRGBA(end);
diff = {
r: endRGBA.r - start.r,
g: endRGBA.g - start.g,
b: endRGBA.b - start.b,
a: endRGBA.a - start.a
};
}
else {
diff = end - start;
}
Tween.attrs[nodeId][this._id][key] = {
start: start,
diff: diff,
end: end,
trueEnd: trueEnd,
trueStart: trueStart
};
Tween.tweens[nodeId][key] = this._id;
};
Tween.prototype._tweenFunc = function (i) {
var node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;
for (key in attrs) {
attr = attrs[key];
start = attr.start;
diff = attr.diff;
end = attr.end;
if (Util_1.Util._isArray(start)) {
newVal = [];
len = Math.max(start.length, end.length);
if (key.indexOf('fill') === 0) {
for (n = 0; n < len; n++) {
if (n % 2 === 0) {
newVal.push((start[n] || 0) + diff[n] * i);
}
else {
newVal.push('rgba(' +
Math.round(start[n].r + diff[n].r * i) +
',' +
Math.round(start[n].g + diff[n].g * i) +
',' +
Math.round(start[n].b + diff[n].b * i) +
',' +
(start[n].a + diff[n].a * i) +
')');
}
}
}
else {
for (n = 0; n < len; n++) {
newVal.push((start[n] || 0) + diff[n] * i);
}
}
}
else if (colorAttrs.indexOf(key) !== -1) {
newVal =
'rgba(' +
Math.round(start.r + diff.r * i) +
',' +
Math.round(start.g + diff.g * i) +
',' +
Math.round(start.b + diff.b * i) +
',' +
(start.a + diff.a * i) +
')';
}
else {
newVal = start + diff * i;
}
node.setAttr(key, newVal);
}
};
Tween.prototype._addListeners = function () {
var _this = this;
this.tween.onPlay = function () {
_this.anim.start();
};
this.tween.onReverse = function () {
_this.anim.start();
};
this.tween.onPause = function () {
_this.anim.stop();
};
this.tween.onFinish = function () {
var node = _this.node;
var attrs = Tween.attrs[node._id][_this._id];
if (attrs.points && attrs.points.trueEnd) {
node.setAttr('points', attrs.points.trueEnd);
}
if (_this.onFinish) {
_this.onFinish.call(_this);
}
};
this.tween.onReset = function () {
var node = _this.node;
var attrs = Tween.attrs[node._id][_this._id];
if (attrs.points && attrs.points.trueStart) {
node.points(attrs.points.trueStart);
}
if (_this.onReset) {
_this.onReset();
}
};
};
Tween.prototype.play = function () {
this.tween.play();
return this;
};
Tween.prototype.reverse = function () {
this.tween.reverse();
return this;
};
Tween.prototype.reset = function () {
this.tween.reset();
return this;
};
Tween.prototype.seek = function (t) {
this.tween.seek(t * 1000);
return this;
};
Tween.prototype.pause = function () {
this.tween.pause();
return this;
};
Tween.prototype.finish = function () {
this.tween.finish();
return this;
};
Tween.prototype.destroy = function () {
var nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;
this.pause();
for (key in attrs) {
delete Tween.tweens[nodeId][key];
}
delete Tween.attrs[nodeId][thisId];
};
Tween.attrs = {};
Tween.tweens = {};
return Tween;
}());
exports.Tween = Tween;
Node_1.Node.prototype.to = function (params) {
var onFinish = params.onFinish;
params.node = this;
params.onFinish = function () {
this.destroy();
if (onFinish) {
onFinish();
}
};
var tween = new Tween(params);
tween.play();
};
exports.Easings = {
BackEaseIn: function (t, b, c, d) {
var s = 1.70158;
return c * (t /= d) * t * ((s + 1) * t - s) + b;
},
BackEaseOut: function (t, b, c, d) {
var s = 1.70158;
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
},
BackEaseInOut: function (t, b, c, d) {
var s = 1.70158;
if ((t /= d / 2) < 1) {
return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
}
return (c / 2) * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
},
ElasticEaseIn: function (t, b, c, d, a, p) {
var s = 0;
if (t === 0) {
return b;
}
if ((t /= d) === 1) {
return b + c;
}
if (!p) {
p = d * 0.3;
}
if (!a || a < Math.abs(c)) {
a = c;
s = p / 4;
}
else {
s = (p / (2 * Math.PI)) * Math.asin(c / a);
}
return (-(a *
Math.pow(2, 10 * (t -= 1)) *
Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + b);
},
ElasticEaseOut: function (t, b, c, d, a, p) {
var s = 0;
if (t === 0) {
return b;
}
if ((t /= d) === 1) {
return b + c;
}
if (!p) {
p = d * 0.3;
}
if (!a || a < Math.abs(c)) {
a = c;
s = p / 4;
}
else {
s = (p / (2 * Math.PI)) * Math.asin(c / a);
}
return (a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) +
c +
b);
},
ElasticEaseInOut: function (t, b, c, d, a, p) {
var s = 0;
if (t === 0) {
return b;
}
if ((t /= d / 2) === 2) {
return b + c;
}
if (!p) {
p = d * (0.3 * 1.5);
}
if (!a || a < Math.abs(c)) {
a = c;
s = p / 4;
}
else {
s = (p / (2 * Math.PI)) * Math.asin(c / a);
}
if (t < 1) {
return (-0.5 *
(a *
Math.pow(2, 10 * (t -= 1)) *
Math.sin(((t * d - s) * (2 * Math.PI)) / p)) +
b);
}
return (a *
Math.pow(2, -10 * (t -= 1)) *
Math.sin(((t * d - s) * (2 * Math.PI)) / p) *
0.5 +
c +
b);
},
BounceEaseOut: function (t, b, c, d) {
if ((t /= d) < 1 / 2.75) {
return c * (7.5625 * t * t) + b;
}
else if (t < 2 / 2.75) {
return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b;
}
else if (t < 2.5 / 2.75) {
return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b;
}
else {
return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b;
}
},
BounceEaseIn: function (t, b, c, d) {
return c - exports.Easings.BounceEaseOut(d - t, 0, c, d) + b;
},
BounceEaseInOut: function (t, b, c, d) {
if (t < d / 2) {
return exports.Easings.BounceEaseIn(t * 2, 0, c, d) * 0.5 + b;
}
else {
return exports.Easings.BounceEaseOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;
}
},
EaseIn: function (t, b, c, d) {
return c * (t /= d) * t + b;
},
EaseOut: function (t, b, c, d) {
return -c * (t /= d) * (t - 2) + b;
},
EaseInOut: function (t, b, c, d) {
if ((t /= d / 2) < 1) {
return (c / 2) * t * t + b;
}
return (-c / 2) * (--t * (t - 2) - 1) + b;
},
StrongEaseIn: function (t, b, c, d) {
return c * (t /= d) * t * t * t * t + b;
},
StrongEaseOut: function (t, b, c, d) {
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
},
StrongEaseInOut: function (t, b, c, d) {
if ((t /= d / 2) < 1) {
return (c / 2) * t * t * t * t * t + b;
}
return (c / 2) * ((t -= 2) * t * t * t * t + 2) + b;
},
Linear: function (t, b, c, d) {
return (c * t) / d + b;
}
};
/***/ }),
/***/ "0cfb":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var fails = __webpack_require__("d039");
var createElement = __webpack_require__("cc12");
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/***/ "0ff5":
/***/ (function(module, exports, __webpack_require__) {
"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 (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Util_1 = __webpack_require__("9cb8");
var Container_1 = __webpack_require__("ea61");
var Factory_1 = __webpack_require__("f0b4");
var BaseLayer_1 = __webpack_require__("d6af");
var Canvas_1 = __webpack_require__("f655");
var Shape_1 = __webpack_require__("fce6");
var Validators_1 = __webpack_require__("4546");
var Global_1 = __webpack_require__("d777");
var HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw', INTERSECTION_OFFSETS = [
{ x: 0, y: 0 },
{ x: -1, y: -1 },
{ x: 1, y: -1 },
{ x: 1, y: 1 },
{ x: -1, y: 1 }
], INTERSECTION_OFFSETS_LEN = INTERSECTION_OFFSETS.length;
var Layer = (function (_super) {
__extends(Layer, _super);
function Layer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.hitCanvas = new Canvas_1.HitCanvas({
pixelRatio: 1
});
return _this;
}
Layer.prototype.setSize = function (_a) {
var width = _a.width, height = _a.height;
_super.prototype.setSize.call(this, { width: width, height: height });
this.hitCanvas.setSize(width, height);
return this;
};
Layer.prototype._validateAdd = function (child) {
var type = child.getType();
if (type !== 'Group' && type !== 'Shape') {
Util_1.Util.throw('You may only add groups and shapes to a layer.');
}
};
Layer.prototype.getIntersection = function (pos, selector) {
var obj, i, intersectionOffset, shape;
if (!this.hitGraphEnabled() || !this.isVisible()) {
return null;
}
var spiralSearchDistance = 1;
var continueSearch = false;
while (true) {
for (i = 0; i < INTERSECTION_OFFSETS_LEN; i++) {
intersectionOffset = INTERSECTION_OFFSETS[i];
obj = this._getIntersection({
x: pos.x + intersectionOffset.x * spiralSearchDistance,
y: pos.y + intersectionOffset.y * spiralSearchDistance
});
shape = obj.shape;
if (shape && selector) {
return shape.findAncestor(selector, true);
}
else if (shape) {
return shape;
}
continueSearch = !!obj.antialiased;
if (!obj.antialiased) {
break;
}
}
if (continueSearch) {
spiralSearchDistance += 1;
}
else {
return null;
}
}
};
Layer.prototype._getIntersection = function (pos) {
var ratio = this.hitCanvas.pixelRatio;
var p = this.hitCanvas.context.getImageData(Math.round(pos.x * ratio), Math.round(pos.y * ratio), 1, 1).data, p3 = p[3], colorKey, shape;
if (p3 === 255) {
colorKey = Util_1.Util._rgbToHex(p[0], p[1], p[2]);
shape = Shape_1.shapes[HASH + colorKey];
if (shape) {
return {
shape: shape
};
}
return {
antialiased: true
};
}
else if (p3 > 0) {
return {
antialiased: true
};
}
return {};
};
Layer.prototype.drawScene = function (can, top) {
var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());
this._fire(BEFORE_DRAW, {
node: this
});
if (this.clearBeforeDraw()) {
canvas.getContext().clear();
}
Container_1.Container.prototype.drawScene.call(this, canvas, top);
this._fire(DRAW, {
node: this
});
return this;
};
Layer.prototype.drawHit = function (can, top) {
var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas);
if (layer && layer.clearBeforeDraw()) {
layer
.getHitCanvas()
.getContext()
.clear();
}
Container_1.Container.prototype.drawHit.call(this, canvas, top);
return this;
};
Layer.prototype.clear = function (bounds) {
BaseLayer_1.BaseLayer.prototype.clear.call(this, bounds);
this.getHitCanvas()
.getContext()
.clear(bounds);
return this;
};
Layer.prototype.enableHitGraph = function () {
this.hitGraphEnabled(true);
return this;
};
Layer.prototype.disableHitGraph = function () {
this.hitGraphEnabled(false);
return this;
};
Layer.prototype.toggleHitCanvas = function () {
if (!this.parent) {
return;
}
var parent = this.parent;
var added = !!this.hitCanvas._canvas.parentNode;
if (added) {
parent.content.removeChild(this.hitCanvas._canvas);
}
else {
parent.content.appendChild(this.hitCanvas._canvas);
}
};
return Layer;
}(BaseLayer_1.BaseLayer));
exports.Layer = Layer;
Layer.prototype.nodeType = 'Layer';
Global_1._registerNode(Layer);
Factory_1.Factory.addGetterSetter(Layer, 'hitGraphEnabled', true, Validators_1.getBooleanValidator());
Util_1.Collection.mapMethods(Layer);
/***/ }),
/***/ "19aa":
/***/ (function(module, exports) {
module.exports = function (it, Constructor, name) {
if (!(it instanceof Constructor)) {
throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
} return it;
};
/***/ }),
/***/ "1be4":
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__("d066");
module.exports = getBuiltIn('document', 'documentElement');
/***/ }),
/***/ "1c0b":
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
/***/ }),
/***/ "1c7e":
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__("b622");
var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function () {
return { done: !!called++ };
},
'return': function () {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR] = function () {
return this;
};
// eslint-disable-next-line no-throw-literal
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }
module.exports = function (exec, SKIP_CLOSING) {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR] = function () {
return {
next: function () {
return { done: ITERATION_SUPPORT = true };
}
};
};
exec(object);
} catch (error) { /* empty */ }
return ITERATION_SUPPORT;
};
/***/ }),
/***/ "1cdc":
/***/ (function(module, exports, __webpack_require__) {
var userAgent = __webpack_require__("342f");
module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
/***/ }),
/***/ "1d80":
/***/ (function(module, exports) {
// `RequireObjectCoercible` abstract operation
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/***/ "1dde":
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__("d039");
var wellKnownSymbol = __webpack_require__("b622");
var V8_VERSION = __webpack_require__("2d00");
var SPECIES = wellKnownSymbol('species');
module.exports = function (METHOD_NAME) {
// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/677
return V8_VERSION >= 51 || !fails(function () {
var array = [];
var constructor = array.constructor = {};
constructor[SPECIES] = function () {
return { foo: 1 };
};
return array[METHOD_NAME](Boolean).foo !== 1;
});
};
/***/ }),
/***/ "1f21":
/***/ (function(module, exports, __webpack_require__) {
"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 (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Util_1 = __webpack_require__("9cb8");
var Factory_1 = __webpack_require__("f0b4");
var Shape_1 = __webpack_require__("fce6");
var Validators_1 = __webpack_require__("4546");
var Global_1 = __webpack_require__("d777");
var Circle = (function (_super) {
__extends(Circle, _super);
function Circle() {
return _super !== null && _super.apply(this, arguments) || this;
}
Circle.prototype._sceneFunc = function (context) {
context.beginPath();
context.arc(0, 0, this.radius(), 0, Math.PI * 2, false);
context.closePath();
context.fillStrokeShape(this);
};
Circle.prototype.getWidth = function () {
return this.radius() * 2;
};
Circle.prototype.getHeight = function () {
return this.radius() * 2;
};
Circle.prototype.setWidth = function (width) {
if (this.radius() !== width / 2) {
this.radius(width / 2);
}
};
Circle.prototype.setHeight = function (height) {
if (this.radius() !== height / 2) {
this.radius(height / 2);
}
};
return Circle;
}(Shape_1.Shape));
exports.Circle = Circle;
Circle.prototype._centroid = true;
Circle.prototype.className = 'Circle';
Circle.prototype._attrsAffectingSize = ['radius'];
Global_1._registerNode(Circle);
Factory_1.Factory.addGetterSetter(Circle, 'radius', 0, Validators_1.getNumberValidator());
Util_1.Collection.mapMethods(Circle);
/***/ }),
/***/ "2266":
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__("825a");
var isArrayIteratorMethod = __webpack_require__("e95a");
var toLength = __webpack_require__("50c4");
var bind = __webpack_require__("0366");
var getIteratorMethod = __webpack_require__("35a1");
var callWithSafeIterationClosing = __webpack_require__("9bdd");
var Result = function (stopped, result) {
this.stopped = stopped;
this.result = result;
};
var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
var iterator, iterFn, index, length, result, next, step;
if (IS_ITERATOR) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
// optimisation for array iterators
if (isArrayIteratorMethod(iterFn)) {
for (index = 0, length = toLength(iterable.length); length > index; index++) {
result = AS_ENTRIES
? boundFunction(anObject(step = iterable[index])[0], step[1])
: boundFunction(iterable[index]);
if (result && result instanceof Result) return result;
} return new Result(false);
}
iterator = iterFn.call(iterable);
}
next = iterator.next;
while (!(step = next.call(iterator)).done) {
result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
if (typeof result == 'object' && result && result instanceof Result) return result;
} return new Result(false);
};
iterate.stop = function (result) {
return new Result(true, result);
};
/***/ }),
/***/ "23cb":
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__("a691");
var max = Math.max;
var min = Math.min;
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
module.exports = function (index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min(integer, length);
};
/***/ }),
/***/ "23e7":
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__("da84");
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var createNonEnumerableProperty = __webpack_require__("9112");
var redefine = __webpack_require__("6eeb");
var setGlobal = __webpack_require__("ce4e");
var copyConstructorProperties = __webpack_require__("e893");
var isForced = __webpack_require__("94ca");
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
module.exports = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global;
} else if (STATIC) {
target = global[TARGET] || setGlobal(TARGET, {});
} else {
target = (global[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
/***/ }),
/***/ "241c":
/***/ (function(module, exports, __webpack_require__) {
var internalObjectKeys = __webpack_require__("ca84");
var enumBugKeys = __webpack_require__("7839");
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys);
};
/***/ }),
/***/ "2626":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getBuiltIn = __webpack_require__("d066");
var definePropertyModule = __webpack_require__("9bf2");
var wellKnownSymbol = __webpack_require__("b622");
var DESCRIPTORS = __webpack_require__("83ab");
var SPECIES = wellKnownSymbol('species');
module.exports = function (CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
var defineProperty = definePropertyModule.f;
if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
defineProperty(Constructor, SPECIES, {
configurable: true,
get: function () { return this; }
});
}
};
/***/ }),
/***/ "2cf4":
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__("da84");
var fails = __webpack_require__("d039");
var classof = __webpack_require__("c6b6");
var bind = __webpack_require__("0366");
var html = __webpack_require__("1be4");
var createElement = __webpack_require__("cc12");
var IS_IOS = __webpack_require__("1cdc");
var location = global.location;
var set = global.setImmediate;
var clear = global.clearImmediate;
var process = global.process;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var defer, channel, port;
var run = function (id) {
// eslint-disable-next-line no-prototype-builtins
if (queue.hasOwnProperty(id)) {
var fn = queue[id];
delete queue[id];
fn();
}
};
var runner = function (id) {
return function () {
run(id);
};
};
var listener = function (event) {
run(event.data);
};
var post = function (id) {
// old engines have not location.origin
global.postMessage(id + '', location.protocol + '//' + location.host);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!set || !clear) {
set = function setImmediate(fn) {
var args = [];
var i = 1;
while (arguments.length > i) args.push(arguments[i++]);
queue[++counter] = function () {
// eslint-disable-next-line no-new-func
(typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
};
defer(counter);
return counter;
};
clear = function clearImmediate(id) {
delete queue[id];
};
// Node.js 0.8-
if (classof(process) == 'process') {
defer = function (id) {
process.nextTick(runner(id));
};
// Sphere (JS game engine) Dispatch API
} else if (Dispatch && Dispatch.now) {
defer = function (id) {
Dispatch.now(runner(id));
};
// Browsers with MessageChannel, includes WebWorkers
// except iOS - https://github.com/zloirock/core-js/issues/624
} else if (MessageChannel && !IS_IOS) {
channel = new MessageChannel();
port = channel.port2;
channel.port1.onmessage = listener;
defer = bind(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (
global.addEventListener &&
typeof postMessage == 'function' &&
!global.importScripts &&
!fails(post) &&
location.protocol !== 'file:'
) {
defer = post;
global.addEventListener('message', listener, false);
// IE8-
} else if (ONREADYSTATECHANGE in createElement('script')) {
defer = function (id) {
html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
html.removeChild(this);
run(id);
};
};
// Rest old browsers
} else {
defer = function (id) {
setTimeout(runner(id), 0);
};
}
}
module.exports = {
set: set,
clear: clear
};
/***/ }),
/***/ "2d00":
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__("da84");
var userAgent = __webpack_require__("342f");
var process = global.process;
var versions = process && process.versions;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
version = match[0] + match[1];
} else if (userAgent) {
match = userAgent.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent.match(/Chrome\/(\d+)/);
if (match) version = match[1];
}
}
module.exports = version && +version;
/***/ }),
/***/ "342f":
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__("d066");
module.exports = getBuiltIn('navigator', 'userAgent') || '';
/***/ }),
/***/ "35a1":
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__("f5df");
var Iterators = __webpack_require__("3f8c");
var wellKnownSymbol = __webpack_require__("b622");
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/***/ "37e8":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var definePropertyModule = __webpack_require__("9bf2");
var anObject = __webpack_require__("825a");
var objectKeys = __webpack_require__("df75");
// `Object.defineProperties` method
// https://tc39.github.io/ecma262/#sec-object.defineproperties
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
return O;
};
/***/ }),
/***/ "3bbe":
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__("861d");
module.exports = function (it) {
if (!isObject(it) && it !== null) {
throw TypeError("Can't set " + String(it) + ' as a prototype');
} return it;
};
/***/ }),
/***/ "3ca3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var charAt = __webpack_require__("6547").charAt;
var InternalStateModule = __webpack_require__("69f3");
var defineIterator = __webpack_require__("7dd0");
var STRING_ITERATOR = 'String Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
// `String.prototype[@@iterator]` method
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
defineIterator(String, 'String', function (iterated) {
setInternalState(this, {
type: STRING_ITERATOR,
string: String(iterated),
index: 0
});
// `%StringIteratorPrototype%.next` method
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
}, function next() {
var state = getInternalState(this);
var string = state.string;
var index = state.index;
var point;
if (index >= string.length) return { value: undefined, done: true };
point = charAt(string, index);
state.index += point.length;
return { value: point, done: false };
});
/***/ }),
/***/ "3f8c":
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/***/ "428f":
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__("da84");
module.exports = global;
/***/ }),
/***/ "44ad":
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__("d039");
var classof = __webpack_require__("c6b6");
var split = ''.split;
// fallback for non-array-like ES3 and non-enumerable old V8 strings
module.exports = fails(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
/***/ }),
/***/ "44d2":
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__("b622");
var create = __webpack_require__("7c73");
var definePropertyModule = __webpack_require__("9bf2");
var UNSCOPABLES = wellKnownSymbol('unscopables');
var ArrayPrototype = Array.prototype;
// Array.prototype[@@unscopables]
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
if (ArrayPrototype[UNSCOPABLES] == undefined) {
definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
configurable: true,
value: create(null)
});
}
// add a key to Array.prototype[@@unscopables]
module.exports = function (key) {
ArrayPrototype[UNSCOPABLES][key] = true;
};
/***/ }),
/***/ "44de":
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__("da84");
module.exports = function (a, b) {
var console = global.console;
if (console && console.error) {
arguments.length === 1 ? console.error(a) : console.error(a, b);
}
};
/***/ }),
/***/ "4546":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = __webpack_require__("d777");
var Util_1 = __webpack_require__("9cb8");
function _formatValue(val) {
if (Util_1.Util._isString(val)) {
return '"' + val + '"';
}
if (Object.prototype.toString.call(val) === '[object Number]') {
return val;
}
if (Util_1.Util._isBoolean(val)) {
return val;
}
return Object.prototype.toString.call(val);
}
function RGBComponent(val) {
if (val > 255) {
return 255;
}
else if (val < 0) {
return 0;
}
return Math.round(val);
}
exports.RGBComponent = RGBComponent;
function alphaComponent(val) {
if (val > 1) {
return 1;
}
else if (val < 0.0001) {
return 0.0001;
}
return val;
}
exports.alphaComponent = alphaComponent;
function getNumberValidator() {
if (Global_1.Konva.isUnminified) {
return function (val, attr) {
if (!Util_1.Util._isNumber(val)) {
Util_1.Util.warn(_formatValue(val) +
' is a not valid value for "' +
attr +
'" attribute. The value should be a number.');
}
return val;
};
}
}
exports.getNumberValidator = getNumberValidator;
function getNumberOrAutoValidator() {
if (Global_1.Konva.isUnminified) {
return function (val, attr) {
var isNumber = Util_1.Util._isNumber(val);
var isAuto = val === 'auto';
if (!(isNumber || isAuto)) {
Util_1.Util.warn(_formatValue(val) +
' is a not valid value for "' +
attr +
'" attribute. The value should be a number or "auto".');
}
return val;
};
}
}
exports.getNumberOrAutoValidator = getNumberOrAutoValidator;
function getStringValidator() {
if (Global_1.Konva.isUnminified) {
return function (val, attr) {
if (!Util_1.Util._isString(val)) {
Util_1.Util.warn(_formatValue(val) +
' is a not valid value for "' +
attr +
'" attribute. The value should be a string.');
}
return val;
};
}
}
exports.getStringValidator = getStringValidator;
function getFunctionValidator() {
if (Global_1.Konva.isUnminified) {
return function (val, attr) {