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() { ...@@ -3493,12 +3493,27 @@ function DrawingObjects() {
var offsetX = worksheet.cols[worksheet.visibleRange.c1].left - worksheet.cellsLeft; var offsetX = worksheet.cols[worksheet.visibleRange.c1].left - worksheet.cellsLeft;
var offsetY = worksheet.rows[worksheet.visibleRange.r1].top - worksheet.cellsTop; var offsetY = worksheet.rows[worksheet.visibleRange.r1].top - worksheet.cellsTop;
updatedRect.x = worksheet.getCellLeft(updatedRange.c1, 3) - ptToMm(offsetX) - pxToMm(scrollOffset.getX()); var x1 = worksheet.cols[updatedRange.c1].left - offsetX;
updatedRect.y = worksheet.getCellTop(updatedRange.r1, 3) - ptToMm(offsetY) - pxToMm(scrollOffset.getY()); var y1 = worksheet.rows[updatedRange.r1].top - offsetY;
updatedRect.w = worksheet.getCellLeft(updatedRange.c2, 3) - worksheet.getCellLeft(updatedRange.c1, 3); var x2 = worksheet.cols[updatedRange.c2].left - offsetX;
updatedRect.h = worksheet.getCellTop(updatedRange.r2, 3) - worksheet.getCellTop(updatedRange.r1, 3); 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; 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 else
shapeCtx.updatedRect = null; shapeCtx.updatedRect = null;
...@@ -4576,11 +4591,11 @@ function DrawingObjects() { ...@@ -4576,11 +4591,11 @@ function DrawingObjects() {
} }
drawingObject.setGraphicObjectCoords(); drawingObject.setGraphicObjectCoords();
if ( isInit ) if ( isInit ) {
_this.showDrawingObjects(false); _this.showDrawingObjects(false);
_this.sendGraphicObjectProps();
_this.sendGraphicObjectProps(); worksheet.model.workbook.handlers.trigger("asc_onEndAddShape");
worksheet.model.workbook.handlers.trigger("asc_onEndAddShape"); }
if ( lockByDefault ) { if ( lockByDefault ) {
_this.objectLocker.reset(); _this.objectLocker.reset();
...@@ -5334,17 +5349,17 @@ function DrawingObjects() { ...@@ -5334,17 +5349,17 @@ function DrawingObjects() {
function emuToPx(emu) { function emuToPx(emu) {
var tmp = emu * 20 * 96 / 2.54 / 72 / 100 / 1000; var tmp = emu * 20 * 96 / 2.54 / 72 / 100 / 1000;
return Math.floor(tmp); return tmp;
} }
function pxToEmu(px) { function pxToEmu(px) {
var tmp = px * 2.54 * 72 * 100 * 1000 / 20 / 96; var tmp = px * 2.54 * 72 * 100 * 1000 / 20 / 96;
return Math.floor(tmp); return tmp;
} }
function pxToPt(val) { function pxToPt(val) {
var tmp = asc.round(val) * ascCvtRatio(0, 1); var tmp = val * ascCvtRatio(0, 1);
return tmp > 0 ? tmp : 0; return tmp;
} }
function ptToPx(val) { function ptToPx(val) {
......
...@@ -1048,8 +1048,8 @@ function asc_CCellCommentator(currentSheet) { ...@@ -1048,8 +1048,8 @@ function asc_CCellCommentator(currentSheet) {
if ( lastComment ) { if ( lastComment ) {
var lastMetrics = _this.getCellMetrics(lastComment.nCol, lastComment.nRow); var lastMetrics = _this.getCellMetrics(lastComment.nCol, lastComment.nRow);
if ( lastMetrics.result ) { if ( lastMetrics.result ) {
var extraOffset = 1; var extraOffset = _this.pxToPt(1);
_this.overlayCtx.clearRect(_this.pxToPt(lastMetrics.left), _this.pxToPt(lastMetrics.top), _this.pxToPt(lastMetrics.width - extraOffset), _this.pxToPt(lastMetrics.height - extraOffset)); _this.overlayCtx.clearRect(lastMetrics.left, lastMetrics.top, lastMetrics.width - extraOffset, lastMetrics.height - extraOffset);
} }
} }
} }
...@@ -1235,13 +1235,8 @@ function asc_CCellCommentator(currentSheet) { ...@@ -1235,13 +1235,8 @@ function asc_CCellCommentator(currentSheet) {
var comment = _this.asc_findComment(_this.lastSelectedId); var comment = _this.asc_findComment(_this.lastSelectedId);
if ( comment && !comment.asc_getDocumentFlag() && !comment.asc_getSolved() ) { if ( comment && !comment.asc_getDocumentFlag() && !comment.asc_getSolved() ) {
var metrics = _this.getCellMetrics(comment.asc_getCol(), comment.asc_getRow()); var metrics = _this.getCellMetrics(comment.asc_getCol(), comment.asc_getRow());
if (metrics.result) { if (metrics.result)
var x = _this.pxToPt(metrics.left); _this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width, metrics.height);
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);
}
} }
} }
} }
...@@ -1251,8 +1246,8 @@ function asc_CCellCommentator(currentSheet) { ...@@ -1251,8 +1246,8 @@ function asc_CCellCommentator(currentSheet) {
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
_this.pxToPt = function(val) { _this.pxToPt = function(val) {
var tmp = Asc.round(val) * _this.ascCvtRatio(0, 1); var tmp = val * _this.ascCvtRatio(0, 1);
return tmp > 0 ? tmp : 0; return tmp;
} }
_this.ptToPx = function(val) { _this.ptToPx = function(val) {
...@@ -1366,20 +1361,12 @@ asc_CCellCommentator.prototype = { ...@@ -1366,20 +1361,12 @@ asc_CCellCommentator.prototype = {
var metrics = _this.getCellMetrics(col, row); var metrics = _this.getCellMetrics(col, row);
if (metrics.result) { if (metrics.result) {
var extraOffset = _this.pxToPt(1);
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);
_this.overlayCtx.ctx.globalAlpha = 0.2; _this.overlayCtx.ctx.globalAlpha = 0.2;
_this.overlayCtx.beginPath(); _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.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; _this.overlayCtx.ctx.globalAlpha = 1;
} }
} }
......
...@@ -1030,7 +1030,7 @@ ...@@ -1030,7 +1030,7 @@
var ws = this.wsViews[i]; var ws = this.wsViews[i];
if ( !(ws instanceof asc_WSV) ) { if ( !(ws instanceof asc_WSV) ) {
ws = this.wsViews[i] = this._createWorksheetView( wb.getWorksheet(i) ); ws = this.wsViews[i] = this._createWorksheetView( wb.getWorksheet(i) );
ws._prepareComments(); // Вызываем тут, лист точно создан!!! ws._prepareComments();
ws._prepareDrawingObjects(); ws._prepareDrawingObjects();
} }
return ws; return ws;
......
...@@ -986,6 +986,11 @@ ...@@ -986,6 +986,11 @@
this._initConditionalFormatting(); this._initConditionalFormatting();
this._cleanCellsTextMetricsCache(); this._cleanCellsTextMetricsCache();
this._prepareCellTextMetricsCache(this.visibleRange); this._prepareCellTextMetricsCache(this.visibleRange);
// Код перенесён из getWorksheet
//this._prepareComments();
//this._prepareDrawingObjects();
// initializing is completed // initializing is completed
this.handlers.trigger("initialized"); 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