tabs: don't reset value when activating active tab (otherwise scrolling is reset to)

This commit is contained in:
jean-emmanuel 2017-07-13 10:45:30 +02:00
parent 1be9cecaa7
commit c4f590ec15
2 changed files with 19 additions and 13 deletions

View file

@ -3,14 +3,15 @@
## 0.19.0
- ui
- general design improved, heavily inspired by [budislavTVP](http://budislavtvp.deviantart.com/) works; color schemes are much simpler and easier to customize (try `--theme light` !)
- general design improved, heavily inspired by [budislavTVP](http://budislavtvp.deviantart.com/) works; color schemes are much simpler and easier to customize (try `--theme light` !); Font changed to Roboto; Texts are slightly thicker and uppercased in most cases for better readability (use css `text-transform:none` to disable the latter).
- widgets
- fader: added `dashed` option; added `input` option;
- meter: added `alignRight` option; added `dashed` option;
- knob: removed `compact` option; added `dashed` option; added `input` option;
- xy/rgb: added `input` option;
- panel: remove inner widgets dark borders
- buttons: new `dropdown` widget
- panel: removed inner widgets dark borders
- buttons: new `dropdown` widget;
- toggle: added `led` option to choose between the old appearance and the new one
- new `input` widget
- editor
- option fields are now multiline (`ctrl + enter` to add a new line), and pretty printed;

View file

@ -59,7 +59,7 @@ module.exports = class Panel extends _widgets_base {
if (this.getProp('tabs') && this.getProp('tabs').length) this.widget.addClass('has-tabs')
this.value = this.getProp('value') || 0
this.value = -1
this.tabs = []
var parsers = require('../../parser'),
@ -93,6 +93,7 @@ module.exports = class Panel extends _widgets_base {
}
this.setValue(this.getProp('value') || 0)
}
@ -175,18 +176,22 @@ module.exports = class Panel extends _widgets_base {
setValue(v, options={}) {
if (this.tabs.length && typeof v == 'number' && v >= 0 && v < this.tabs.length) {
for (let i in this.tabs) {
if (v != this.value) {
for (let i in this.tabs) {
this.tabs[i].hide()
}
this.tabs[v].show()
this.navigation.find('li').removeClass('on').eq(v).addClass('on')
this.value = v
$(window).resize()
this.tabs[i].hide()
}
this.tabs[v].show()
this.navigation.find('li').removeClass('on').eq(v).addClass('on')
this.value = v
$(window).resize()
if (options.send) this.sendValue()
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})