This commit is contained in:
2022-05-30 17:50:04 +03:00
parent 2a6f01f460
commit a44faad823
26 changed files with 772 additions and 393 deletions
+31 -1
View File
@@ -59,6 +59,12 @@ kit.PluginManager.register('Tooltip2',function(module, exports, require, global)
if(!support.isElement(this.hintNode)){
console.warn('Tooltip2: masterNode not valid', this.hintNode);
}
if(!support.getNodeData(this.masterNode, PLUGIN_NAME)){
support.setNodeData(this.masterNode, PLUGIN_NAME, this);
support.data.set(this.masterNode, PLUGIN_NAME, 'loaded');
}
this.hintNode.remove();
this.masterNode.appendChild(this.hintNode);
//support.setNodeData(this.masterNode, PLUGIN_NAME, this);
@@ -67,7 +73,25 @@ kit.PluginManager.register('Tooltip2',function(module, exports, require, global)
this.setContent(this.options.content);
}
this.align = new align.Class(this.hintNode, this.masterNode);
var limiter = window;
var chain = support.node.getChainOfParentsWithNode(this.masterNode);
chain.every(function(node, i){
if(node === document.body || node.tagName === 'HTML' || node === document){
limiter = window;
return false;
}
limiter = node;
var style = getComputedStyle(node);
var overflowX = style.overflowX;
var overflowY = style.overflowY;
if(!(overflowX === 'visible' || overflowX === 'auto') || !(overflowY === 'visible' || overflowY === 'auto')){
return false;
}
return true;
});
this.align = new align.Class(this.hintNode, this.masterNode, limiter);
var hint = new userAction.Hint(this.masterNode, this.hintNode);
this.viewer = hint.viewer;
this.viewer.delayHide = 400;
@@ -117,6 +141,12 @@ kit.PluginManager.register('Tooltip2',function(module, exports, require, global)
this.__setOffset();
this.align.set(this.options.hAlign, this.options.vAlign, this.options.hDirection, this.options.vDirection);
}
};
__proto.show = function(){
this.viewer.show();
};
__proto.hide = function(){
};
/**
* @param options {Tooltip2Default}