Commit cf3789d1 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

- метрики комментариев в pt

- исправлен баг с очисткой канвы при вводе текста в шейп

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53342 954022d7-b5bf-4e40-9824-e11837661b57
parent dd6b2a1c
......@@ -3493,12 +3493,27 @@ function DrawingObjects() {
var offsetX = worksheet.cols[worksheet.visibleRange.c1].left - worksheet.cellsLeft;
var offsetY = worksheet.rows[worksheet.visibleRange.r1].top - worksheet.cellsTop;
updatedRect.x = worksheet.getCellLeft(updatedRange.c1, 3) - ptToMm(offsetX) - pxToMm(scrollOffset.getX());
updatedRect.y = worksheet.getCellTop(updatedRange.r1, 3) - ptToMm(offsetY) - pxToMm(scrollOffset.getY());
updatedRect.w = worksheet.getCellLeft(updatedRange.c2, 3) - worksheet.getCellLeft(updatedRange.c1, 3);
updatedRect.h = worksheet.getCellTop(updatedRange.r2, 3) - worksheet.getCellTop(updatedRange.r1, 3);
var x1 = worksheet.cols[updatedRange.c1].left - offsetX;
var y1 = worksheet.rows[updatedRange.r1].top - offsetY;
var x2 = worksheet.cols[updatedRange.c2].left - offsetX;
var y2 = worksheet.rows[updatedRange.r2].top - offsetY;
var w = x2 - x1;
var h = y2 - y1;
updatedRect.x = ptToMm(x1) - pxToMm(scrollOffset.getX());
updatedRect.y = ptToMm(y1) - pxToMm(scrollOffset.getY());
updatedRect.w = ptToMm(w);
updatedRect.h = ptToMm(h);
shapeCtx.updatedRect = updatedRect;
if ( graphicOption.type === c_oAscGraphicOption.AddText ) {
drawingCtx.clearRect( x1, y1, w, h );
drawingCtx.setFillStyle(worksheet.settings.cells.defaultState.background).fillRect(x1, y1, w, h);
worksheet._drawGrid(/*drawingCtx*/undefined, updatedRange);
worksheet._drawCells(/*drawingCtx*/undefined, updatedRange);
worksheet._drawCellsBorders(/*drawingCtx*/undefined, updatedRange);
}
}
else
shapeCtx.updatedRect = null;
......@@ -4576,11 +4591,11 @@ function DrawingObjects() {
}
drawingObject.setGraphicObjectCoords();
if ( isInit )
if ( isInit ) {
_this.showDrawingObjects(false);
_this.sendGraphicObjectProps();
worksheet.model.workbook.handlers.trigger("asc_onEndAddShape");
_this.sendGraphicObjectProps();
worksheet.model.workbook.handlers.trigger("asc_onEndAddShape");
}
if ( lockByDefault ) {
_this.objectLocker.reset();
......@@ -5334,17 +5349,17 @@ function DrawingObjects() {
function emuToPx(emu) {
var tmp = emu * 20 * 96 / 2.54 / 72 / 100 / 1000;
return Math.floor(tmp);
return tmp;
}
function pxToEmu(px) {
var tmp = px * 2.54 * 72 * 100 * 1000 / 20 / 96;
return Math.floor(tmp);
return tmp;
}
function pxToPt(val) {
var tmp = asc.round(val) * ascCvtRatio(0, 1);
return tmp > 0 ? tmp : 0;
var tmp = val * ascCvtRatio(0, 1);
return tmp;
}
function ptToPx(val) {
......
......@@ -1048,8 +1048,8 @@ function asc_CCellCommentator(currentSheet) {
if ( lastComment ) {
var lastMetrics = _this.getCellMetrics(lastComment.nCol, lastComment.nRow);
if ( lastMetrics.result ) {
var extraOffset = 1;
_this.overlayCtx.clearRect(_this.pxToPt(lastMetrics.left), _this.pxToPt(lastMetrics.top), _this.pxToPt(lastMetrics.width - extraOffset), _this.pxToPt(lastMetrics.height - extraOffset));
var extraOffset = _this.pxToPt(1);
_this.overlayCtx.clearRect(lastMetrics.left, lastMetrics.top, lastMetrics.width - extraOffset, lastMetrics.height - extraOffset);
}
}
}
......@@ -1235,13 +1235,8 @@ function asc_CCellCommentator(currentSheet) {
var comment = _this.asc_findComment(_this.lastSelectedId);
if ( comment && !comment.asc_getDocumentFlag() && !comment.asc_getSolved() ) {
var metrics = _this.getCellMetrics(comment.asc_getCol(), comment.asc_getRow());
if (metrics.result) {
var x = _this.pxToPt(metrics.left);
var y = _this.pxToPt(metrics.top);
var w = _this.pxToPt(metrics.width);
var h = _this.pxToPt(metrics.height);
_this.overlayCtx.clearRect(x, y, w, h);
}
if (metrics.result)
_this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width, metrics.height);
}
}
}
......@@ -1251,8 +1246,8 @@ function asc_CCellCommentator(currentSheet) {
//-----------------------------------------------------------------------------------
_this.pxToPt = function(val) {
var tmp = Asc.round(val) * _this.ascCvtRatio(0, 1);
return tmp > 0 ? tmp : 0;
var tmp = val * _this.ascCvtRatio(0, 1);
return tmp;
}
_this.ptToPx = function(val) {
......@@ -1366,20 +1361,12 @@ asc_CCellCommentator.prototype = {
var metrics = _this.getCellMetrics(col, row);
if (metrics.result) {
var rangeOffset = 0;
var extraOffset = 1;
var x = _this.pxToPt(metrics.left + rangeOffset);
var y = _this.pxToPt(metrics.top + rangeOffset);
var w = _this.pxToPt(metrics.width - extraOffset - rangeOffset);
var h = _this.pxToPt(metrics.height - extraOffset - rangeOffset);
var extraOffset = _this.pxToPt(1);
_this.overlayCtx.ctx.globalAlpha = 0.2;
_this.overlayCtx.beginPath();
_this.overlayCtx.clearRect(x, y, w, h);
_this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width - extraOffset, metrics.height - extraOffset);
_this.overlayCtx.setFillStyle(_this.commentFillColor);
_this.overlayCtx.fillRect(x, y, w, h);
_this.overlayCtx.fillRect(metrics.left, metrics.top, metrics.width - extraOffset, metrics.height - extraOffset);
_this.overlayCtx.ctx.globalAlpha = 1;
}
}
......
......@@ -1030,7 +1030,7 @@
var ws = this.wsViews[i];
if ( !(ws instanceof asc_WSV) ) {
ws = this.wsViews[i] = this._createWorksheetView( wb.getWorksheet(i) );
ws._prepareComments(); // Вызываем тут, лист точно создан!!!
ws._prepareComments();
ws._prepareDrawingObjects();
}
return ws;
......
......@@ -986,6 +986,11 @@
this._initConditionalFormatting();
this._cleanCellsTextMetricsCache();
this._prepareCellTextMetricsCache(this.visibleRange);
// Код перенесён из getWorksheet
//this._prepareComments();
//this._prepareDrawingObjects();
// initializing is completed
this.handlers.trigger("initialized");
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment