|
@@ -156,11 +156,11 @@ var TREE_SHEET_HELPER = {
|
|
|
});
|
|
|
},
|
|
|
showTreeData: function (setting, sheet, tree) {
|
|
|
- var indent = 20;
|
|
|
- var halfBoxLength = 5;
|
|
|
- var halfExpandLength = 3;
|
|
|
+ let indent = 20;
|
|
|
+ let halfBoxLength = 5;
|
|
|
+ let halfExpandLength = 3;
|
|
|
|
|
|
- var TreeNodeCellType = function () {
|
|
|
+ let TreeNodeCellType = function () {
|
|
|
};
|
|
|
TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
|
|
|
TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
|
|
@@ -173,7 +173,7 @@ var TREE_SHEET_HELPER = {
|
|
|
ctx.clearRect(x, y, w, h);
|
|
|
}
|
|
|
// ������(x1, y1)���(��, ��), (x2, y2)�յ�(��, ��), ��ɫ
|
|
|
- var drawLine = function (canvas, x1, y1, x2, y2, color) {
|
|
|
+ let drawLine = function (canvas, x1, y1, x2, y2, color) {
|
|
|
ctx.save();
|
|
|
// ����ƫ����
|
|
|
ctx.translate(0.5, 0.5);
|
|
@@ -184,8 +184,8 @@ var TREE_SHEET_HELPER = {
|
|
|
ctx.stroke();
|
|
|
ctx.restore();
|
|
|
};
|
|
|
- var drawExpandBox = function (ctx, x, y, w, h, centerX, centerY, expanded) {
|
|
|
- var rect = {}, h1, h2, offset = 1;
|
|
|
+ let drawExpandBox = function (ctx, x, y, w, h, centerX, centerY, expanded) {
|
|
|
+ let rect = {}, h1, h2, offset = 1;
|
|
|
rect.top = centerY - halfBoxLength;
|
|
|
rect.bottom = centerY + halfBoxLength;
|
|
|
rect.left = centerX - halfBoxLength;
|
|
@@ -221,16 +221,15 @@ var TREE_SHEET_HELPER = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- var node = tree.items[options.row];
|
|
|
- var showTreeLine = true;
|
|
|
+ let node = tree.items[options.row];
|
|
|
+ let showTreeLine = true;
|
|
|
|
|
|
if (!node) { return; }
|
|
|
|
|
|
- var iLevel = node.depth();
|
|
|
- var centerX = Math.floor(x) + node.depth() * indent + indent / 2;
|
|
|
- var x1 = centerX + indent / 2;
|
|
|
- var centerY = Math.floor((y + (y + h)) / 2);
|
|
|
- var y1;
|
|
|
+ let centerX = Math.floor(x) + node.depth() * indent + indent / 2;
|
|
|
+ let x1 = centerX + indent / 2;
|
|
|
+ let centerY = Math.floor((y + (y + h)) / 2);
|
|
|
+ let y1;
|
|
|
// Draw Sibling Line
|
|
|
if (showTreeLine) {
|
|
|
// Draw Horizontal Line
|
|
@@ -280,17 +279,17 @@ var TREE_SHEET_HELPER = {
|
|
|
};
|
|
|
};
|
|
|
TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
|
|
|
- var offset = -1;
|
|
|
- var node = tree.items[hitinfo.row];
|
|
|
+ let offset = -1;
|
|
|
+ let node = tree.items[hitinfo.row];
|
|
|
tree.selected = node;
|
|
|
if (!node || node.children.length === 0) { return; }
|
|
|
- var centerX = hitinfo.cellRect.x + offset + node.depth() * indent + indent / 2;
|
|
|
- var centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
|
|
|
+ let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + indent / 2;
|
|
|
+ let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
|
|
|
|
|
|
if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
|
|
|
node.setExpanded(!node.expanded);
|
|
|
TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
|
|
|
- var iCount = node.posterityCount(), i, child;
|
|
|
+ let iCount = node.posterityCount(), i, child;
|
|
|
for (i = 0; i < iCount; i++) {
|
|
|
child = tree.items[hitinfo.row + i + 1];
|
|
|
hitinfo.sheet.setRowVisible(hitinfo.row + i + 1, child.visible, hitinfo.sheetArea);
|
|
@@ -320,25 +319,28 @@ var TREE_SHEET_HELPER = {
|
|
|
let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
|
|
|
if (setting.pos && text && text !== '') {
|
|
|
if (!this._toolTipElement) {
|
|
|
- var 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);
|
|
|
-
|
|
|
+ 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).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
+ $(this._toolTipElement).show("fast");
|
|
|
}
|
|
|
- $(this._toolTipElement).text(text).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
- $(this._toolTipElement).hide();
|
|
|
- document.body.insertBefore(this._toolTipElement, null);
|
|
|
- $(this._toolTipElement).show("fast");
|
|
|
}
|
|
|
};
|
|
|
TipCellType.prototype.processMouseLeave = function (hitinfo) {
|
|
|
if (this._toolTipElement) {
|
|
|
- document.body.removeChild(this._toolTipElement);
|
|
|
+ $(this._toolTipElement).hide();
|
|
|
this._toolTipElement = null;
|
|
|
}
|
|
|
}
|