UNPKG

@ngfx/ui

Version:

Angular UI library for gaming and creative applications

507 lines (495 loc) 33.3 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var core = require('@angular/core'); var platformBrowser = require('@angular/platform-browser'); var common = require('@angular/common'); var NgFxController = (function () { function NgFxController() { this.surfaces = {}; this.onEvent = new core.EventEmitter(); } NgFxController.prototype.createSurface = function (id, controls) { this.surfaces[id] = { id: id, controls: controls }; }; NgFxController.prototype.getSurface = function (id) { return this.surfaces[id]; }; NgFxController.prototype.destroySurface = function (id) { delete this.surfaces[id]; }; NgFxController.decorators = [ { type: core.Injectable }, ]; NgFxController.ctorParameters = function () { return []; }; return NgFxController; }()); var NgFxButtonComponent = (function () { function NgFxButtonComponent(_controller, _sanitizer) { this._controller = _controller; this._sanitizer = _sanitizer; } Object.defineProperty(NgFxButtonComponent.prototype, "transform", { get: function () { return this.sanitize(this.control.transform) || this.sanitize(''); }, enumerable: true, configurable: true }); Object.defineProperty(NgFxButtonComponent.prototype, "gridArea", { get: function () { return this.sanitize(this.control.gridArea) || this.sanitize(''); }, enumerable: true, configurable: true }); Object.defineProperty(NgFxButtonComponent.prototype, "placeSelf", { get: function () { return this.sanitize(this.control.placeSelf) || this.sanitize(''); }, enumerable: true, configurable: true }); NgFxButtonComponent.prototype.onMouseup = function (event) { this.onHold = false; this.control.currentValue = false; this.control.hasUserInput = false; window.clearInterval(this._holdInterval); this._controller.onEvent.emit({ type: 'change', control: this.control }); }; NgFxButtonComponent.prototype.onMousedown = function (event) { var _this = this; this.onHold = true; this._holdInterval = window.setInterval(function () { _this.setActive(); }, 200); this.setActive(); }; NgFxButtonComponent.prototype.onTouchStart = function (e) { this.onMousedown(e); }; NgFxButtonComponent.prototype.onTouchEnd = function (e) { this.onMouseup(e); }; NgFxButtonComponent.prototype.setActive = function () { this.control.currentValue = true; this.control.hasUserInput = true; this._controller.onEvent.emit({ type: 'change', control: this.control }); }; NgFxButtonComponent.prototype.hasName = function () { return this.control.name !== undefined && this.control.name.length > 0; }; NgFxButtonComponent.prototype.sanitize = function (style) { return this._sanitizer.bypassSecurityTrustStyle(style); }; NgFxButtonComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngfx-button, [ngfx-button]', template: "<div class=\"ngfx__title\" [hidden]=\"!hasName()\"><span class=\"control__name\">{{control.name.charAt(0).toUpperCase()}}</span> <span class=\"slave__indicator\" [ngClass]=\"{\'is--visible\': control.hasRemoteInput === true }\"></span></div><div class=\"ngfx__button\" [ngClass]=\"{\'is--active\' : control.currentValue === true }\"></div>", styles: [":host {\n display: flex;\n flex-direction: column;\n justify-content: left;\n}\n\n:host .ngfx__title {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n -webkit-transform: translateY(-4px);\n transform: translateY(-4px);\n}\n\n:host .ngfx__title .control__name {\n color: rgba(255, 255, 255, 0.3);\n font-size: 12px;\n font-weight: 700;\n}\n\n:host .ngfx__title .slave__indicator {\n width: 8px;\n height: 8px;\n border-radius: 50% 50%;\n background: rgba(255, 255, 255, 0.5);\n -webkit-transform: translateX(4px) translateY(3px);\n transform: translateX(4px) translateY(3px);\n display: none;\n}\n\n:host .ngfx__title .slave__indicator.is--visible {\n display: block;\n}\n\n:host .ngfx__button {\n width: 100%;\n min-height: 32px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 14px;\n cursor: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACEUlEQVRYhe2Z646CMBBGTwusl/d/VnUV6P6Yjq0V5KJISfZLSCMBPYxfp2XGOOd4QwYo/GH9YZJrHND6o/HH7B8t37iv8qNCKkQKY6JR4Wvg5sdJMhMjXAI7Pxr/41OjZQgPUQO/TAAfC2yAAxJVENBPyPrxBlzGfO8Y4AqBtYj/llCBwJ4R+F4NAf8gsPC5qPZJo31BbPLyoi7tgCNhoiwtnQ8HYN93UR+wRnbOpHpHDrHdHgnYk7qASySy34aN1SIBe0q7KbAh2GAtWAg2PJIsRCnw3p/7hmeH5BCWQ3wyBi4R7y6VuuaoIayowCNwp8kz0Z1NgQvkKXKwQqoWYSshAP+shjNeFQTgknWzwpAcfsNlCVvE3IEtUFjEv1tRoW8JW9HmgE36epOzHB54U/oHXlqaf9NaQo4ygMtlKzlWmwNulnx1X0KNRaouLXn7WKtMjWaJmvyBa7yHAa4rwozVDUIebpAnyDEvq21r/aDqLQ+tLEPEFgPXiDVy2h8XCNO9HJtaQEueOUxA3UVe4pMpsANOdJf+vynjGU4kC1vXJKuROu2aE9DSUyvu63GoydeoYBa8qBG/asroDXvCSrOk1AZnXmSsXFoGus29MLCIjW3KWCTSm2jKxKqQspZaaU4dOW17XRloxDzcPLMTmjYWY3V9YZwitbGozcVJmgscgyh0wWP0VPovNIT27WxL/QG7cp5Q+WnBUwAAAABJRU5ErkJggg==\") 0 0, pointer;\n}\n\n:host .ngfx__button.is--active {\n background: rgba(255, 255, 255, 0.1);\n border: 2px solid rgba(255, 255, 255, 0.5);\n}\n"] },] }, ]; NgFxButtonComponent.ctorParameters = function () { return [ { type: NgFxController }, { type: platformBrowser.DomSanitizer } ]; }; NgFxButtonComponent.propDecorators = { control: [{ type: core.Input, args: ['control',] }], transform: [{ type: core.HostBinding, args: ['style.transform',] }], gridArea: [{ type: core.HostBinding, args: ['style.grid-area',] }], placeSelf: [{ type: core.HostBinding, args: ['style.place-self',] }], onMouseup: [{ type: core.HostListener, args: ['mouseup', ['$event'],] }], onMousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }], onTouchStart: [{ type: core.HostListener, args: ['touchstart', ['$event'],] }], onTouchEnd: [{ type: core.HostListener, args: ['touchend', ['$event'],] }] }; return NgFxButtonComponent; }()); var NgFxButtonModule = (function () { function NgFxButtonModule() { } NgFxButtonModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule], declarations: [NgFxButtonComponent], exports: [NgFxButtonComponent] },] }, ]; return NgFxButtonModule; }()); var NgFxDraggableDirective = (function () { function NgFxDraggableDirective(_el, _controller) { this._el = _el; this._controller = _controller; this._elem = _el.nativeElement; } NgFxDraggableDirective.prototype.ngOnInit = function () { var nodeList = (((this._elem.getElementsByClassName('ngfx__handle')))); this._touchItem = null; this._handle = nodeList[0]; this.control.height = this._elem.clientHeight; this.control.width = this._elem.clientWidth; if (this.control.orient === 'is--hor') { this.control.currentValue = 0; this.control.position = 'translate(' + 0 + 'px' + ',' + 0 + 'px' + ')'; } else if (this.control.orient === 'is--vert') { this.control.currentValue = 0; this.control.position = 'translate(' + 0 + 'px' + ',' + 0 + 'px' + ')'; } else if (this.control.orient === 'is--joystick') { this.control.currentValue = [0, 0]; this.control.x = this.control.y = 76; this.control.position = 'translate(' + 76 + 'px' + ',' + 76 + 'px' + ')'; } this._lastPos = { transform: this.control.position }; this.setActualPosition(this.control.position); }; NgFxDraggableDirective.prototype.onMouseLeave = function (e) { }; NgFxDraggableDirective.prototype.onMouseEnter = function (e) { if (this.control.isActive) { this.control.hasUserInput = true; } }; NgFxDraggableDirective.prototype.onTouchStart = function (e) { this.control.hasUserInput = true; this.onTouchDown(e); }; NgFxDraggableDirective.prototype.onTouchDown = function (e) { e.preventDefault(); this.control.isActive = true; this.control.hasUserInput = true; this._rect = this._elem.getBoundingClientRect(); this.control.height = this._elem.clientHeight; this.control.width = this._elem.clientWidth; this._elem.addEventListener('touchmove', this.onTouchMove.bind(this)); this._elem.addEventListener('touchend', this.onMouseUp.bind(this)); if (this._touchItem === null) { this._touchItem = e.touches.length - 1; } this.control.x = e.touches[this._touchItem].pageX - this._rect.left - this._handle.clientWidth / 2; this.control.y = e.touches[this._touchItem].pageY - this._rect.top - this._handle.clientWidth / 2; this.setPosition(this.control.x, this.control.y); }; NgFxDraggableDirective.prototype.onMouseDown = function (e) { e.preventDefault(); this.control.isActive = true; this.control.hasUserInput = true; this._rect = this._elem.getBoundingClientRect(); this.control.height = this._elem.clientHeight; this.control.width = this._elem.clientWidth; this.control.x = e.offsetX; this.control.y = e.offsetY; this._elem.addEventListener('mousemove', this.onMouseMove.bind(this)); this._elem.addEventListener('mouseup', this.onMouseUp.bind(this)); window.addEventListener('mousemove', this.onMouseMove.bind(this)); window.addEventListener('mouseup', this.onMouseUp.bind(this)); this.setPosition(this.control.x, this.control.y); }; NgFxDraggableDirective.prototype.onTouchMove = function (e) { e.preventDefault(); this._handle.style.opacity = '0.8'; if (this._touchItem === null) { this._touchItem = e.touches.length - 1; } this.control.x = e.touches[this._touchItem].pageX - this._rect.left - 22; this.control.y = e.touches[this._touchItem].pageY - this._rect.top - 66; this.setPosition(this.control.x, this.control.y); if (this.control.orient === 'is--hor') { this.control.currentValue = this.scale(this.control.x, 0, this.control.width - 44, (this.control.min), (this.control.max)); } else if (this.control.orient === 'is--vert') { this.control.currentValue = this.scale(this.control.y, 0, this.control.height - 44, (this.control.min), (this.control.max)); } else if (this.control.orient === 'is--joystick') { this.control.currentValue = [ this.scale(this.control.x, 0, this.control.width - 44, this.control.min[0], this.control.max[0]), this.scale(this.control.y, 0, this.control.height - 44, this.control.min[1], this.control.max[1]) ]; } this.control.timeStamp = e.timeStamp; this.onEvent(); }; NgFxDraggableDirective.prototype.onMouseMove = function (e) { var parent = (((e.target)).parentNode); if (!this.control.isActive) { return; } if (this.control.isActive && parent === this._elem) { this._handle.style.opacity = '0.8'; this.control.x = e.offsetX; this.control.y = e.offsetY; } else { this._handle.style.opacity = '0.8'; this.control.x = (this._elem.getBoundingClientRect().left - e.offsetX) * -1; this.control.y = (this._elem.getBoundingClientRect().top - e.offsetY) * -1; } if (this.control.hasUserInput && this.control.isActive) { this.setPosition(this.control.x, this.control.y); if (this.control.orient === 'is--hor') { this.control.currentValue = this.scale(this.control.x, 0, this.control.width - 44, (this.control.min), (this.control.max)); } if (this.control.orient === 'is--vert') { this.control.currentValue = this.scale(this.control.y, 0, this.control.height - 44, (this.control.min), (this.control.max)); } if (this.control.orient === 'is--joystick') { this.control.currentValue = [ this.scale(this.control.x, 0, this.control.width - 44, this.control.min[0], this.control.max[0]), this.scale(this.control.y, 0, this.control.height - 44, this.control.min[1], this.control.max[1]) ]; } this.control.timeStamp = e.timeStamp; this.onEvent(); } }; NgFxDraggableDirective.prototype.onMouseUp = function (e) { this.control.isActive = false; this.control.hasUserInput = false; this._handle.style.opacity = '0.3'; if ('ontouchstart' in document.documentElement) { this._touchItem = null; } else { this._elem.removeEventListener('mousemove', this.onMouseMove.bind(this)); this._elem.removeEventListener('mouseup', this.onMouseUp.bind(this)); } if (this.control.orient === 'is--joystick' && this.control.snapToCenter === true) { var center = this.getCenter([0, this.control.width - this._handle.offsetWidth], [0, this.control.height - this._handle.offsetHeight]); this.control.x = center[0]; this.control.y = center[1]; this.setPosition(center[0], center[1]); } }; NgFxDraggableDirective.prototype.onTouchEnd = function (e) { this.onMouseUp(e); }; NgFxDraggableDirective.prototype.onEvent = function () { if (this.control.isActive) { this._controller.onEvent.emit({ type: 'change', endFrame: true, control: this.control }); } }; NgFxDraggableDirective.prototype.getCenter = function (xRange, yRange) { var cX = xRange[1] - (xRange[1] - xRange[0]) / 2; var cY = yRange[1] - (yRange[1] - yRange[0]) / 2; return [cX, cY]; }; NgFxDraggableDirective.prototype.distance = function (dot1, dot2) { var x1 = dot1[0]; var y1 = dot1[1]; var x2 = dot2[0]; var y2 = dot2[1]; return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); }; NgFxDraggableDirective.prototype.scale = function (v, min, max, gmin, gmax) { return ((v - min) / (max - min)) * (gmax - gmin) + gmin; }; NgFxDraggableDirective.prototype.circularBounds = function (x, y, xRange, yRange) { var center = this.getCenter(xRange, yRange); var dist = this.distance([x, y], center); var radius = xRange[1] - center[0]; if (dist <= radius) { return [x, y]; } else { x = x - center[0]; y = y - center[1]; var radians = Math.atan2(y, x); return [Math.cos(radians) * radius + center[0], Math.sin(radians) * radius + center[1]]; } }; NgFxDraggableDirective.prototype.clamp = function (value, range) { return Math.max(Math.min(value, range[1]), range[0]); }; NgFxDraggableDirective.prototype.setActualPosition = function (pos) { var transformRegex = new RegExp(/(\d+(\.\d+)?)/g); var positions = pos.match(transformRegex); this._handle.style.transform = 'matrix3d(1,0,0.00,0,0.00,1,0.00,0,0,0,1,0,' + positions[0] + ',' + positions[1] + ',0,1)'; }; NgFxDraggableDirective.prototype.setPosition = function (x, y) { if (this.control.orient === 'is--joystick') { this._joystickPos = this.circularBounds(this.control.x, this.control.y, [0, this.control.width - this._handle.offsetWidth], [0, this.control.height - this._handle.offsetHeight]); this.control.x = this.clamp(this._joystickPos[0], [0, this.control.width - this._handle.offsetWidth]); this.control.y = this.clamp(this._joystickPos[1], [0, this.control.height - this._handle.offsetHeight]); this.control.position = 'translate(' + this.control.x + 'px' + ',' + this.control.y + 'px' + ')'; this.setActualPosition(this.control.position); } else { if (x <= 0) { this.control.x = 0; } else if (x > this._elem.clientWidth - this._handle.offsetWidth) { this.control.x = this._elem.clientWidth - this._handle.offsetWidth; } else { this.control.x = x; } if (y <= 0) { this.control.y = 0; } else if (y > this._elem.clientHeight - this._handle.offsetHeight) { this.control.y = this._elem.clientHeight - this._handle.offsetHeight; } else { this.control.y = y; } this.control.position = 'translate(' + this.control.x + 'px' + ',' + this.control.y + 'px' + ')'; this.setActualPosition(this.control.position); } }; NgFxDraggableDirective.decorators = [ { type: core.Directive, args: [{ selector: '[ngfxDraggable]' },] }, ]; NgFxDraggableDirective.ctorParameters = function () { return [ { type: core.ElementRef }, { type: NgFxController } ]; }; NgFxDraggableDirective.propDecorators = { control: [{ type: core.Input, args: ['control',] }], onMouseLeave: [{ type: core.HostListener, args: ['mouseleave', ['$event'],] }], onMouseEnter: [{ type: core.HostListener, args: ['mouseenter', ['$event'],] }], onTouchStart: [{ type: core.HostListener, args: ['touchstart', ['$event'],] }], onMouseDown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }], onMouseUp: [{ type: core.HostListener, args: ['mouseup', ['$event'],] }], onTouchEnd: [{ type: core.HostListener, args: ['touchend', ['$event'],] }] }; return NgFxDraggableDirective; }()); var NgFxSliderComponent = (function () { function NgFxSliderComponent(_sanitizer) { this._sanitizer = _sanitizer; } Object.defineProperty(NgFxSliderComponent.prototype, "transform", { get: function () { return this.sanitize(this.control.transform) || this.sanitize(''); }, enumerable: true, configurable: true }); Object.defineProperty(NgFxSliderComponent.prototype, "gridArea", { get: function () { return this.sanitize(this.control.gridArea) || this.sanitize(''); }, enumerable: true, configurable: true }); Object.defineProperty(NgFxSliderComponent.prototype, "placeSelf", { get: function () { return this.sanitize(this.control.placeSelf) || this.sanitize(''); }, enumerable: true, configurable: true }); NgFxSliderComponent.prototype.hasName = function () { return this.control.name !== undefined && this.control.name.length > 0; }; NgFxSliderComponent.prototype.sanitize = function (style) { return this._sanitizer.bypassSecurityTrustStyle(style); }; NgFxSliderComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngfx-slider, [ngfx-slider]', template: "<div class=\"ngfx__slider\" [ngClass]=\"{\'is--hor\' : control.orient === \'is--hor\',\n \'is--vert\' : control.orient === \'is--vert\',\n \'is--joystick\' : control.orient === \'is--joystick\'}\"><div class=\"ngfx__title\" [hidden]=\"!hasName()\"><span class=\"control__name\">{{control.name.charAt(0).toUpperCase()}}</span> <span class=\"slave__indicator\" [ngClass]=\"{\'is--visible\': control.hasRemoteInput === true }\"></span></div><div class=\"ngfx__draggable\" ngfxDraggable [control]=\"control\" [ngClass]=\"{\'is--active\': control.hasUserInput === true }\"><div class=\"ngfx__range\"><div class=\"ngfx__handle\"></div></div></div></div>", styles: ["/**\n * Convert font-size from px to rem with px fallback\n *\n * @param $size - the value in pixel you want to convert\n *\n * e.g. p {@include fontSize(12px);}\n *\n */\n:host {\n display: block;\n}\n\n:host:after {\n content: \'\';\n display: table;\n clear: both;\n}\n\n:host .ngfx__slider .ngfx__title {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n}\n\n:host .ngfx__slider .ngfx__title .control__name {\n color: rgba(255, 255, 255, 0.3);\n font-size: 12px;\n font-weight: 700;\n}\n\n:host .ngfx__slider .ngfx__title .slave__indicator {\n width: 8px;\n height: 8px;\n border-radius: 50% 50%;\n background: rgba(255, 255, 255, 0.5);\n -webkit-transform: translateX(4px) translateY(3px);\n transform: translateX(4px) translateY(3px);\n display: none;\n}\n\n:host .ngfx__slider .ngfx__title .slave__indicator.is--visible {\n display: block;\n}\n\n:host .ngfx__slider .ngfx__draggable {\n display: block;\n z-index: 1000;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 12px;\n -webkit-transform: translateY(8px);\n transform: translateY(8px);\n}\n\n:host .ngfx__slider .ngfx__draggable.is--active {\n background: rgba(255, 255, 255, 0.1);\n border: 2px solid rgba(255, 255, 255, 0.5);\n}\n\n:host .ngfx__slider .ngfx__draggable .ngfx__range {\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n:host .ngfx__slider .ngfx__draggable .ngfx__handle {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n background: url(\"data:image/svg+xml;charset=UTF-8,%3c?xml version=\'1.0\' encoding=\'utf-8\'?%3e%3c!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3e%3csvg version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' x=\'0px\' y=\'0px\' viewBox=\'0 0 512 512\' style=\'enable-background:new 0 0 512 512;\' xml:space=\'preserve\'%3e%3cstyle type=\'text/css\'%3e .st0%7bfill:none;stroke:%23FFFFFF;stroke-width:8;stroke-miterlimit:10;%7d .st1%7bdisplay:none;%7d .st2%7bdisplay:inline;fill:none;stroke:%23FFFFFF;stroke-width:8;stroke-miterlimit:10;%7d %3c/style%3e%3cg id=\'Layer_1\'%3e%3ccircle class=\'st0\' cx=\'256\' cy=\'256\' r=\'245.2\'/%3e%3c/g%3e%3cg id=\'Layer_2\' class=\'st1\'%3e%3cline class=\'st2\' x1=\'256\' y1=\'3.7\' x2=\'256\' y2=\'508.3\'/%3e%3c/g%3e%3cg id=\'Layer_3\' class=\'st1\'%3e%3cline class=\'st2\' x1=\'508.3\' y1=\'256\' x2=\'3.7\' y2=\'256\'/%3e%3c/g%3e%3c/svg%3e\");\n background-repeat: no-repeat;\n transition: -webkit-transform 0.175;\n transition: transform 0.175;\n transition: transform 0.175, -webkit-transform 0.175;\n pointer-events: none;\n opacity: 0.3;\n}\n\n:host .ngfx__slider.is--hor {\n width: 200px;\n height: 32px;\n}\n\n:host .ngfx__slider.is--hor .ngfx__draggable {\n width: 200px;\n height: 32px;\n border-radius: 14px;\n cursor: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACEUlEQVRYhe2Z646CMBBGTwusl/d/VnUV6P6Yjq0V5KJISfZLSCMBPYxfp2XGOOd4QwYo/GH9YZJrHND6o/HH7B8t37iv8qNCKkQKY6JR4Wvg5sdJMhMjXAI7Pxr/41OjZQgPUQO/TAAfC2yAAxJVENBPyPrxBlzGfO8Y4AqBtYj/llCBwJ4R+F4NAf8gsPC5qPZJo31BbPLyoi7tgCNhoiwtnQ8HYN93UR+wRnbOpHpHDrHdHgnYk7qASySy34aN1SIBe0q7KbAh2GAtWAg2PJIsRCnw3p/7hmeH5BCWQ3wyBi4R7y6VuuaoIayowCNwp8kz0Z1NgQvkKXKwQqoWYSshAP+shjNeFQTgknWzwpAcfsNlCVvE3IEtUFjEv1tRoW8JW9HmgE36epOzHB54U/oHXlqaf9NaQo4ygMtlKzlWmwNulnx1X0KNRaouLXn7WKtMjWaJmvyBa7yHAa4rwozVDUIebpAnyDEvq21r/aDqLQ+tLEPEFgPXiDVy2h8XCNO9HJtaQEueOUxA3UVe4pMpsANOdJf+vynjGU4kC1vXJKuROu2aE9DSUyvu63GoydeoYBa8qBG/asroDXvCSrOk1AZnXmSsXFoGus29MLCIjW3KWCTSm2jKxKqQspZaaU4dOW17XRloxDzcPLMTmjYWY3V9YZwitbGozcVJmgscgyh0wWP0VPovNIT27WxL/QG7cp5Q+WnBUwAAAABJRU5ErkJggg==\") 22 22, pointer;\n}\n\n:host .ngfx__slider.is--hor .ngfx__draggable .ngfx__handle {\n background: url(\"data:image/svg+xml;charset=UTF-8,%3c?xml version=\'1.0\' encoding=\'utf-8\'?%3e%3c!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3e%3csvg version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' x=\'0px\' y=\'0px\' viewBox=\'0 0 512 512\' style=\'enable-background:new 0 0 512 512;\' xml:space=\'preserve\'%3e%3cstyle type=\'text/css\'%3e .st0%7bdisplay:none;%7d .st1%7bdisplay:inline;fill:none;stroke:%23FFFFFF;stroke-width:8;stroke-miterlimit:10;%7d .st2%7bfill:none;stroke:%23FFFFFF;stroke-width:8;stroke-miterlimit:10;%7d %3c/style%3e%3cg id=\'Layer_1\' class=\'st0\'%3e%3ccircle class=\'st1\' cx=\'256\' cy=\'256\' r=\'245.2\'/%3e%3c/g%3e%3cg id=\'Layer_2\'%3e%3cline class=\'st2\' x1=\'256\' y1=\'3.7\' x2=\'256\' y2=\'508.3\'/%3e%3c/g%3e%3cg id=\'Layer_3\' class=\'st0\'%3e%3cline class=\'st1\' x1=\'508.3\' y1=\'256\' x2=\'3.7\' y2=\'256\'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 44px 32px;\n background-position: 50% 0px;\n}\n\n:host .ngfx__slider.is--vert {\n width: 32px;\n height: 200px;\n}\n\n:host .ngfx__slider.is--vert .ngfx__draggable {\n width: 32px;\n height: 200px;\n border-radius: 14px;\n cursor: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACEUlEQVRYhe2Z646CMBBGTwusl/d/VnUV6P6Yjq0V5KJISfZLSCMBPYxfp2XGOOd4QwYo/GH9YZJrHND6o/HH7B8t37iv8qNCKkQKY6JR4Wvg5sdJMhMjXAI7Pxr/41OjZQgPUQO/TAAfC2yAAxJVENBPyPrxBlzGfO8Y4AqBtYj/llCBwJ4R+F4NAf8gsPC5qPZJo31BbPLyoi7tgCNhoiwtnQ8HYN93UR+wRnbOpHpHDrHdHgnYk7qASySy34aN1SIBe0q7KbAh2GAtWAg2PJIsRCnw3p/7hmeH5BCWQ3wyBi4R7y6VuuaoIayowCNwp8kz0Z1NgQvkKXKwQqoWYSshAP+shjNeFQTgknWzwpAcfsNlCVvE3IEtUFjEv1tRoW8JW9HmgE36epOzHB54U/oHXlqaf9NaQo4ygMtlKzlWmwNulnx1X0KNRaouLXn7WKtMjWaJmvyBa7yHAa4rwozVDUIebpAnyDEvq21r/aDqLQ+tLEPEFgPXiDVy2h8XCNO9HJtaQEueOUxA3UVe4pMpsANOdJf+vynjGU4kC1vXJKuROu2aE9DSUyvu63GoydeoYBa8qBG/asroDXvCSrOk1AZnXmSsXFoGus29MLCIjW3KWCTSm2jKxKqQspZaaU4dOW17XRloxDzcPLMTmjYWY3V9YZwitbGozcVJmgscgyh0wWP0VPovNIT27WxL/QG7cp5Q+WnBUwAAAABJRU5ErkJggg==\") 22 0, pointer;\n}\n\n:host .ngfx__slider.is--vert .ngfx__draggable .ngfx__handle {\n background: url(\"data:image/svg+xml;charset=UTF-8,%3c?xml version=\'1.0\' encoding=\'utf-8\'?%3e%3c!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3e%3csvg version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' x=\'0px\' y=\'0px\' viewBox=\'0 0 512 512\' style=\'enable-background:new 0 0 512 512;\' xml:space=\'preserve\'%3e%3cstyle type=\'text/css\'%3e .st0%7bdisplay:none;%7d .st1%7bdisplay:inline;fill:none;stroke:%23FFFFFF;stroke-width:8;stroke-miterlimit:10;%7d .st2%7bfill:none;stroke:%23FFFFFF;stroke-width:8;stroke-miterlimit:10;%7d %3c/style%3e%3cg id=\'Layer_1\' class=\'st0\'%3e%3ccircle class=\'st1\' cx=\'256\' cy=\'256\' r=\'245.2\'/%3e%3c/g%3e%3cg id=\'Layer_2\' class=\'st0\'%3e%3cline class=\'st1\' x1=\'256\' y1=\'3.7\' x2=\'256\' y2=\'508.3\'/%3e%3c/g%3e%3cg id=\'Layer_3\'%3e%3cline class=\'st2\' x1=\'508.3\' y1=\'256\' x2=\'3.7\' y2=\'256\'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 32px 44px;\n background-position: 0px 50%;\n}\n\n:host .ngfx__slider.is--joystick {\n width: 200px;\n height: auto;\n}\n\n:host .ngfx__slider.is--joystick .ngfx__draggable {\n width: 200px;\n height: 200px;\n border-radius: 50%;\n cursor: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACEUlEQVRYhe2Z646CMBBGTwusl/d/VnUV6P6Yjq0V5KJISfZLSCMBPYxfp2XGOOd4QwYo/GH9YZJrHND6o/HH7B8t37iv8qNCKkQKY6JR4Wvg5sdJMhMjXAI7Pxr/41OjZQgPUQO/TAAfC2yAAxJVENBPyPrxBlzGfO8Y4AqBtYj/llCBwJ4R+F4NAf8gsPC5qPZJo31BbPLyoi7tgCNhoiwtnQ8HYN93UR+wRnbOpHpHDrHdHgnYk7qASySy34aN1SIBe0q7KbAh2GAtWAg2PJIsRCnw3p/7hmeH5BCWQ3wyBi4R7y6VuuaoIayowCNwp8kz0Z1NgQvkKXKwQqoWYSshAP+shjNeFQTgknWzwpAcfsNlCVvE3IEtUFjEv1tRoW8JW9HmgE36epOzHB54U/oHXlqaf9NaQo4ygMtlKzlWmwNulnx1X0KNRaouLXn7WKtMjWaJmvyBa7yHAa4rwozVDUIebpAnyDEvq21r/aDqLQ+tLEPEFgPXiDVy2h8XCNO9HJtaQEueOUxA3UVe4pMpsANOdJf+vynjGU4kC1vXJKuROu2aE9DSUyvu63GoydeoYBa8qBG/asroDXvCSrOk1AZnXmSsXFoGus29MLCIjW3KWCTSm2jKxKqQspZaaU4dOW17XRloxDzcPLMTmjYWY3V9YZwitbGozcVJmgscgyh0wWP0VPovNIT27WxL/QG7cp5Q+WnBUwAAAABJRU5ErkJggg==\") 0 0, pointer;\n}\n\n:host .ngfx__slider.is--joystick .ngfx__draggable .ngfx__handle {\n position: absolute;\n background-size: 44px 44px;\n width: 44px;\n height: 44px;\n}\n"] },] }, ]; NgFxSliderComponent.ctorParameters = function () { return [ { type: platformBrowser.DomSanitizer } ]; }; NgFxSliderComponent.propDecorators = { control: [{ type: core.Input, args: ['control',] }], draggable: [{ type: core.ViewChild, args: [NgFxDraggableDirective,] }], transform: [{ type: core.HostBinding, args: ['style.transform',] }], gridArea: [{ type: core.HostBinding, args: ['style.grid-area',] }], placeSelf: [{ type: core.HostBinding, args: ['style.place-self',] }] }; return NgFxSliderComponent; }()); var NgFxSliderModule = (function () { function NgFxSliderModule() { } NgFxSliderModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule], declarations: [NgFxDraggableDirective, NgFxSliderComponent], exports: [NgFxDraggableDirective, NgFxSliderComponent] },] }, ]; return NgFxSliderModule; }()); var NgFxSurfaceComponent = (function () { function NgFxSurfaceComponent(_controller, _sanitizer) { this._controller = _controller; this._sanitizer = _sanitizer; this.controlMap = new Array(); } NgFxSurfaceComponent.prototype.ngOnChanges = function (changes) { if (changes["controller"]) { this.controlMap = this.mapToControls(changes["controller"].currentValue); } }; NgFxSurfaceComponent.prototype.mapToControls = function (key) { var _this = this; return Object.keys(this._controller.surfaces[key].controls).map(function (prop) { return _this._controller.surfaces[key].controls[prop]; }); }; NgFxSurfaceComponent.prototype.sanitize = function (style) { return this._sanitizer.bypassSecurityTrustStyle(style); }; NgFxSurfaceComponent.prototype.ngOnInit = function () { }; NgFxSurfaceComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngfx-surface, [ngfx-surface]', template: "<div class=\"control__group\" [style.display]=\"sanitize(display)\" [style.grid]=\"sanitize(grid)\" [style.grid-gap]=\"sanitize(gridGap)\"><ng-container *ngFor=\"let control of controlMap\"><ngfx-slider *ngIf=\"control.type === \'slider\'\" [control]=\"control\" class=\"control__pane\"></ngfx-slider><ngfx-button *ngIf=\"control.type === \'button\'\" [control]=\"control\" class=\"control__pane\"></ngfx-button></ng-container></div>", styles: ["/**\n * Convert font-size from px to rem with px fallback\n *\n * @param $size - the value in pixel you want to convert\n *\n * e.g. p {@include fontSize(12px);}\n *\n */\n:host {\n display: block;\n overflow: hidden;\n}\n\n:host:after {\n content: \'\';\n display: table;\n clear: both;\n}\n\n.control__group {\n width: 100%;\n height: 100vh;\n overflow: hidden;\n display: grid;\n}\n\n.control__group:after {\n content: \'\';\n display: table;\n clear: both;\n}\n"] },] }, ]; NgFxSurfaceComponent.ctorParameters = function () { return [ { type: NgFxController }, { type: platformBrowser.DomSanitizer } ]; }; NgFxSurfaceComponent.propDecorators = { controller: [{ type: core.Input, args: ['controller',] }], grid: [{ type: core.Input, args: ['grid',] }], gridGap: [{ type: core.Input, args: ['gridGap',] }], display: [{ type: core.Input, args: ['display',] }] }; return NgFxSurfaceComponent; }()); var NgFxSurfaceModule = (function () { function NgFxSurfaceModule() { } NgFxSurfaceModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule, NgFxSliderModule, NgFxButtonModule], declarations: [NgFxSurfaceComponent], exports: [NgFxSurfaceComponent] },] }, ]; return NgFxSurfaceModule; }()); exports.NgFxController = NgFxController; exports.NgFxButtonModule = NgFxButtonModule; exports.NgFxButtonComponent = NgFxButtonComponent; exports.NgFxSliderModule = NgFxSliderModule; exports.NgFxDraggableDirective = NgFxDraggableDirective; exports.NgFxSliderComponent = NgFxSliderComponent; exports.NgFxSurfaceModule = NgFxSurfaceModule; exports.NgFxSurfaceComponent = NgFxSurfaceComponent; //# sourceMappingURL=ui.umd.js.map