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() {
var _this = this;
var asc = window["Asc"];
var api = asc["editor"];
var asc_Range = asc.Range;
var chartRender = new ChartRender();
var worksheet = null;
......@@ -1998,90 +2000,25 @@ function DrawingObjects() {
return trackOverlay;
};
_this.OnUpdateOverlay = function() {
/*if (this.IsUpdateOverlayOnlyEnd)
{
this.IsUpdateOverlayOnEndCheck = true;
return false;
} */
//console.log("update_overlay");
var overlay = trackOverlay;
//if (!overlay.m_bIsShow)
// return;
_this.OnUpdateOverlay = function(bFullClear) {
overlay.Clear();
var overlay = trackOverlay;
var ctx = overlay.m_oContext;
var drDoc = this.drawingDocument;
overlay.Clear();
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;
ctx.fill();
ctx.beginPath();
ctx.globalAlpha = 1.0;
if (null != drDoc.CurrentSearchNavi)
{
ctx.globalAlpha = 0.2;
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;
}
if ( bFullClear )
shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
else {
for ( var i = 0; i < aObjects.length; i++ ) {
var boundsChecker = _this.getBoundsChecker(aObjects[i]);
var _w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
var _h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
shapeOverlayCtx.m_oContext.clearRect( mmToPx(boundsChecker.Bounds.min_x) + scrollOffset.x, mmToPx(boundsChecker.Bounds.min_y) + scrollOffset.y, mmToPx(_w), mmToPx(_h) );
}
ctx.fill();
ctx.globalAlpha = 1.0;
}
} */
shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
// Селекты для комментариев, фильтров и т.д.
worksheet._drawGraphic();
......@@ -2116,12 +2053,9 @@ function DrawingObjects() {
if (_this.controller.needUpdateOverlay())
{
overlay.Show();
// this.drawingDocument.AutoShapesTrack.PageIndex = -1;
shapeOverlayCtx.put_GlobalAlpha(true, 0.5);
_this.controller.drawTracks(shapeOverlayCtx);
shapeOverlayCtx.put_GlobalAlpha(true, 1);
//autoShapeTrack.CorrectOverlayBounds();
}
}
......@@ -2133,7 +2067,7 @@ function DrawingObjects() {
for (var i = drDoc.m_lDrawingFirst; i <= drDoc.m_lDrawingEnd; i++)
{
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;
......@@ -2230,9 +2164,6 @@ function DrawingObjects() {
worksheet._drawCells();
worksheet._drawCellsBorders();*/
var asc = window["Asc"];
var asc_Range = asc.Range;
// Чистим предыдущие области
var bHeaders = false;
var _top = worksheet.getCellTop(worksheet.getFirstVisibleRow(), 3);
......@@ -2249,19 +2180,19 @@ function DrawingObjects() {
// Чистим текущие области
for ( var i = 0; i < aObjects.length; i++ ) {
var boundsChecker = _this.getBoundsChecker(aObjects[i]);
restoreSheetArea(boundsChecker);
aBoundsCheckers.push(boundsChecker);
}
}
function restoreSheetArea(checker) {
var _w = checker.Bounds.max_x - checker.Bounds.min_x;
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)));
//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)));
//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), mmToPt(_h) );
var foundRow = worksheet._findRowUnderCursor( mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), true);
var topRow = foundRow ? foundRow.row : 0;
......@@ -2278,14 +2209,15 @@ function DrawingObjects() {
worksheet._drawCells(r_);
worksheet._drawCellsBorders(undefined, r_);
}
}
_this.raiseLayerDrawingObjects = function() {
/*for (var i = 0; i < aObjects.length; i++) {
var obj = aObjects[i];
obj.graphicObject.draw(shapeOverlayCtx);
}*/
for ( var i = 0; i < aObjects.length; i++ ) {
var boundsChecker = _this.getBoundsChecker(aObjects[i]);
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() {
}*/
}
}
//_this.raiseLayerDrawingObjects();
if ( _this.controller.selectedObjects.length )
_this.OnUpdateOverlay();
else
_this.raiseLayerDrawingObjects();
_this.drawWorksheetHeaders();
}
......
......@@ -1781,7 +1781,7 @@ function ResizeState(drawingObjectsController, drawingObjects, majorObject, card
{
var resize_coefficients = this.majorObject.getResizeCoefficients(this.handleNum, x, y);
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
this.onMouseMove = function(e, x, y)
{
this.drawingObjectsController.trackNewShape(e, x, y);
this.drawingObjects.OnUpdateOverlay();
this.drawingObjects.OnUpdateOverlay(true);
};
this.onMouseUp = function(e, x, y)
......@@ -2282,7 +2282,7 @@ function MoveState(drawingObjectsController, drawingObjects, startX, startY, rec
var dy = y - this.startY;
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.drawingObjects.OnUpdateOverlay();
this.drawingObjects.OnUpdateOverlay(true);
};
this.onMouseUp = function(e, x, y)
......
......@@ -2547,7 +2547,7 @@
var zoom = ws.getZoom();
var x1 = x1/zoom;
var y1 = y1/zoom;
ws.drawingCtx
ws.overlayCtx
.setFillStyle(ws.settings.cells.defaultState.background)
.setLineWidth(1)
.setStrokeStyle(ws.settings.cells.defaultState.border)
......@@ -2564,7 +2564,7 @@
{
var shift = 0.5;
var size = 4*index;
ws.drawingCtx
ws.overlayCtx
.beginPath()
.moveTo(x, y, 0, 0)
.lineTo(x,y - size/2, 0, 0)
......@@ -2580,7 +2580,7 @@
{
var size = 4*index;
var shift = 0.5;
ws.drawingCtx
ws.overlayCtx
.beginPath()
.moveTo(x , y , -shift, 0)
.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