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

- Undo/Redo чартов и картинок

- Исправлен баг с наложением для объектов с прозрачностью

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49727 954022d7-b5bf-4e40-9824-e11837661b57
parent d4242407
...@@ -3096,8 +3096,8 @@ function DrawingObjects() { ...@@ -3096,8 +3096,8 @@ function DrawingObjects() {
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), mmToPt(_h) ); //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) ); //drawingCtx.clearRect( mmToPt(checker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(checker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w), mmToPt(_h) );
// Top left // Top left
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);
...@@ -3129,14 +3129,32 @@ function DrawingObjects() { ...@@ -3129,14 +3129,32 @@ function DrawingObjects() {
_this.raiseLayerDrawingObjects = function() { _this.raiseLayerDrawingObjects = function() {
for ( var i = 0; i < aObjects.length; i++ ) { var bRedraw = false;
/*var boundsChecker = _this.getBoundsChecker(aObjects[i]); var selection = worksheet.activeRange;
var _w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
var _h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y; if ( selection ) {
overlayCtx.clearRect( mmToPt(boundsChecker.Bounds.min_x + pxToMm(scrollOffset.x)), mmToPt(boundsChecker.Bounds.min_y + pxToMm(scrollOffset.y)), mmToPt(_w), mmToPt(_h) );*/ for ( var i = 0; i < aObjects.length; i++ ) {
var drawingObject = aObjects[i];
aObjects[i].graphicObject.draw(shapeOverlayCtx);
// Объекты не пересекаются
if ( (selection.c2 < drawingObject.from.col) || (selection.c1 > drawingObject.to.col) || (selection.r2 < drawingObject.from.row) || (selection.r1 > drawingObject.to.row) )
continue;
else {
bRedraw = true;
break;
}
}
} }
if ( bRedraw ) {
for ( var i = 0; i < aObjects.length; i++ ) {
var boundsChecker = _this.getBoundsChecker(aObjects[i]);
restoreSheetArea(boundsChecker);
}
for ( var i = 0; i < aObjects.length; i++ ) {
aObjects[i].graphicObject.draw(shapeCtx);
}
}
if ( aObjects.length ) if ( aObjects.length )
_this.drawWorksheetHeaders(); _this.drawWorksheetHeaders();
} }
...@@ -3175,37 +3193,44 @@ function DrawingObjects() { ...@@ -3175,37 +3193,44 @@ function DrawingObjects() {
if ( clearCanvas ) if ( clearCanvas )
_this.clearDrawingObjects(); _this.clearDrawingObjects();
if ( !aObjects.length ) if ( aObjects.length ) {
return;
worksheet._drawGraphic(); worksheet._drawGraphic();
worksheet.model.Drawings = aObjects; worksheet.model.Drawings = aObjects;
for (var i = 0; i < aObjects.length; i++) {
var index = i;
var obj = aObjects[i];
if ( !obj.inVisibleArea() ) for (var i = 0; i < aObjects.length; i++) {
continue;
var index = i;
var drawingObject = aObjects[i];
if ( !obj.flags.anchorUpdated ) if ( !drawingObject.inVisibleArea() )
obj.updateAnchorPosition(); continue;
// Shape render if ( !drawingObject.flags.anchorUpdated )
if ( obj.isGraphicObject() ) { drawingObject.updateAnchorPosition();
obj.graphicObject.draw( printOptions ? printOptions.ctx.DocumentRenderer : shapeCtx);
continue; // Shape render
if ( drawingObject.isGraphicObject() ) {
drawingObject.graphicObject.draw( printOptions ? printOptions.ctx.DocumentRenderer : shapeCtx );
continue;
}
} }
} }
} }
if ( !printOptions ) { if ( !printOptions ) {
if ( _this.controller.selectedObjects.length )
_this.OnUpdateOverlay(); if ( aObjects.length ) {
else if ( _this.controller.selectedObjects.length )
_this.raiseLayerDrawingObjects(); _this.OnUpdateOverlay();
else
_this.raiseLayerDrawingObjects();
}
else {
worksheet.cleanSelection();
worksheet._drawSelection();
}
_this.drawWorksheetHeaders(); _this.drawWorksheetHeaders();
} }
} }
...@@ -3274,7 +3299,7 @@ function DrawingObjects() { ...@@ -3274,7 +3299,7 @@ function DrawingObjects() {
_this.addImageDrawingObject = function(imageUrl, options) { _this.addImageDrawingObject = function(imageUrl, options) {
if ( imageUrl && !_this.isViewerMode() ) { if ( imageUrl && !_this.isViewerMode() ) {
var _image = api.ImageLoader.LoadImage(imageUrl, 1); var _image = api.ImageLoader.LoadImage(imageUrl, 1);
var isOption = options && options.cell; var isOption = options && options.cell;
...@@ -3330,7 +3355,6 @@ function DrawingObjects() { ...@@ -3330,7 +3355,6 @@ function DrawingObjects() {
worksheet.model.workbook.handlers.trigger("asc_onError", c_oAscError.ID.UplImageUrl, c_oAscError.Level.NoCritical); worksheet.model.workbook.handlers.trigger("asc_onError", c_oAscError.ID.UplImageUrl, c_oAscError.Level.NoCritical);
} }
else { else {
History.Create_NewPoint();
var obj = _this.createDrawingObject(); var obj = _this.createDrawingObject();
obj.worksheet = worksheet; obj.worksheet = worksheet;
...@@ -3363,20 +3387,8 @@ function DrawingObjects() { ...@@ -3363,20 +3387,8 @@ function DrawingObjects() {
obj.graphicObject = new CImageShape(obj, _this); obj.graphicObject = new CImageShape(obj, _this);
obj.graphicObject.initDefault( x, y, w, h, _image.src ); obj.graphicObject.initDefault( x, y, w, h, _image.src );
obj.graphicObject.select(_this.controller); obj.graphicObject.select(_this.controller);
aObjects.push(obj);
obj.setGraphicObjectCoords();
obj.setActive();
_this.showDrawingObjects(false);
_this.sendGraphicObjectProps();
var boundsChecker = _this.getBoundsChecker(obj);
aBoundsCheckers.push(boundsChecker);
_this.objectLocker.reset(); obj.graphicObject.addToDrawingObjects();
_this.objectLocker.addObjectId(obj.id);
_this.objectLocker.checkObjects( function(result){ return result; } );
} }
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
...@@ -3451,7 +3463,6 @@ function DrawingObjects() { ...@@ -3451,7 +3463,6 @@ function DrawingObjects() {
chart.rebuildSeries(); chart.rebuildSeries();
chart.worksheet = worksheet; // Для формул серий chart.worksheet = worksheet; // Для формул серий
History.Create_NewPoint();
return this.controller.addChartDrawingObject(chart, options); return this.controller.addChartDrawingObject(chart, options);
} }
else if ( isObject(chart) && chart["binary"] ) { else if ( isObject(chart) && chart["binary"] ) {
......
...@@ -1493,6 +1493,11 @@ CChartAsGroup.prototype = ...@@ -1493,6 +1493,11 @@ CChartAsGroup.prototype =
{ {
this.drawingObjects.deleteDrawingBase(this.Id); this.drawingObjects.deleteDrawingBase(this.Id);
break; break;
}
case historyitem_AutoShapes_DeleteDrawingBase:
{
this.drawingObjects.addGraphicObject(this, data.oldValue);
break;
} }
} }
}, },
...@@ -1506,11 +1511,15 @@ CChartAsGroup.prototype = ...@@ -1506,11 +1511,15 @@ CChartAsGroup.prototype =
this.recalculate(); this.recalculate();
break; break;
} }
case historyitem_AutoShapes_Add_To_Drawing_Objects: case historyitem_AutoShapes_Add_To_Drawing_Objects:
{ {
this.drawingObjects.addGraphicObject(this, data.oldValue); this.drawingObjects.addGraphicObject(this, data.oldValue);
break; break;
}
case historyitem_AutoShapes_DeleteDrawingBase:
{
this.drawingObjects.deleteDrawingBase(this.Id);
break;
} }
} }
}, },
......
...@@ -1057,6 +1057,16 @@ CImageShape.prototype = ...@@ -1057,6 +1057,16 @@ CImageShape.prototype =
this.calculateContent(); this.calculateContent();
this.calculateTransformTextMatrix(); this.calculateTransformTextMatrix();
break; break;
}
case historyitem_AutoShapes_Add_To_Drawing_Objects:
{
this.drawingObjects.deleteDrawingBase(this.Id);
break;
}
case historyitem_AutoShapes_DeleteDrawingBase:
{
this.drawingObjects.addGraphicObject(this, data.oldValue);
break;
} }
} }
}, },
...@@ -1071,6 +1081,16 @@ CImageShape.prototype = ...@@ -1071,6 +1081,16 @@ CImageShape.prototype =
this.calculateContent(); this.calculateContent();
this.calculateTransformTextMatrix(); this.calculateTransformTextMatrix();
break; break;
}
case historyitem_AutoShapes_Add_To_Drawing_Objects:
{
this.drawingObjects.addGraphicObject(this, data.oldValue);
break;
}
case historyitem_AutoShapes_DeleteDrawingBase:
{
this.drawingObjects.deleteDrawingBase(this.Id);
break;
} }
} }
}, },
......
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