BVB Source Codes

dat.gui Show FunctionController.js Source code

Return Download dat.gui: download FunctionController.js Source code - Download dat.gui Source code - Type:.js
  1. /**
  2.  * dat-gui JavaScript Controller Library
  3.  * http://code.google.com/p/dat-gui
  4.  *
  5.  * Copyright 2011 Data Arts Team, Google Creative Lab
  6.  *
  7.  * Licensed under the Apache License, Version 2.0 (the "License");
  8.  * you may not use this file except in compliance with the License.
  9.  * You may obtain a copy of the License at
  10.  *
  11.  * http://www.apache.org/licenses/LICENSE-2.0
  12.  */
  13.  
  14. import Controller from './Controller';
  15. import dom from '../dom/dom';
  16.  
  17. /**
  18.  * @class Provides a GUI interface to fire a specified method, a property of an object.
  19.  *
  20.  * @extends dat.controllers.Controller
  21.  *
  22.  * @param {Object} object The object to be manipulated
  23.  * @param {string} property The name of the property to be manipulated
  24.  *
  25.  * @member dat.controllers
  26.  */
  27. class FunctionController extends Controller {
  28.   constructor(object, property, text) {
  29.     super(object, property);
  30.  
  31.     const _this = this;
  32.  
  33.     this.__button = document.createElement('div');
  34.     this.__button.innerHTML = text === undefined ? 'Fire' : text;
  35.  
  36.     dom.bind(this.__button, 'click', function(e) {
  37.       e.preventDefault();
  38.       _this.fire();
  39.       return false;
  40.     });
  41.  
  42.     dom.addClass(this.__button, 'button');
  43.  
  44.     this.domElement.appendChild(this.__button);
  45.   }
  46.  
  47.   fire() {
  48.     if (this.__onChange) {
  49.       this.__onChange.call(this);
  50.     }
  51.     this.getValue().call(this.object);
  52.     if (this.__onFinishChange) {
  53.       this.__onFinishChange.call(this, this.getValue());
  54.     }
  55.   }
  56. }
  57.  
  58. export default FunctionController;
  59.  
downloadFunctionController.js Source code - Download dat.gui Source code
Related Source Codes/Software:
tmate - Instant Terminal Sharing ht... 2017-04-16
WNXHuntForCity - City find By Objective - C 2017-04-16
st2 - StackStorm (aka IFTTT for Ops) is event-driven aut... 2017-04-16
css-in-js - React: CSS in JS techniques comparison. 2017-04-16
android-viewflow - A horizontal view scroller library for Android 2017-04-16
capybara-webkit - A Capybara driver for headless WebKit to test Java... 2017-04-16
fullstackpython.com - Full Stack Python source with Pelican, Bootstrap a... 2017-04-16
naxsi - NAXSI is an open-source, high performance, low rul... 2017-04-16
ToGL - Direct3D to OpenGL abstraction layer 2017-04-16
LiveScript - LiveScript is a language which compiles to JavaScr... 2017-04-16
MaterialSearchView - Express it in the library to implement SearchView ... 2017-04-23
ptpython - A better Python REPL 2017-04-23
Laravel-4-Bootstrap-Starter-Site - Laravel 4 Starter Site is a basic blog application... 2017-04-23
official-images - Primary source of truth for the Docker "Official I... 2017-04-23
awesome-chrome-devtools - Awesome tooling and resources in the Chrome DevToo... 2017-04-23
EventStore - The open-source, functional database with Complex ... 2017-04-23
screencat - 2017-04-23
viz.js - A hack to put Graphviz on the web. ... 2017-04-23
JKeyboardPanelSwitch - For resolve the layout conflict when keybord & amp... 2017-04-23
mama2 - Mother plan - all firewood high flame 2017-04-23

 Back to top