mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
sliders created with min()/max() remember name & listening. fixes #107
This commit is contained in:
parent
1f71271c63
commit
0aec885446
@ -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
4
build/dat.gui.min.js
vendored
4
build/dat.gui.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user