Commit e5fd50c3 authored by SergeyLuzyanin's avatar SergeyLuzyanin

connectors

parent db301e93
...@@ -581,9 +581,6 @@ function CheckSpPrXfrm2(object) ...@@ -581,9 +581,6 @@ function CheckSpPrXfrm2(object)
} }
function getObjectsByTypesFromArr(arr, bGrouped) function getObjectsByTypesFromArr(arr, bGrouped)
{ {
var ret = {shapes: [], images: [], groups: [], charts: [], tables: [], oleObjects: []}; var ret = {shapes: [], images: [], groups: [], charts: [], tables: [], oleObjects: []};
...@@ -595,6 +592,7 @@ function getObjectsByTypesFromArr(arr, bGrouped) ...@@ -595,6 +592,7 @@ function getObjectsByTypesFromArr(arr, bGrouped)
switch(type) switch(type)
{ {
case AscDFH.historyitem_type_Shape: case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_Cnx:
{ {
ret.shapes.push(drawing); ret.shapes.push(drawing);
break; break;
...@@ -2537,6 +2535,15 @@ DrawingObjectsController.prototype = ...@@ -2537,6 +2535,15 @@ DrawingObjectsController.prototype =
return api.textArtPreviewManager; return api.textArtPreviewManager;
}, },
resetConnectors: function(aShapes){
var aAllConnectors = this.getAllConnectors(this.getDrawingArray());
for(var i = 0; i < aAllConnectors.length; ++i){
for(var j = 0; j < aShapes.length; ++j){
aAllConnectors[i].resetShape(aShapes[j]);
}
}
},
applyDrawingProps: function(props) applyDrawingProps: function(props)
{ {
var objects_by_type = this.getSelectedObjectsByTypes(true); var objects_by_type = this.getSelectedObjectsByTypes(true);
...@@ -2629,14 +2636,20 @@ DrawingObjectsController.prototype = ...@@ -2629,14 +2636,20 @@ DrawingObjectsController.prototype =
} }
if(typeof(props.type) === "string") if(typeof(props.type) === "string")
{ {
var aShapes = [];
for(i = 0; i < objects_by_type.shapes.length; ++i) for(i = 0; i < objects_by_type.shapes.length; ++i)
{ {
objects_by_type.shapes[i].changePresetGeom(props.type); if(objects_by_type.shapes[i].getObjectType() === AscDFH.historyitem_type_Shape){
objects_by_type.shapes[i].changePresetGeom(props.type);
aShapes.push(objects_by_type.shapes[i]);
}
} }
for(i = 0; i < objects_by_type.groups.length; ++i) for(i = 0; i < objects_by_type.groups.length; ++i)
{ {
objects_by_type.groups[i].changePresetGeom(props.type); objects_by_type.groups[i].changePresetGeom(props.type);
objects_by_type.groups[i].getAllShapes(objects_by_type.groups[i].spTree, aShapes);
} }
this.resetConnectors(aShapes);
} }
if(isRealObject(props.stroke)) if(isRealObject(props.stroke))
{ {
...@@ -5031,6 +5044,7 @@ DrawingObjectsController.prototype = ...@@ -5031,6 +5044,7 @@ DrawingObjectsController.prototype =
{ {
worksheet.endEditChart(); worksheet.endEditChart();
} }
var aAllShapes = [];
if(this.selection.groupSelection) if(this.selection.groupSelection)
{ {
if(this.selection.groupSelection.selection.chartSelection) if(this.selection.groupSelection.selection.chartSelection)
...@@ -5039,6 +5053,7 @@ DrawingObjectsController.prototype = ...@@ -5039,6 +5053,7 @@ DrawingObjectsController.prototype =
} }
else else
{ {
this.getAllShapes(this.selection.groupSelection.selectedObjects, aAllShapes);
var group_map = {}, group_arr = [], i, cur_group, sp, xc, yc, hc, vc, rel_xc, rel_yc, j; var group_map = {}, group_arr = [], i, cur_group, sp, xc, yc, hc, vc, rel_xc, rel_yc, j;
for(i = 0; i < this.selection.groupSelection.selectedObjects.length; ++i) for(i = 0; i < this.selection.groupSelection.selectedObjects.length; ++i)
{ {
...@@ -5131,6 +5146,7 @@ DrawingObjectsController.prototype = ...@@ -5131,6 +5146,7 @@ DrawingObjectsController.prototype =
} }
else else
{ {
this.getAllShapes(this.selectedObjects, aAllShapes);
for(var i = 0; i < this.selectedObjects.length; ++i) for(var i = 0; i < this.selectedObjects.length; ++i)
{ {
this.selectedObjects[i].deleteDrawingBase(true); this.selectedObjects[i].deleteDrawingBase(true);
...@@ -5139,6 +5155,7 @@ DrawingObjectsController.prototype = ...@@ -5139,6 +5155,7 @@ DrawingObjectsController.prototype =
} }
} }
this.resetConnectors(aAllShapes);
this.resetSelection(); this.resetSelection();
this.recalculate(); this.recalculate();
} }
...@@ -7077,6 +7094,7 @@ DrawingObjectsController.prototype = ...@@ -7077,6 +7094,7 @@ DrawingObjectsController.prototype =
switch(drawing.getObjectType()) switch(drawing.getObjectType())
{ {
case AscDFH.historyitem_type_Shape: case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_Cnx:
{ {
new_shape_props = new_shape_props =
......
...@@ -490,6 +490,23 @@ ...@@ -490,6 +490,23 @@
return copy; return copy;
}; };
CConnectionShape.prototype.resetShape = function (oShape) {
var cnxPr = this.nvSpPr.nvUniSpPr;
if(cnxPr.stCnxId === oShape.Id || cnxPr.endCnxId === oShape.Id){
var oNewPr = cnxPr.copy();
if(cnxPr.stCnxId === oShape.Id){
oNewPr.stCnxId = null;
oNewPr.stCnxIdx = null;
}
if(cnxPr.endCnxId === oShape.Id){
oNewPr.endCnxId = null;
oNewPr.endCnxIdx = null;
}
this.nvSpPr.setUniSpPr(oNewPr);
}
};
window['AscFormat'] = window['AscFormat'] || {}; window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].fCalculateSpPr = fCalculateSpPr; window['AscFormat'].fCalculateSpPr = fCalculateSpPr;
window['AscFormat'].fCalculateConnectionInfo = fCalculateConnectionInfo; window['AscFormat'].fCalculateConnectionInfo = fCalculateConnectionInfo;
......
...@@ -1331,7 +1331,7 @@ function CGroupShape() ...@@ -1331,7 +1331,7 @@ function CGroupShape()
{ {
for(var _shape_index = 0; _shape_index < this.spTree.length; ++_shape_index) for(var _shape_index = 0; _shape_index < this.spTree.length; ++_shape_index)
{ {
if(this.spTree[_shape_index].changePresetGeom) if(this.spTree[_shape_index].getObjectType() === AscDFH.historyitem_type_Shape)
{ {
this.spTree[_shape_index].changePresetGeom(preset); this.spTree[_shape_index].changePresetGeom(preset);
} }
......
...@@ -960,7 +960,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController ...@@ -960,7 +960,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController
this.trackEnd = function(bWord) this.trackEnd = function(bWord)
{ {
if(!this.bConnector){ if(!this.bConnector || !this.oSpPr){
var scale_coefficients, ch_off_x, ch_off_y; var scale_coefficients, ch_off_x, ch_off_y;
if(this.originalObject.group) if(this.originalObject.group)
{ {
......
...@@ -1287,6 +1287,7 @@ CGraphicObjects.prototype = ...@@ -1287,6 +1287,7 @@ CGraphicObjects.prototype =
getTargetDocContent: DrawingObjectsController.prototype.getTargetDocContent, getTargetDocContent: DrawingObjectsController.prototype.getTargetDocContent,
getTextArtPreviewManager: DrawingObjectsController.prototype.getTextArtPreviewManager, getTextArtPreviewManager: DrawingObjectsController.prototype.getTextArtPreviewManager,
getEditorApi: DrawingObjectsController.prototype.getEditorApi, getEditorApi: DrawingObjectsController.prototype.getEditorApi,
resetConnectors: DrawingObjectsController.prototype.resetConnectors,
handleChartDoubleClick: function(drawing, chart, e, x, y, pageIndex) handleChartDoubleClick: function(drawing, chart, e, x, y, pageIndex)
{ {
......
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