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

Оптимизация ввода текста в группе

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53252 954022d7-b5bf-4e40-9824-e11837661b57
parent 57f9e98d
...@@ -2507,19 +2507,39 @@ function GraphicOption(ws, type, delta) { ...@@ -2507,19 +2507,39 @@ function GraphicOption(ws, type, delta) {
if ( _this.ws ) { if ( _this.ws ) {
var controller = _this.ws.objectRender.controller; var controller = _this.ws.objectRender.controller;
var selectedObjects = controller.selectedObjects; var selectedObjects = controller.selectedObjects;
if ( selectedObjects.length === 1 ) { if ( selectedObjects.length === 1 ) {
var drawingObject = selectedObjects[0].drawingBase; if ( selectedObjects[0].isGroup() ) {
var checker = _this.ws.objectRender.getBoundsChecker(drawingObject); var groupSelectedObjects = selectedObjects[0].selectedObjects;
var coords = _this.ws.objectRender.getBoundsCheckerCoords(checker); if ( groupSelectedObjects.length === 1 ) {
if ( coords ) { var checker = _this.ws.objectRender.getBoundsChecker(groupSelectedObjects[0]);
vr.c1 = Math.max(coords.from.col, vr.c1); var coords = _this.ws.objectRender.getBoundsCheckerCoords(checker);
vr.r1 = Math.max(coords.from.row, vr.r1); if ( coords ) {
vr.c1 = Math.max(coords.from.col, vr.c1);
checkCol(coords.to.col + 1); vr.r1 = Math.max(coords.from.row, vr.r1);
vr.c2 = Math.min(coords.to.col + 1, vr.c2);
checkCol(coords.to.col + 1);
checkRow(coords.to.row + 1); vr.c2 = Math.min(coords.to.col + 1, vr.c2);
vr.r2 = Math.min(coords.to.row + 1, vr.r2);
checkRow(coords.to.row + 1);
vr.r2 = Math.min(coords.to.row + 1, vr.r2);
}
}
}
else {
var drawingObject = selectedObjects[0].drawingBase;
var checker = _this.ws.objectRender.getBoundsChecker(drawingObject.graphicObject);
var coords = _this.ws.objectRender.getBoundsCheckerCoords(checker);
if ( coords ) {
vr.c1 = Math.max(coords.from.col, vr.c1);
vr.r1 = Math.max(coords.from.row, vr.r1);
checkCol(coords.to.col + 1);
vr.c2 = Math.min(coords.to.col + 1, vr.c2);
checkRow(coords.to.row + 1);
vr.r2 = Math.min(coords.to.row + 1, vr.r2);
}
} }
} }
} }
...@@ -2711,7 +2731,7 @@ function DrawingObjects() { ...@@ -2711,7 +2731,7 @@ function DrawingObjects() {
var result = true; var result = true;
var fvc, fvr, lvc, lvr; var fvc, fvr, lvc, lvr;
var checker = _this.getBoundsChecker(_t); var checker = _this.getBoundsChecker(_t.graphicObject);
var coords = _this.getBoundsCheckerCoords(checker); var coords = _this.getBoundsCheckerCoords(checker);
if ( coords ) { if ( coords ) {
if ( scrollType ) { if ( scrollType ) {
...@@ -2960,7 +2980,7 @@ function DrawingObjects() { ...@@ -2960,7 +2980,7 @@ function DrawingObjects() {
drawingObject.graphicObject.addToDrawingObjects(); drawingObject.graphicObject.addToDrawingObjects();
var boundsChecker = _this.getBoundsChecker(drawingObject); var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
} }
if (drawingObject.graphicObject instanceof CShape) { if (drawingObject.graphicObject instanceof CShape) {
...@@ -2987,7 +3007,7 @@ function DrawingObjects() { ...@@ -2987,7 +3007,7 @@ function DrawingObjects() {
new UndoRedoDataGraphicObjects(drawingObject.graphicObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null))); new UndoRedoDataGraphicObjects(drawingObject.graphicObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
drawingObject.graphicObject.addToDrawingObjects(); drawingObject.graphicObject.addToDrawingObjects();
var boundsChecker = _this.getBoundsChecker(drawingObject); var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
} }
if (drawingObject.graphicObject instanceof CImageShape) { if (drawingObject.graphicObject instanceof CImageShape) {
...@@ -3045,7 +3065,7 @@ function DrawingObjects() { ...@@ -3045,7 +3065,7 @@ function DrawingObjects() {
drawingObject.graphicObject.addToDrawingObjects(); drawingObject.graphicObject.addToDrawingObjects();
var boundsChecker = _this.getBoundsChecker(drawingObject); var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
} }
} }
...@@ -3065,7 +3085,7 @@ function DrawingObjects() { ...@@ -3065,7 +3085,7 @@ function DrawingObjects() {
drawingObject.graphicObject.draw(shapeCtx); drawingObject.graphicObject.draw(shapeCtx);
aObjects.push(drawingObject); aObjects.push(drawingObject);
var boundsChecker = _this.getBoundsChecker(drawingObject); var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
} }
} }
...@@ -3124,8 +3144,6 @@ function DrawingObjects() { ...@@ -3124,8 +3144,6 @@ function DrawingObjects() {
_this.OnUpdateOverlay = function(bFull) { _this.OnUpdateOverlay = function(bFull) {
// TODO Сократить вызовы
var overlay = trackOverlay; var overlay = trackOverlay;
var ctx = overlay.m_oContext; var ctx = overlay.m_oContext;
var drDoc = this.drawingDocument; var drDoc = this.drawingDocument;
...@@ -3139,16 +3157,12 @@ function DrawingObjects() { ...@@ -3139,16 +3157,12 @@ function DrawingObjects() {
shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix); shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
else { else {
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].graphicObject);
var _w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x; var _w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
var _h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y; var _h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
shapeOverlayCtx.m_oContext.clearRect( mmToPx(boundsChecker.Bounds.min_x) + scrollOffset.getX(), mmToPx(boundsChecker.Bounds.min_y) + scrollOffset.getY(), mmToPx(_w), mmToPx(_h) ); shapeOverlayCtx.m_oContext.clearRect( mmToPx(boundsChecker.Bounds.min_x) + scrollOffset.getX(), mmToPx(boundsChecker.Bounds.min_y) + scrollOffset.getY(), mmToPx(_w), mmToPx(_h) );
} }
} }
/*if ( !_this.selectedGraphicObjectsExists() ) {
worksheet.cleanSelection();
worksheet._drawSelectionRange();
}*/
// Clip // Clip
_this.clipGraphicsCanvas(shapeOverlayCtx); _this.clipGraphicsCanvas(shapeOverlayCtx);
...@@ -3294,13 +3308,13 @@ function DrawingObjects() { ...@@ -3294,13 +3308,13 @@ function DrawingObjects() {
worksheet.model.workbook.handlers.trigger(triggerName, param); worksheet.model.workbook.handlers.trigger(triggerName, param);
} }
_this.getBoundsChecker = function(drawingObject) { _this.getBoundsChecker = function(graphicObject) {
if ( drawingObject && drawingObject.graphicObject ) { if ( graphicObject ) {
var boundsChecker = new CSlideBoundsChecker(); var boundsChecker = new CSlideBoundsChecker();
boundsChecker.init(1, 1, 1, 1); boundsChecker.init(1, 1, 1, 1);
boundsChecker.transform3(drawingObject.graphicObject.transform); boundsChecker.transform3(graphicObject.transform);
boundsChecker.rect(0,0, drawingObject.graphicObject.extX, drawingObject.graphicObject.extY); boundsChecker.rect(0,0, graphicObject.extX, graphicObject.extY);
drawingObject.graphicObject.draw(boundsChecker); graphicObject.draw(boundsChecker);
boundsChecker.CorrectBounds(); boundsChecker.CorrectBounds();
// Коррекция для селекта при блокировке // Коррекция для селекта при блокировке
...@@ -3338,7 +3352,7 @@ function DrawingObjects() { ...@@ -3338,7 +3352,7 @@ function DrawingObjects() {
for ( var i = 0; i < aObjects.length; i++ ) { for ( var i = 0; i < aObjects.length; i++ ) {
if ( !aObjects[i].inVisibleArea() ) if ( !aObjects[i].inVisibleArea() )
continue; continue;
var boundsChecker = _this.getBoundsChecker(aObjects[i]); var boundsChecker = _this.getBoundsChecker(aObjects[i].graphicObject);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
} }
} }
...@@ -3707,15 +3721,6 @@ function DrawingObjects() { ...@@ -3707,15 +3721,6 @@ 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 coords = _this.getBoundsCheckerCoords(boundsChecker);
if ( coords ) {
if ( coords.to.col >= metrics.maxCol )
metrics.maxCol = coords.to.col + 1; // учитываем colOff
if ( coords.to.row >= metrics.maxRow )
metrics.maxRow = coords.to.row + 1; // учитываем rowOff
}*/
var drawingObject = aObjects[i]; var drawingObject = aObjects[i];
if ( drawingObject.to.col >= metrics.maxCol ) if ( drawingObject.to.col >= metrics.maxCol )
metrics.maxCol = drawingObject.to.col + 1; // учитываем colOff metrics.maxCol = drawingObject.to.col + 1; // учитываем colOff
...@@ -4598,7 +4603,7 @@ function DrawingObjects() { ...@@ -4598,7 +4603,7 @@ function DrawingObjects() {
_this.objectLocker.checkObjects( function(result) {} ); _this.objectLocker.checkObjects( function(result) {} );
} }
var boundsChecker = _this.getBoundsChecker(drawingObject); var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker); aBoundsCheckers.push(boundsChecker);
return ret; return ret;
......
...@@ -3209,6 +3209,7 @@ function ChartGroupState(drawingObjectsController, drawingObjects, group, chart) ...@@ -3209,6 +3209,7 @@ function ChartGroupState(drawingObjectsController, drawingObjects, group, chart)
function ChartTextAddGroup(drawingObjectsController, drawingObjects, group, chart, textObject) function ChartTextAddGroup(drawingObjectsController, drawingObjects, group, chart, textObject)
{ {
var _this = this;
this.id = STATES_ID_CHART_TEXT_GROUP; this.id = STATES_ID_CHART_TEXT_GROUP;
this.drawingObjectsController = drawingObjectsController; this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects; this.drawingObjects = drawingObjects;
...@@ -3265,7 +3266,7 @@ function ChartTextAddGroup(drawingObjectsController, drawingObjects, group, char ...@@ -3265,7 +3266,7 @@ function ChartTextAddGroup(drawingObjectsController, drawingObjects, group, char
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(true); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
} }
}; };
...@@ -3574,6 +3575,7 @@ function MoveChartTitleGroup(drawingObjectsController, drawingObjects, group, ch ...@@ -3574,6 +3575,7 @@ function MoveChartTitleGroup(drawingObjectsController, drawingObjects, group, ch
function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObject) function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObject)
{ {
var _this = this;
this.id = STATES_ID_TEXT_ADD_IN_GROUP; this.id = STATES_ID_TEXT_ADD_IN_GROUP;
this.drawingObjectsController = drawingObjectsController; this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects; this.drawingObjects = drawingObjects;
...@@ -3635,7 +3637,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj ...@@ -3635,7 +3637,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{ {
History.Create_NewPoint(); History.Create_NewPoint();
text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); text_object.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
drawingObjects.showDrawingObjects(true); drawingObjects.showDrawingObjects(false, new GraphicOption(_this.drawingObjects.getWorksheet(), c_oAscGraphicOption.AddText, 0));
text_object.updateSelectionState(drawingObjects.drawingDocument); text_object.updateSelectionState(drawingObjects.drawingDocument);
} }
}; };
......
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