UNPKG

tweak-tools

Version:

Tweak your React projects until awesomeness

35 lines (34 loc) 1.71 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); const Vector2d_1 = require("./Vector2d"); const Vector_1 = require("../Vector"); const plugin_1 = require("../../plugin"); __exportStar(require("./Vector2d"), exports); const plugin = (0, Vector_1.getVectorPlugin)(['x', 'y']); const normalize = (_a) => { var { joystick = true } = _a, input = __rest(_a, ["joystick"]); const { value, settings } = plugin.normalize(input); return { value, settings: Object.assign(Object.assign({}, settings), { joystick }) }; }; exports.default = (0, plugin_1.createInternalPlugin)(Object.assign(Object.assign({ component: Vector2d_1.Vector2dComponent }, plugin), { normalize }));