|
@@ -552,77 +552,86 @@ const billsGuidance = (function () {
|
|
|
if(sheet && sheet.getParent().qo){
|
|
|
setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
|
|
|
}
|
|
|
- if (setting.pos && text && text !== '') {
|
|
|
- //固定不显示的div,存储文本获取固定div宽度,toolTipElement由于显示和隐藏,获取宽度不正确
|
|
|
- if(!this._fixedTipElement){
|
|
|
- let div = $('#fixedTip1')[0];
|
|
|
- if (!div) {
|
|
|
- div = document.createElement("div");
|
|
|
- $(div).css("padding", 5)
|
|
|
- .attr("id", 'fixedTip');
|
|
|
- $(div).hide();
|
|
|
- document.body.insertBefore(div, null);
|
|
|
- }
|
|
|
- this._fixedTipElement = div;
|
|
|
- }
|
|
|
- $(this._fixedTipElement).width('');
|
|
|
- $(this._fixedTipElement).html(text);
|
|
|
- if (!this._toolTipElement) {
|
|
|
- let div = $('#autoTip1')[0];
|
|
|
- if (!div) {
|
|
|
- div = document.createElement("div");
|
|
|
- $(div).css("position", "absolute")
|
|
|
- .css("border", "1px #C0C0C0 solid")
|
|
|
- .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
|
|
|
- .css("font", "0.9rem Calibri")
|
|
|
- .css("background", "white")
|
|
|
- .css("padding", 5)
|
|
|
- .attr("id", 'autoTip1');
|
|
|
- $(div).hide();
|
|
|
- document.body.insertBefore(div, null);
|
|
|
- }
|
|
|
- this._toolTipElement = div;
|
|
|
- $(this._toolTipElement).width('');
|
|
|
- //实时读取位置信息
|
|
|
- if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
|
|
|
- setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
- }
|
|
|
- $(this._toolTipElement).html(text);
|
|
|
- //定额库定额特殊处理
|
|
|
- if($(hitinfo.sheet.getParent().qo).attr('id') === 'rationSpread'){
|
|
|
- let divWidth = $(this._fixedTipElement).width(),
|
|
|
- divHeight = $(this._fixedTipElement).height();
|
|
|
- if(divWidth > 600){
|
|
|
- divWidth = 590;
|
|
|
- $(this._toolTipElement).width(divWidth);
|
|
|
+ let delayTimes = 500; //延时时间
|
|
|
+ let now_timeStamp = +new Date();
|
|
|
+ this.tipTimeStamp = now_timeStamp;
|
|
|
+ let me = this;
|
|
|
+ setTimeout(function () {
|
|
|
+ if(now_timeStamp - me.tipTimeStamp == 0){//鼠标停下的时候才显示
|
|
|
+ if (setting.pos && text && text !== '') {
|
|
|
+ //固定不显示的div,存储文本获取固定div宽度,toolTipElement由于显示和隐藏,获取宽度不正确
|
|
|
+ if(!me._fixedTipElement){
|
|
|
+ let div = $('#fixedTip1')[0];
|
|
|
+ if (!div) {
|
|
|
+ div = document.createElement("div");
|
|
|
+ $(div).css("padding", 5)
|
|
|
+ .attr("id", 'fixedTip');
|
|
|
+ $(div).hide();
|
|
|
+ document.body.insertBefore(div, null);
|
|
|
+ }
|
|
|
+ me._fixedTipElement = div;
|
|
|
}
|
|
|
- let top = setting.pos.y + hitinfo.y - divHeight < 0 ? 0 : setting.pos.y + hitinfo.cellRect.y - divHeight;
|
|
|
- $(this._toolTipElement).css("top", top).css("left", setting.pos.x - divWidth);
|
|
|
- }
|
|
|
- else{
|
|
|
- $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
- }
|
|
|
- //名称
|
|
|
- if(hitinfo.col === 2){
|
|
|
- let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
|
|
|
- zoom = hitinfo.sheet.zoom();
|
|
|
- let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
|
|
|
- let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
|
|
|
- let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
|
|
|
- if(textLength > cellWidth){
|
|
|
- $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
- $(this._toolTipElement).show("fast");
|
|
|
- ration.tipDiv = 'show';//做个标记
|
|
|
+ $(me._fixedTipElement).width('');
|
|
|
+ $(me._fixedTipElement).html(text);
|
|
|
+ if (!me._toolTipElement) {
|
|
|
+ let div = $('#autoTip1')[0];
|
|
|
+ if (!div) {
|
|
|
+ div = document.createElement("div");
|
|
|
+ $(div).css("position", "absolute")
|
|
|
+ .css("border", "1px #C0C0C0 solid")
|
|
|
+ .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
|
|
|
+ .css("font", "0.9rem Calibri")
|
|
|
+ .css("background", "white")
|
|
|
+ .css("padding", 5)
|
|
|
+ .attr("id", 'autoTip1');
|
|
|
+ $(div).hide();
|
|
|
+ document.body.insertBefore(div, null);
|
|
|
+ }
|
|
|
+ me._toolTipElement = div;
|
|
|
+ $(me._toolTipElement).width('');
|
|
|
+ //实时读取位置信息
|
|
|
+ if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
|
|
|
+ setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
+ }
|
|
|
+ $(me._toolTipElement).html(text);
|
|
|
+ //定额库定额特殊处理
|
|
|
+ if($(hitinfo.sheet.getParent().qo).attr('id') === 'rationSpread'){
|
|
|
+ let divWidth = $(me._fixedTipElement).width(),
|
|
|
+ divHeight = $(me._fixedTipElement).height();
|
|
|
+ if(divWidth > 600){
|
|
|
+ divWidth = 590;
|
|
|
+ $(me._toolTipElement).width(divWidth);
|
|
|
+ }
|
|
|
+ let top = setting.pos.y + hitinfo.y - divHeight < 0 ? 0 : setting.pos.y + hitinfo.cellRect.y - divHeight;
|
|
|
+ $(me._toolTipElement).css("top", top).css("left", setting.pos.x - divWidth);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ $(me._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
+ }
|
|
|
+ //名称
|
|
|
+ if(hitinfo.col === 2){
|
|
|
+ let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
|
|
|
+ zoom = hitinfo.sheet.zoom();
|
|
|
+ let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
|
|
|
+ let textLength = me.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
|
|
|
+ let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
|
|
|
+ if(textLength > cellWidth){
|
|
|
+ $(me._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
+ $(me._toolTipElement).show("fast");
|
|
|
+ ration.tipDiv = 'show';//做个标记
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(me._toolTipElement).show("fast");
|
|
|
+ ration.tipDiv = 'show';//做个标记
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- $(this._toolTipElement).show("fast");
|
|
|
- ration.tipDiv = 'show';//做个标记
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
+ },delayTimes);
|
|
|
};
|
|
|
TipCellType.prototype.processMouseLeave = function (hininfo) {
|
|
|
+ this.tipTimeStamp = +new Date();
|
|
|
ration.tipDiv = 'hide';
|
|
|
if (this._toolTipElement) {
|
|
|
$(this._toolTipElement).hide();
|