mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Implement Component#visible.
This commit is contained in:
parent
c7970e367d
commit
021ba59c54
2 changed files with 13 additions and 0 deletions
|
@ -149,6 +149,11 @@ var DomElement = new function() {
|
|||
new RegExp('\\s*' + cls + '\\s*'), ' ').trim();
|
||||
},
|
||||
|
||||
toggleClass: function(el, cls, state) {
|
||||
this[state === undefined ? !this.hasClass(el, cls) : state
|
||||
? 'addClass' : 'removeClass'](el, cls);
|
||||
},
|
||||
|
||||
remove: function(el) {
|
||||
if (el.parentNode)
|
||||
el.parentNode.removeChild(el);
|
||||
|
|
|
@ -198,6 +198,14 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
|||
}
|
||||
},
|
||||
|
||||
getVisible: function() {
|
||||
return !DomElement.hasClass(this._element, 'hidden');
|
||||
},
|
||||
|
||||
setVisible: function(visible) {
|
||||
DomElement.toggleClass(this._element, 'hidden', !visible);
|
||||
},
|
||||
|
||||
getRange: function() {
|
||||
return [parseFloat(DomElement.get(this._input, 'min')),
|
||||
parseFloat(DomElement.get(this._input, 'max'))];
|
||||
|
|
Loading…
Reference in a new issue