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

Полная очистка оверлея только при Move State, в остальных выборочно

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48748 954022d7-b5bf-4e40-9824-e11837661b57
parent 9b50fe53
...@@ -1557,6 +1557,8 @@ function DrawingObjects() { ...@@ -1557,6 +1557,8 @@ function DrawingObjects() {
var _this = this; var _this = this;
var asc = window["Asc"]; var asc = window["Asc"];
var api = asc["editor"]; var api = asc["editor"];
var asc_Range = asc.Range;
var chartRender = new ChartRender(); var chartRender = new ChartRender();
var worksheet = null; var worksheet = null;
...@@ -1998,90 +2000,25 @@ function DrawingObjects() { ...@@ -1998,90 +2000,25 @@ function DrawingObjects() {
return trackOverlay; return trackOverlay;
}; };
_this.OnUpdateOverlay = function() { _this.OnUpdateOverlay = function(bFullClear) {
/*if (this.IsUpdateOverlayOnlyEnd)
{
this.IsUpdateOverlayOnEndCheck = true;
return false;
} */
//console.log("update_overlay");
var overlay = trackOverlay;
//if (!overlay.m_bIsShow)
// return;
overlay.Clear(); var overlay = trackOverlay;
var ctx = overlay.m_oContext; var ctx = overlay.m_oContext;
var drDoc = this.drawingDocument; var drDoc = this.drawingDocument;
overlay.Clear();
this.drawingDocument.Overlay = overlay; this.drawingDocument.Overlay = overlay;
/* if (drDoc.m_bIsSearching)
{
ctx.fillStyle = "rgba(255,200,0,1)";
ctx.beginPath();
var drDoc = this.drawingDocument;
for (var i = drDoc.m_lDrawingFirst; i <= drDoc.m_lDrawingEnd; i++)
{
var drawPage = drDoc.m_arrPages[i].drawingPage;
drDoc.m_arrPages[i].pageIndex = i;
drDoc.m_arrPages[i].DrawSearch(overlay, drawPage.left, drawPage.top, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top, drDoc);
}
ctx.globalAlpha = 0.5; if ( bFullClear )
ctx.fill(); shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
ctx.beginPath(); else {
ctx.globalAlpha = 1.0; for ( var i = 0; i < aObjects.length; i++ ) {
var boundsChecker = _this.getBoundsChecker(aObjects[i]);
if (null != drDoc.CurrentSearchNavi) var _w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
{ var _h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
ctx.globalAlpha = 0.2; shapeOverlayCtx.m_oContext.clearRect( mmToPx(boundsChecker.Bounds.min_x) + scrollOffset.x, mmToPx(boundsChecker.Bounds.min_y) + scrollOffset.y, mmToPx(_w), mmToPx(_h) );
ctx.fillStyle = "rgba(51,102,204,255)";
var places = drDoc.CurrentSearchNavi.Place;
switch ((drDoc.CurrentSearchNavi.Type & 0xFF))
{
case search_HdrFtr_All:
case search_HdrFtr_All_no_First:
case search_HdrFtr_First:
case search_HdrFtr_Even:
case search_HdrFtr_Odd:
case search_HdrFtr_Odd_no_First:
{
var _page_num = drDoc.CurrentSearchNavi.PageNum;
for (var i = 0; i < places.length; i++)
{
var place = places[i];
if (drDoc.m_lDrawingFirst <= _page_num && _page_num <= drDoc.m_lDrawingEnd)
{
var drawPage = drDoc.m_arrPages[_page_num].drawingPage;
drDoc.m_arrPages[place.PageNum].DrawSearchCur1(overlay, drawPage.left, drawPage.top, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top, place);
}
}
break;
}
default:
{
for (var i = 0; i < places.length; i++)
{
var place = places[i];
if (drDoc.m_lDrawingFirst <= place.PageNum && place.PageNum <= drDoc.m_lDrawingEnd)
{
var drawPage = drDoc.m_arrPages[place.PageNum].drawingPage;
drDoc.m_arrPages[place.PageNum].DrawSearchCur1(overlay, drawPage.left, drawPage.top, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top, place);
}
}
break;
}
} }
ctx.fill();
ctx.globalAlpha = 1.0;
} }
} */
shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
// Селекты для комментариев, фильтров и т.д. // Селекты для комментариев, фильтров и т.д.
worksheet._drawGraphic(); worksheet._drawGraphic();
...@@ -2116,12 +2053,9 @@ function DrawingObjects() { ...@@ -2116,12 +2053,9 @@ function DrawingObjects() {
if (_this.controller.needUpdateOverlay()) if (_this.controller.needUpdateOverlay())
{ {
overlay.Show(); overlay.Show();
// this.drawingDocument.AutoShapesTrack.PageIndex = -1;
shapeOverlayCtx.put_GlobalAlpha(true, 0.5); shapeOverlayCtx.put_GlobalAlpha(true, 0.5);
_this.controller.drawTracks(shapeOverlayCtx); _this.controller.drawTracks(shapeOverlayCtx);
shapeOverlayCtx.put_GlobalAlpha(true, 1); shapeOverlayCtx.put_GlobalAlpha(true, 1);
//autoShapeTrack.CorrectOverlayBounds();
} }
} }
...@@ -2133,7 +2067,7 @@ function DrawingObjects() { ...@@ -2133,7 +2067,7 @@ function DrawingObjects() {
for (var i = drDoc.m_lDrawingFirst; i <= drDoc.m_lDrawingEnd; i++) for (var i = drDoc.m_lDrawingFirst; i <= drDoc.m_lDrawingEnd; i++)
{ {
var drawPage = drDoc.m_arrPages[i].drawingPage; var drawPage = drDoc.m_arrPages[i].drawingPage;
drDoc.m_oDocumentRenderer.DrawSelection(i, overlay, drawPage.left /*+ scrollOffset.x*/, drawPage.top/* + scrollOffset.y*/, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top); drDoc.m_oDocumentRenderer.DrawSelection(i, overlay, drawPage.left, drawPage.top, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top);
} }
ctx.globalAlpha = 0.2; ctx.globalAlpha = 0.2;
...@@ -2230,9 +2164,6 @@ function DrawingObjects() { ...@@ -2230,9 +2164,6 @@ function DrawingObjects() {
worksheet._drawCells(); worksheet._drawCells();
worksheet._drawCellsBorders();*/ worksheet._drawCellsBorders();*/
var asc = window["Asc"];
var asc_Range = asc.Range;
// Чистим предыдущие области // Чистим предыдущие области
var bHeaders = false; var bHeaders = false;
var _top = worksheet.getCellTop(worksheet.getFirstVisibleRow(), 3); var _top = worksheet.getCellTop(worksheet.getFirstVisibleRow(), 3);
...@@ -2249,19 +2180,19 @@ function DrawingObjects() { ...@@ -2249,19 +2180,19 @@ function DrawingObjects() {
// Чистим текущие области // Чистим текущие области
for ( var i = 0; i < aObjects.length; i++ ) { for ( var i = 0; i < aObjects.length; i++ ) {
var boundsChecker = _this.getBoundsChecker(aObjects[i]); var boundsChecker = _this.getBoundsChecker(aObjects[i]);
restoreSheetArea(boundsChecker); restoreSheetArea(boundsChecker);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
} }
}
function restoreSheetArea(checker) { function restoreSheetArea(checker) {
var _w = checker.Bounds.max_x - checker.Bounds.min_x; var _w = checker.Bounds.max_x - checker.Bounds.min_x;
var _h = checker.Bounds.max_y - checker.Bounds.min_y; var _h = checker.Bounds.max_y - checker.Bounds.min_y;
//overlayCtx.clearRect( mmToPt(checker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w + pxToMm(scrollOffset.x)), mmToPt(_h + pxToMm(scrollOffset.y))); //overlayCtx.clearRect( mmToPt(checker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w), mmToPt(_h) );
//drawingCtx.clearRect( mmToPt(checker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w + pxToMm(scrollOffset.x)), mmToPt(_h + pxToMm(scrollOffset.y))); //drawingCtx.clearRect( mmToPt(checker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w), mmToPt(_h) );
var foundRow = worksheet._findRowUnderCursor( mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), true); var foundRow = worksheet._findRowUnderCursor( mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), true);
var topRow = foundRow ? foundRow.row : 0; var topRow = foundRow ? foundRow.row : 0;
...@@ -2278,14 +2209,15 @@ function DrawingObjects() { ...@@ -2278,14 +2209,15 @@ function DrawingObjects() {
worksheet._drawCells(r_); worksheet._drawCells(r_);
worksheet._drawCellsBorders(undefined, r_); worksheet._drawCellsBorders(undefined, r_);
} }
}
_this.raiseLayerDrawingObjects = function() { _this.raiseLayerDrawingObjects = function() {
/*for (var i = 0; i < aObjects.length; i++) { for ( var i = 0; i < aObjects.length; i++ ) {
var obj = aObjects[i]; var boundsChecker = _this.getBoundsChecker(aObjects[i]);
obj.graphicObject.draw(shapeOverlayCtx); var _w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
}*/ var _h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
overlayCtx.clearRect( mmToPt(boundsChecker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(boundsChecker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w), mmToPt(_h) );
}
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -2357,8 +2289,11 @@ function DrawingObjects() { ...@@ -2357,8 +2289,11 @@ function DrawingObjects() {
}*/ }*/
} }
} }
//_this.raiseLayerDrawingObjects(); if ( _this.controller.selectedObjects.length )
_this.OnUpdateOverlay(); _this.OnUpdateOverlay();
else
_this.raiseLayerDrawingObjects();
_this.drawWorksheetHeaders(); _this.drawWorksheetHeaders();
} }
......
...@@ -1781,7 +1781,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card ...@@ -1781,7 +1781,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
{ {
var resize_coefficients = this.majorObject.getResizeCoefficients(this.handleNum, x, y); var resize_coefficients = this.majorObject.getResizeCoefficients(this.handleNum, x, y);
this.drawingObjectsController.trackResizeObjects(resize_coefficients.kd1, resize_coefficients.kd2, e); this.drawingObjectsController.trackResizeObjects(resize_coefficients.kd1, resize_coefficients.kd2, e);
this.drawingObjects.OnUpdateOverlay(); this.drawingObjects.OnUpdateOverlay(true);
}; };
...@@ -2037,7 +2037,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects, presetGeom ...@@ -2037,7 +2037,7 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects, presetGeom
this.onMouseMove = function(e, x, y) this.onMouseMove = function(e, x, y)
{ {
this.drawingObjectsController.trackNewShape(e, x, y); this.drawingObjectsController.trackNewShape(e, x, y);
this.drawingObjects.OnUpdateOverlay(); this.drawingObjects.OnUpdateOverlay(true);
}; };
this.onMouseUp = function(e, x, y) this.onMouseUp = function(e, x, y)
...@@ -2282,7 +2282,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec ...@@ -2282,7 +2282,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
var dy = y - this.startY; var dy = y - this.startY;
var check_position = this.drawingObjects.checkGraphicObjectPosition(this.rectX + dx, this.rectY + dy, this.rectW, this.rectH); var check_position = this.drawingObjects.checkGraphicObjectPosition(this.rectX + dx, this.rectY + dy, this.rectW, this.rectH);
this.drawingObjectsController.trackMoveObjects(dx + check_position.x, dy + check_position.y); this.drawingObjectsController.trackMoveObjects(dx + check_position.x, dy + check_position.y);
this.drawingObjects.OnUpdateOverlay(); this.drawingObjects.OnUpdateOverlay(true);
}; };
this.onMouseUp = function(e, x, y) this.onMouseUp = function(e, x, y)
......
...@@ -2547,7 +2547,7 @@ ...@@ -2547,7 +2547,7 @@
var zoom = ws.getZoom(); var zoom = ws.getZoom();
var x1 = x1/zoom; var x1 = x1/zoom;
var y1 = y1/zoom; var y1 = y1/zoom;
ws.drawingCtx ws.overlayCtx
.setFillStyle(ws.settings.cells.defaultState.background) .setFillStyle(ws.settings.cells.defaultState.background)
.setLineWidth(1) .setLineWidth(1)
.setStrokeStyle(ws.settings.cells.defaultState.border) .setStrokeStyle(ws.settings.cells.defaultState.border)
...@@ -2564,7 +2564,7 @@ ...@@ -2564,7 +2564,7 @@
{ {
var shift = 0.5; var shift = 0.5;
var size = 4*index; var size = 4*index;
ws.drawingCtx ws.overlayCtx
.beginPath() .beginPath()
.moveTo(x, y, 0, 0) .moveTo(x, y, 0, 0)
.lineTo(x,y - size/2, 0, 0) .lineTo(x,y - size/2, 0, 0)
...@@ -2580,7 +2580,7 @@ ...@@ -2580,7 +2580,7 @@
{ {
var size = 4*index; var size = 4*index;
var shift = 0.5; var shift = 0.5;
ws.drawingCtx ws.overlayCtx
.beginPath() .beginPath()
.moveTo(x , y , -shift, 0) .moveTo(x , y , -shift, 0)
.lineTo(x + size,y, -shift,0.5) .lineTo(x + size,y, -shift,0.5)
......
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