This commit is contained in:
2021-11-09 21:09:46 +03:00
parent 4d54c67eb4
commit 4e9df6c81b
10 changed files with 116 additions and 56 deletions
+18 -13
View File
@@ -100,7 +100,7 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
this.__aminationTrapHide = new AnimationTrap(this.node, function (options) {
if(options.onHideBefore !== false) {
this.onHideBefore.eachCall();
this.onHideBefore.eachCall(window, options);
}
removeAnimation.call(this, this.animShowClass);
addAnimation.call(this, this.animHideClass);
@@ -111,14 +111,14 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
this.node.classList.add('hide');
this.node.classList.remove('show');
if(options.onHide !== false) {
this.onHide.eachCall();
this.onHide.eachCall(window, options);
}
this.node.style.display = 'none';
}.bind(this));
this.__aminationTrapShow = new AnimationTrap(this.node, function (options = {}) {
if(options.onShowBefore !== false) {
this.onShowBefore.eachCall();
this.onShowBefore.eachCall(window, options);
}
this.node.classList.remove('hide');
this.node.classList.add('show');
@@ -132,7 +132,7 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
removeAnimation.call(this, this.animHideClass);
addAnimation.call(this, this.animShowClass);
if(options.onShow !== false) {
this.onShow.eachCall();
this.onShow.eachCall(window, options);
}
}.bind(this), function (options = {}) {
@@ -149,8 +149,8 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
var proto = Viewer.prototype;
proto.show = function(options = {}){
if(this.isShown()) {
//console.log('viewer show', this.node.kit.menu.id, options);
if(this.isShown() && !options.force) {
return;
}
@@ -162,7 +162,8 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
};
proto.hide = function(options = {}){
if(this.isHidden()) {
//console.log('viewer hide', this.node.kit.menu.id);
if(this.isHidden() && !options.force) {
return;
}
@@ -198,12 +199,16 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
return !this.isHidden();
};
proto.isHidden = function(){
var result = this.node.classList.contains('hide');
result = result || getComputedStyle(this.node).display === 'none';
if(this.masterNode && this.activeMasterClass) {
result = result || !this.masterNode.classList.contains(this.activeMasterClass);
}
return result || this.__aminationTrapHide.active || this.__deferredHideID;
return this.__aminationTrapHide.active || this.__deferredHideID || this.node.classList.contains('hide') ||
(getComputedStyle(this.node).display === 'none') ||
(this.masterNode && this.activeMasterClass && !this.masterNode.classList.contains(this.activeMasterClass));
// var result = this.node.classList.contains('hide');
// result = result || getComputedStyle(this.node).display === 'none';
// if(this.masterNode && this.activeMasterClass) {
// result = result || !this.masterNode.classList.contains(this.activeMasterClass);
// }
// return result || this.__aminationTrapHide.active || this.__deferredHideID;
};
proto.stop = function () {
this.__aminationTrapHide.stop();