sliders created with min()/max() remember name & listening. fixes #107

This commit is contained in:
Jeff Nusz 2016-10-05 11:49:16 -07:00
parent 1f71271c63
commit 0aec885446
4 changed files with 25 additions and 5 deletions

View File

@ -3443,11 +3443,21 @@ return /******/ (function(modules) { // webpackBootstrap
// Have we defined both boundaries? // Have we defined both boundaries?
if (_common2.default.isNumber(controller.__min) && _common2.default.isNumber(controller.__max)) { if (_common2.default.isNumber(controller.__min) && _common2.default.isNumber(controller.__max)) {
// Well, then lets just replace this with a slider. // Well, then lets just replace this with a slider.
// lets remember if the old controller had a specific name or was listening
var oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
var wasListening = controller.__gui.__listening.indexOf(controller) > -1;
controller.remove(); controller.remove();
return _add(gui, controller.object, controller.property, { var newController = _add(gui, controller.object, controller.property, {
before: controller.__li.nextElementSibling, before: controller.__li.nextElementSibling,
factoryArgs: [controller.__min, controller.__max, controller.__step] factoryArgs: [controller.__min, controller.__max, controller.__step]
}); });
newController.name(oldName);
if (wasListening) newController.listen();
return newController;
} }
return returned; return returned;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -854,8 +854,13 @@ function augmentController(gui, li, controller) {
// Have we defined both boundaries? // Have we defined both boundaries?
if (common.isNumber(controller.__min) && common.isNumber(controller.__max)) { if (common.isNumber(controller.__min) && common.isNumber(controller.__max)) {
// Well, then lets just replace this with a slider. // Well, then lets just replace this with a slider.
// lets remember if the old controller had a specific name or was listening
const oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
const wasListening = controller.__gui.__listening.indexOf(controller) > -1;
controller.remove(); controller.remove();
return add( const newController = add(
gui, gui,
controller.object, controller.object,
controller.property, controller.property,
@ -863,6 +868,11 @@ function augmentController(gui, li, controller) {
before: controller.__li.nextElementSibling, before: controller.__li.nextElementSibling,
factoryArgs: [controller.__min, controller.__max, controller.__step] factoryArgs: [controller.__min, controller.__max, controller.__step]
}); });
newController.name(oldName);
if (wasListening) newController.listen();
return newController;
} }
return returned; return returned;