|
@@ -58,6 +58,7 @@ let quantityEditObj = {
|
|
|
var ns = GC.Spread.Sheets;
|
|
|
function QuantityEditCellType() {
|
|
|
var init=false;
|
|
|
+ this.clickTime = 0; //点击事件时间戳
|
|
|
}
|
|
|
QuantityEditCellType.prototype = new ns.CellTypes.Text();
|
|
|
QuantityEditCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
|
|
@@ -96,20 +97,33 @@ let quantityEditObj = {
|
|
|
sheetArea: context.sheetArea
|
|
|
};
|
|
|
};
|
|
|
+
|
|
|
+ //2018 -09 -26 修改工程量这个输入控件,删除悬浮提示注释,还原时通过git 历史
|
|
|
+
|
|
|
QuantityEditCellType.prototype.processMouseDown = function (hitinfo) {
|
|
|
- var me=quantityEditObj;
|
|
|
+ let me=quantityEditObj;
|
|
|
+ if(isDoubleClick(this) == true && !projectReadOnly){//如果是双击,直接显示
|
|
|
+ me.showSelectModal(hitinfo);
|
|
|
+ return ;
|
|
|
+ }
|
|
|
if(me.editingCell && hitinfo.row==me.editingCell.row){
|
|
|
- var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
|
|
|
- var imageMagin=3;
|
|
|
- var imageHeight = hitinfo.cellRect.height-2*imageMagin;
|
|
|
- var imageWidth = hitinfo.cellRect.width*2/7;
|
|
|
- if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
|
|
|
- if(!projectReadOnly){
|
|
|
- me.showSelectModal(hitinfo);
|
|
|
- }
|
|
|
- }else {//点击其它地方,按钮消失
|
|
|
+ if(me.editingCell.isBtn == false){//是第一次点击,刷新显示按钮
|
|
|
+ me.editingCell.isBtn = true;
|
|
|
+ hitinfo.sheet.invalidateLayout();
|
|
|
+ hitinfo.sheet.repaint();
|
|
|
+ }else {
|
|
|
+ var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
|
|
|
+ var imageMagin=3;
|
|
|
+ var imageHeight = hitinfo.cellRect.height-2*imageMagin;
|
|
|
+ var imageWidth = hitinfo.cellRect.width*2/7;
|
|
|
+ if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
|
|
|
+ if(!projectReadOnly){
|
|
|
+ me.showSelectModal(hitinfo);
|
|
|
+ }
|
|
|
+ }/*else {//点击其它地方,按钮消失
|
|
|
hideButton(hitinfo)
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
QuantityEditCellType.prototype.processMouseEnter = function (hitinfo) {
|
|
@@ -118,60 +132,17 @@ let quantityEditObj = {
|
|
|
if(me.editingCell==null){
|
|
|
me.editingCell={
|
|
|
row:hitinfo.row,
|
|
|
- col:hitinfo.col
|
|
|
+ col:hitinfo.col,
|
|
|
+ isBtn :false//鼠标刚进入的时候按钮还是没显示的状态
|
|
|
}
|
|
|
- hitinfo.sheet.invalidateLayout();
|
|
|
- hitinfo.sheet.repaint();
|
|
|
- }
|
|
|
- //取消悬浮提示
|
|
|
- /* let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
|
|
|
- let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
|
|
|
- let dataField = "quantity";
|
|
|
-
|
|
|
- if(hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){
|
|
|
- return;
|
|
|
- }
|
|
|
- if(dataField=="quantity"){
|
|
|
- text = tag;
|
|
|
- }else if(tag !== undefined && tag) {
|
|
|
- text = tag;
|
|
|
+ // hitinfo.sheet.invalidateLayout();
|
|
|
+ //hitinfo.sheet.repaint();
|
|
|
}
|
|
|
- if (text && text !== '') {
|
|
|
- if (!this._toolTipElement) {
|
|
|
- let div = $('#autoTip')[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", "9pt Arial")
|
|
|
- .css("background", "white")
|
|
|
- .css("padding", 5)
|
|
|
- .attr("id", 'autoTip');
|
|
|
- $(div).hide();
|
|
|
- document.body.insertBefore(div, null);
|
|
|
- }
|
|
|
- this._toolTipElement = div;
|
|
|
- $(this._toolTipElement).text(text);
|
|
|
- let cellRect = hitinfo.sheet.getCellRect(hitinfo.row,hitinfo.col);
|
|
|
- $(this._toolTipElement).css("top", cellRect.y+$('#main').offset().top+cellRect.height).css("left", hitinfo.x );//
|
|
|
-
|
|
|
- $(this._toolTipElement).show("fast");
|
|
|
- TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
|
|
|
- }
|
|
|
- }*/
|
|
|
};
|
|
|
QuantityEditCellType.prototype.processMouseLeave = function (hitinfo) {
|
|
|
hideButton(hitinfo);
|
|
|
- //延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
|
|
|
-
|
|
|
- /*TREE_SHEET_HELPER.tipDiv = 'hide'; 取消悬浮提示
|
|
|
- if (TREE_SHEET_HELPER._toolTipElement) {
|
|
|
- $(TREE_SHEET_HELPER._toolTipElement).hide();
|
|
|
- TREE_SHEET_HELPER._toolTipElement = null;
|
|
|
- };
|
|
|
- TREE_SHEET_HELPER.tipDivCheck();*/
|
|
|
};
|
|
|
+
|
|
|
function hideButton(hitinfo) {
|
|
|
if(!quantityEditObj.pmLeave){//鼠标进入显示三个点按钮
|
|
|
quantityEditObj.editingCell=null;
|
|
@@ -180,6 +151,19 @@ let quantityEditObj = {
|
|
|
quantityEditObj.pmLeave = true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ function isDoubleClick(quantityCell) {
|
|
|
+ let nowTime = +new Date();
|
|
|
+ if(quantityCell.clickTime !=0){
|
|
|
+ if(nowTime - quantityCell.clickTime < 280) {//判断为双击
|
|
|
+ quantityCell.clickTime = 0;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ quantityCell.clickTime = nowTime;//计录点击时间
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
return new QuantityEditCellType();
|
|
|
},
|
|
|
showSelectModal:function (hitinfo) {
|