Commit 128d9784 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@48981 954022d7-b5bf-4e40-9824-e11837661b57
parent 8947b714
......@@ -857,6 +857,14 @@ asc_CChart.prototype = {
this.subType = data.oldValue;
break;
case historyitem_Chart_ChangeShowValue:
this.bShowValue = data.oldValue;
break;
case historyitem_Chart_ChangeShowBorder:
this.bShowBorder = data.oldValue;
break;
case historyitem_Chart_ChangeStyle:
this.styleId = data.oldValue;
break;
......@@ -904,6 +912,14 @@ asc_CChart.prototype = {
this.subType = data.newValue;
break;
case historyitem_Chart_ChangeShowValue:
this.bShowValue = data.newValue;
break;
case historyitem_Chart_ChangeShowBorder:
this.bShowBorder = data.newValue;
break;
case historyitem_Chart_ChangeStyle:
this.styleId = data.newValue;
break;
......@@ -2257,6 +2273,17 @@ function DrawingObjects() {
_this.asyncImageEndLoaded = null;
_this.asyncImagesDocumentEndLoaded = null;
// Task timer
var aDrawTasks = [];
var drawTaskTimerId = null;
function drawTaskFunction() {
if ( aDrawTasks.length ) {
//console.log("Task count = " + aDrawTasks.length);
_this.showDrawingObjectsEx(aDrawTasks[0].params[0], aDrawTasks[0].params[1]);
aDrawTasks.splice(0, 1);
}
}
//-----------------------------------------------------------------------------------
// Create drawing
//-----------------------------------------------------------------------------------
......@@ -2568,6 +2595,8 @@ function DrawingObjects() {
//-----------------------------------------------------------------------------------
_this.init = function(currentSheet) {
var taskTimerId = setInterval(drawTaskFunction, 10);
userId = api.User.asc_getId();
documentId = api.documentId;
......@@ -2854,8 +2883,9 @@ function DrawingObjects() {
boundsChecker.rect(0,0, drawingObject.graphicObject.extX, drawingObject.graphicObject.extY);
drawingObject.graphicObject.draw(boundsChecker);
boundsChecker.CorrectBounds();
// Коррекция для селекта при блокировке
var delta = 12;
var delta = (drawingObject.graphicObject.lockType == c_oAscLockTypes.kLockTypeNone) ? 0 : 6;
boundsChecker.Bounds.min_x -= delta;
boundsChecker.Bounds.min_y -= delta;
boundsChecker.Bounds.max_x += delta;
......@@ -2921,13 +2951,24 @@ function DrawingObjects() {
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) );
}
}
}
//-----------------------------------------------------------------------------------
// Drawing objects
//-----------------------------------------------------------------------------------
_this.showDrawingObjects = function(clearCanvas, printOptions) {
var currDate = new Date();
var currTime = currDate.getTime();
if ( aDrawTasks.length ) {
if ( currTime - aDrawTasks[aDrawTasks.length - 1].time < 40 )
return;
}
aDrawTasks.push( { time: currTime, params: [clearCanvas, printOptions] } );
}
_this.showDrawingObjectsEx = function(clearCanvas, printOptions) {
/*********** Print Options ***************
printOptions : {
......@@ -2941,6 +2982,9 @@ function DrawingObjects() {
}
*****************************************/
//var date = new Date();
//var timeBefore = date.getTime();
if ( drawingCtx ) {
if ( clearCanvas )
......@@ -2952,6 +2996,12 @@ function DrawingObjects() {
worksheet._drawGraphic();
worksheet.model.Drawings = aObjects;
var printCtx = null;
if ( printOptions ) {
printCtx = new CGraphics();
// TODO: printCtx.init( printOptions.ctx.getCanvas(), printOptions.ctx.getWidth(0), printOptions.ctx.getHeight(0), printOptions.ctx.getWidth(3), printOptions.ctx.getHeight(3) );
}
for (var i = 0; i < aObjects.length; i++) {
var index = i;
......@@ -2964,32 +3014,18 @@ function DrawingObjects() {
obj.updateAnchorPosition();
// Shape render
if ( obj.isGraphicObject() ) {
obj.graphicObject.draw(shapeCtx);
continue;
}
/*if ( printOptions ) {
if ( obj.isChart() ) {
srcForPrint = obj.image.src; // base64
if ( !printOptions ) {
if ( obj.isGraphicObject() ) {
obj.graphicObject.draw(shapeCtx);
continue;
}
else {
srcForPrint = obj.imageUrl;
}
else {
if ( obj.isGraphicObject() ) {
// TODO: obj.graphicObject.draw(printCtx);
continue;
}
var marginRight = 0;
if (worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) + worksheet.getColumnWidth(worksheet.getLastVisibleCol()) < obj.getRealLeftOffset() + obj.getVisibleWidth())
marginRight = printOptions.margin.right;
printOptions.ctx.drawImage(srcForPrint,
// обрезаем
pxToPt(obj.getInnerOffsetLeft()), pxToPt(obj.getInnerOffsetTop()),
pxToPt(sWidth) - marginRight, pxToPt(sHeight),
// вставляем
pxToPt(obj.getVisibleLeftOffset(true)) + printOptions.margin.left, pxToPt(obj.getVisibleTopOffset(true)) + printOptions.margin.top,
pxToPt(obj.getVisibleWidth()), pxToPt(obj.getVisibleHeight()),
pxToPt(obj.image.width), pxToPt(obj.image.height));
}*/
}
}
}
if ( _this.controller.selectedObjects.length )
......@@ -2998,6 +3034,10 @@ function DrawingObjects() {
_this.raiseLayerDrawingObjects();
_this.drawWorksheetHeaders();
//date = new Date();
//var drawTime = date.getTime() - timeBefore;
//console.log("Draw time = " + drawTime);
}
_this.getDrawingAreaMetrics = function() {
......
......@@ -623,7 +623,12 @@ DrawingObjectsController.prototype =
canUnGroup: function()
{
return true;
for (var i = 0; i < this.selectedObjects.length; i++)
{
if (this.selectedObjects[i].isGroup())
return true;
}
return false;
},
startTrackNewShape: function(presetGeom)
......
......@@ -423,6 +423,16 @@ CChartAsGroup.prototype =
History.Add(g_oUndoRedoGraphicObjects, historyitem_Chart_ChangeSubType, null, null, new UndoRedoDataGraphicObjects(this.chart.Get_Id(), new UndoRedoDataGOSingleProp(this.chart.subType, chart.subType)));
this.chart.subType = chart.subType;
}
if ( this.chart.bShowValue != chart.bShowValue ) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_Chart_ChangeShowValue, null, null, new UndoRedoDataGraphicObjects(this.chart.Get_Id(), new UndoRedoDataGOSingleProp(this.chart.bShowValue, chart.bShowValue)));
this.chart.bShowValue = chart.bShowValue;
}
if ( this.chart.bShowBorder != chart.bShowBorder ) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_Chart_ChangeShowBorder, null, null, new UndoRedoDataGraphicObjects(this.chart.Get_Id(), new UndoRedoDataGOSingleProp(this.chart.bShowBorder, chart.bShowBorder)));
this.chart.bShowBorder = chart.bShowBorder;
}
if ( this.chart.styleId != chart.styleId ) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_Chart_ChangeStyle, null, null, new UndoRedoDataGraphicObjects(this.chart.Get_Id(), new UndoRedoDataGOSingleProp(this.chart.styleId, chart.styleId)));
......
......@@ -77,12 +77,14 @@ var historyitem_Cell_Style = 22;
var historyitem_Chart_ChangeType = 1;
var historyitem_Chart_ChangeSubType = 2;
var historyitem_Chart_ChangeStyle = 3;
var historyitem_Chart_ChangeRange = 4;
var historyitem_Chart_ChangeHeader = 5;
var historyitem_Chart_ChangeAxisX = 6;
var historyitem_Chart_ChangeAxisY = 7;
var historyitem_Chart_ChangeLegend = 8;
var historyitem_Chart_ChangeShowValue = 3;
var historyitem_Chart_ChangeShowBorder = 4;
var historyitem_Chart_ChangeStyle = 5;
var historyitem_Chart_ChangeRange = 6;
var historyitem_Chart_ChangeHeader = 7;
var historyitem_Chart_ChangeAxisX = 8;
var historyitem_Chart_ChangeAxisY = 9;
var historyitem_Chart_ChangeLegend = 10;
var historyitem_AutoShapes_Offset = 1;
var historyitem_AutoShapes_Extents = 2;
......
......@@ -6039,7 +6039,7 @@
this._trigger("selectionRangeChanged", this.getSelectionRangeValue());
}
}
return ret;
},
......
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