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

Chart Edition

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48452 954022d7-b5bf-4e40-9824-e11837661b57
parent 5503368b
...@@ -1541,7 +1541,6 @@ function DrawingObjects() { ...@@ -1541,7 +1541,6 @@ function DrawingObjects() {
_t.ext = { cx: 0, cy: 0 }; _t.ext = { cx: 0, cy: 0 };
_t.size = { width: 0, height: 0 }; _t.size = { width: 0, height: 0 };
_t.chart = new asc_CChart();
_t.graphicObject = null; // CShape or GroupShape _t.graphicObject = null; // CShape or GroupShape
_t.flags = { _t.flags = {
...@@ -1843,35 +1842,6 @@ function DrawingObjects() { ...@@ -1843,35 +1842,6 @@ function DrawingObjects() {
_this.createDrawingObject = function() { _this.createDrawingObject = function() {
var drawing = new DrawingBase(worksheet); var drawing = new DrawingBase(worksheet);
drawing.chart.range.interval = function() {
var result = "";
if (worksheet) {
var selectedRange = worksheet.getSelectedRange();
if (selectedRange) {
var box = selectedRange.getBBox0();
var startCell = new CellAddress(box.r1, box.c1, 0);
var endCell = new CellAddress(box.r2, box.c2, 0);
if (startCell && endCell) {
var wsName = worksheet.model.sName;
if ( !rx_test_ws_name.test(wsName) )
wsName = "'" + wsName + "'";
if (startCell.getID() == endCell.getID())
result = wsName + "!" + startCell.getID();
else
result = wsName + "!" + startCell.getID() + ":" + endCell.getID();
}
}
}
return result;
}();
drawing.chart.range.intervalObject = function() {
return worksheet ? worksheet.getSelectedRange() : null;
}();
return drawing; return drawing;
} }
...@@ -1879,14 +1849,13 @@ function DrawingObjects() { ...@@ -1879,14 +1849,13 @@ function DrawingObjects() {
var copyObject = _this.createDrawingObject(); var copyObject = _this.createDrawingObject();
copyObject.worksheet = obj.worksheet; copyObject.worksheet = worksheet;
copyObject.Type = obj.Type; copyObject.Type = obj.Type;
copyObject.Pos.X = obj.Pos.X; copyObject.Pos.X = obj.Pos.X;
copyObject.Pos.Y = obj.Pos.Y; copyObject.Pos.Y = obj.Pos.Y;
copyObject.ext.cx = obj.ext.cx; copyObject.ext.cx = obj.ext.cx;
copyObject.ext.cy = obj.ext.cy; copyObject.ext.cy = obj.ext.cy;
copyObject.imageUrl = obj.imageUrl; copyObject.imageUrl = obj.imageUrl;
copyObject.from.col = obj.from.col; copyObject.from.col = obj.from.col;
...@@ -1899,15 +1868,7 @@ function DrawingObjects() { ...@@ -1899,15 +1868,7 @@ function DrawingObjects() {
copyObject.to.row = obj.to.row; copyObject.to.row = obj.to.row;
copyObject.to.rowOff = obj.to.rowOff; copyObject.to.rowOff = obj.to.rowOff;
copyObject.chart = new asc_CChart(obj.chart);
copyObject.graphicObject = obj.graphicObject; copyObject.graphicObject = obj.graphicObject;
if (isRealObject(copyObject.graphicObject) && typeof copyObject.graphicObject.setDrawingObjects === "function")
{
copyObject.graphicObject.setDrawingObjects(_this);
}
copyObject.chart.worksheet = obj.chart.worksheet;
return copyObject; return copyObject;
} }
...@@ -1944,26 +1905,27 @@ function DrawingObjects() { ...@@ -1944,26 +1905,27 @@ function DrawingObjects() {
aObjectsSync = []; aObjectsSync = [];
for (var i = 0; currentSheet.model.Drawings && (i < currentSheet.model.Drawings.length); i++) { for (var i = 0; currentSheet.model.Drawings && (i < currentSheet.model.Drawings.length); i++) {
currentSheet.model.Drawings[i].worksheet = worksheet; var drawingObject = _this.cloneDrawingObject(currentSheet.model.Drawings[i]);
var clone = _this.cloneDrawingObject(currentSheet.model.Drawings[i]);
if ( drawingObject.imageUrl) {
if ( currentSheet.model.Drawings[i].imageUrl) {
aObjectsSync[aObjectsSync.length] = clone; aObjectsSync[aObjectsSync.length] = drawingObject;
aImagesSync[aImagesSync.length] = clone.imageUrl; aImagesSync[aImagesSync.length] = drawingObject.imageUrl;
} }
if (drawingObject.graphicObject instanceof CChartAsGroup) {
if (clone.graphicObject instanceof CChartAsGroup) {
clone.worksheet = worksheet; _this.calcChartInterval(drawingObject.graphicObject.chart);
clone.graphicObject.drawingBase = clone; drawingObject.graphicObject.drawingBase = drawingObject;
clone.graphicObject.drawingObjects = _this; drawingObject.graphicObject.drawingObjects = _this;
if(clone.graphicObject.chartTitle)
clone.graphicObject.chartTitle.drawingObjects = _this; if (drawingObject.graphicObject.chartTitle)
clone.graphicObject.chart.worksheet = worksheet; drawingObject.graphicObject.chartTitle.drawingObjects = _this;
clone.graphicObject.init(aImagesSync);
aObjects.push( clone ); drawingObject.graphicObject.chart.worksheet = worksheet;
drawingObject.graphicObject.init(aImagesSync);
aObjects.push( drawingObject );
} }
} }
...@@ -1972,7 +1934,7 @@ function DrawingObjects() { ...@@ -1972,7 +1934,7 @@ function DrawingObjects() {
for (var i = 0; i < aObjectsSync.length; i++) { for (var i = 0; i < aObjectsSync.length; i++) {
var clone = aObjectsSync[i]; var drawingObject = aObjectsSync[i];
var image = api.ImageLoader.LoadImage(aImagesSync[i], 1); // Должна быть в мапе var image = api.ImageLoader.LoadImage(aImagesSync[i], 1); // Должна быть в мапе
if ( image != null ) { if ( image != null ) {
...@@ -1980,17 +1942,17 @@ function DrawingObjects() { ...@@ -1980,17 +1942,17 @@ function DrawingObjects() {
var headerTop = worksheet.getCellTop(0, 0); var headerTop = worksheet.getCellTop(0, 0);
var headerLeft = worksheet.getCellLeft(0, 0); var headerLeft = worksheet.getCellLeft(0, 0);
var x = pxToMm(clone.getVisibleLeftOffset() + headerLeft); var x = pxToMm(drawingObject.getVisibleLeftOffset() + headerLeft);
var y = pxToMm(clone.getVisibleTopOffset() + headerTop); var y = pxToMm(drawingObject.getVisibleTopOffset() + headerTop);
var w = pxToMm(clone.getWidthFromTo()); var w = pxToMm(drawingObject.getWidthFromTo());
var h = pxToMm(clone.getHeightFromTo()); var h = pxToMm(drawingObject.getHeightFromTo());
// CImage // CImage
clone.graphicObject = new CImage(clone, _this); drawingObject.graphicObject = new CImage(drawingObject, _this);
clone.graphicObject.initDefault( x, y, w, h, image.src ); drawingObject.graphicObject.initDefault( x, y, w, h, image.src );
clone.setGraphicObjectCoords(); drawingObject.setGraphicObjectCoords();
clone.graphicObject.draw(shapeCtx); drawingObject.graphicObject.draw(shapeCtx);
aObjects.push(clone); aObjects.push(drawingObject);
} }
} }
} }
...@@ -2225,6 +2187,7 @@ function DrawingObjects() { ...@@ -2225,6 +2187,7 @@ function DrawingObjects() {
worksheet._drawGrid(); worksheet._drawGrid();
worksheet._drawCells(); worksheet._drawCells();
worksheet._drawCellsBorders(); worksheet._drawCellsBorders();
worksheet._drawSelection();
worksheet.cellCommentator.drawCommentCells(false); worksheet.cellCommentator.drawCommentCells(false);
worksheet.autoFilters.drawAutoF(worksheet); worksheet.autoFilters.drawAutoF(worksheet);
} }
...@@ -2292,7 +2255,7 @@ function DrawingObjects() { ...@@ -2292,7 +2255,7 @@ function DrawingObjects() {
if ( !obj.canDraw() ) if ( !obj.canDraw() )
continue; continue;
if (!obj.flags.anchorUpdated) if ( !obj.flags.anchorUpdated )
obj.updateAnchorPosition(); obj.updateAnchorPosition();
// Shape render // Shape render
...@@ -2300,17 +2263,6 @@ function DrawingObjects() { ...@@ -2300,17 +2263,6 @@ function DrawingObjects() {
obj.graphicObject.draw(shapeCtx); obj.graphicObject.draw(shapeCtx);
continue; continue;
} }
// Выход за границы
while (worksheet.nColsCount < obj.to.col + 1) {
worksheet.expandColsOnScroll(true);
}
while (worksheet.nRowsCount < obj.to.row + 1) {
worksheet.expandRowsOnScroll(true);
}
/*if ( printOptions ) { /*if ( printOptions ) {
if ( obj.isChart() ) { if ( obj.isChart() ) {
...@@ -2338,22 +2290,18 @@ function DrawingObjects() { ...@@ -2338,22 +2290,18 @@ function DrawingObjects() {
} }
} }
if ( _this.selectedGraphicObjectsExists() )
if ( !printOptions ) { worksheet.cleanSelection();
worksheet._drawCollaborativeElements(); _this.raiseLayerDrawingObjects();
if ( _this.getSelectedDrawingObjectIndex() < 0 ) {
worksheet.cleanSelection();
worksheet._drawSelectionRange();
_this.raiseLayerDrawingObjects();
}
}
_this.selectGraphicObject(); _this.selectGraphicObject();
} }
_this.showOverlayGraphicObjects = function() { _this.showOverlayGraphicObjects = function() {
shapeOverlayCtx.put_GlobalAlpha(true, 0.5); shapeOverlayCtx.put_GlobalAlpha(true, 0.5);
shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix); shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
worksheet._drawSelection();
worksheet.cellCommentator.drawCommentCells(false);
worksheet.autoFilters.drawAutoF(worksheet);
_this.controller.drawTracks(shapeOverlayCtx); _this.controller.drawTracks(shapeOverlayCtx);
shapeOverlayCtx.put_GlobalAlpha(true, 1); shapeOverlayCtx.put_GlobalAlpha(true, 1);
} }
...@@ -2641,6 +2589,23 @@ function DrawingObjects() { ...@@ -2641,6 +2589,23 @@ function DrawingObjects() {
return this.controller.addChartDrawingObject(chart, bWithoutHistory, options); return this.controller.addChartDrawingObject(chart, bWithoutHistory, options);
} }
_this.editChartDrawingObject = function(chart) {
if ( chart ) {
chart.rebuildSeries();
chart.range.intervalObject = convertFormula(chart.range.interval, worksheet);
_this.controller.editChartDrawingObjects(chart);
_this.showDrawingObjects(false);
}
}
_this.rebuildChartGraphicObjects = function() {
for (var i = 0; i < _this.countDrawingObjects(); i++) {
var chart = aObjects[i].graphicObject;
if ( chart.isChart() )
chart.recalculate();
}
}
_this.deleteSelectedDrawingObject = function() { _this.deleteSelectedDrawingObject = function() {
var bResult = false; var bResult = false;
...@@ -2679,24 +2644,20 @@ function DrawingObjects() { ...@@ -2679,24 +2644,20 @@ function DrawingObjects() {
for (var i = 0; i < _this.countDrawingObjects(); i++) { for (var i = 0; i < _this.countDrawingObjects(); i++) {
var obj = aObjects[i]; var obj = aObjects[i];
var bbox = obj.isChart() ? obj.chart.range.intervalObject.getBBox0() : null; var bbox = obj.isChart() ? obj.graphicObject.chart.range.intervalObject.getBBox0() : null;
if (obj.isChart() || obj.isImage()) { if ( obj.isChart() || obj.isImage() ) {
//History.StartTransaction();
metrics = { from: {}, to: {} }; metrics = { from: {}, to: {} };
metrics.from.col = obj.from.col; metrics.to.col = obj.to.col; metrics.from.col = obj.from.col; metrics.to.col = obj.to.col;
metrics.from.colOff = obj.from.colOff; metrics.to.colOff = obj.to.colOff; metrics.from.colOff = obj.from.colOff; metrics.to.colOff = obj.to.colOff;
metrics.from.row = obj.from.row; metrics.to.row = obj.to.row; metrics.from.row = obj.from.row; metrics.to.row = obj.to.row;
metrics.from.rowOff = obj.from.rowOff; metrics.to.rowOff = obj.to.rowOff; metrics.from.rowOff = obj.from.rowOff; metrics.to.rowOff = obj.to.rowOff;
if (bInsert) { // Insert
if (bInsert) { // Insert
switch (operType) { switch (operType) {
case c_oAscInsertOptions.InsertColumns: case c_oAscInsertOptions.InsertColumns:
{ {
var count = updateRange.c2 - updateRange.c1 + 1; var count = updateRange.c2 - updateRange.c1 + 1;
// Position // Position
...@@ -2969,15 +2930,11 @@ function DrawingObjects() { ...@@ -2969,15 +2930,11 @@ function DrawingObjects() {
changedRange = new Range(worksheet.model, bbox.r1, bbox.c1, bbox.r2, bbox.c2); changedRange = new Range(worksheet.model, bbox.r1, bbox.c1, bbox.r2, bbox.c2);
} }
if (changedRange || metrics) { if ( changedRange || metrics ) {
//var copyObject = _this.cloneDrawingObject(obj);
//copyObject.flags.transactionState = c_oAscTransactionState.Start;
//History.Add(g_oUndoRedoDrawingObject, historyitem_DrawingObject_Edit, worksheet.model.getId(), null, copyObject);
if (changedRange) { if (changedRange) {
obj.chart.range.intervalObject = changedRange; obj.graphicObject.chart.range.intervalObject = changedRange;
_this.calcChartInterval(obj.chart); _this.calcChartInterval(obj.graphicObject.chart);
} }
if (metrics) { if (metrics) {
obj.from.col = metrics.from.col; obj.from.col = metrics.from.col;
...@@ -2990,13 +2947,12 @@ function DrawingObjects() { ...@@ -2990,13 +2947,12 @@ function DrawingObjects() {
obj.to.row = metrics.to.row; obj.to.row = metrics.to.row;
obj.to.rowOff = metrics.to.rowOff; obj.to.rowOff = metrics.to.rowOff;
} }
//var copyObject = _this.cloneDrawingObject(obj); // Update graphic object
//copyObject.flags.transactionState = c_oAscTransactionState.Stop; obj.graphicObject.setPosition( pxToMm(obj.getRealLeftOffset(true)), pxToMm(obj.getRealTopOffset(true)) );
//History.Add(g_oUndoRedoDrawingObject, historyitem_DrawingObject_Edit, worksheet.model.getId(), null, copyObject); obj.graphicObject.recalculateTransform();
obj.graphicObject.calculateTransformTextMatrix();
} }
//History.EndTransaction();
} }
} }
} }
...@@ -3005,33 +2961,35 @@ function DrawingObjects() { ...@@ -3005,33 +2961,35 @@ function DrawingObjects() {
if ( oBBoxFrom && oBBoxTo ) { if ( oBBoxFrom && oBBoxTo ) {
function editChart(chartObject) { function editChart(drawingObject) {
var copyObject = _this.cloneDrawingObject(chartObject);
copyObject.chart.range.intervalObject = worksheet._getRange(oBBoxTo.c1, oBBoxTo.r1, oBBoxTo.c2, oBBoxTo.r2); drawingObject.graphicObject.chart.range.intervalObject = worksheet._getRange(oBBoxTo.c1, oBBoxTo.r1, oBBoxTo.c2, oBBoxTo.r2);
_this.calcChartInterval(copyObject.chart); _this.calcChartInterval(drawingObject.graphicObject.chart);
copyObject.chart.rebuildSeries(); drawingObject.graphicObject.chart.rebuildSeries();
_this.unselectDrawingObjects(); drawingObject.graphicObject.recalculate();
_this.editChartDrawingObject(copyObject.chart); _this.editChartDrawingObject(drawingObject.graphicObject.chart);
} }
var bChartExists = false;
for (var i = 0; i < _this.countDrawingObjects(); i++) { for (var i = 0; i < _this.countDrawingObjects(); i++) {
var obj = aObjects[i]; var drawingObject = aObjects[i];
if ( obj.isChart() ) { if ( drawingObject.isChart() ) {
var bbox = obj.chart.range.intervalObject.getBBox0(); var bbox = drawingObject.graphicObject.chart.range.intervalObject.getBBox0();
if ( oBBoxFrom.isEqual(bbox) ) { if ( oBBoxFrom.isEqual(bbox) ) {
bChartExists = true;
if ( bResize && obj.graphicObject.selected ) { if ( bResize && drawingObject.graphicObject.selected ) {
editChart(obj); editChart(drawingObject);
return; return;
} }
else else
editChart(obj); editChart(drawingObject);
} }
} }
} }
if ( bChartExists )
_this.selectGraphicObject();
} }
} }
...@@ -3212,12 +3170,12 @@ function DrawingObjects() { ...@@ -3212,12 +3170,12 @@ function DrawingObjects() {
if ( _this.drawingDocument && _this.controller.selectedObjects.length ) { if ( _this.drawingDocument && _this.controller.selectedObjects.length ) {
_this.controller.drawSelection(_this.drawingDocument); _this.controller.drawSelection(_this.drawingDocument);
/*for (var i = 0; i < _this.controller.selectedObjects.length; i++) { for (var i = 0; i < _this.controller.selectedObjects.length; i++) {
var graphicObject = _this.controller.selectedObjects[i]; var graphicObject = _this.controller.selectedObjects[i];
if ( graphicObject.isChart() ) { if ( graphicObject.isChart() ) {
_this.selectDrawingObjectRange(graphicObject.Id); _this.selectDrawingObjectRange(graphicObject.Id);
} }
}*/ }
_this.drawWorksheetHeaders(); _this.drawWorksheetHeaders();
} }
...@@ -3407,27 +3365,39 @@ function DrawingObjects() { ...@@ -3407,27 +3365,39 @@ function DrawingObjects() {
return null; return null;
} }
_this.getAscChartObject = function() { // Return new or existing chart. For image return null _this.getAscChartObject = function() {
return this.controller.getAscChartObject(); var chart = this.controller.getAscChartObject();
if ( !chart ) {
chart = new asc_CChart();
chart.range.interval = function() {
var result = "";
if (worksheet) {
var selectedRange = worksheet.getSelectedRange();
if (selectedRange) {
var box = selectedRange.getBBox0();
var startCell = new CellAddress(box.r1, box.c1, 0);
var endCell = new CellAddress(box.r2, box.c2, 0);
var index = _this.getSelectedDrawingObjectIndex(); if (startCell && endCell) {
if (index >= 0) { var wsName = worksheet.model.sName;
if (aObjects[index].isChart()) if ( !rx_test_ws_name.test(wsName) )
return new asc.asc_CChart(aObjects[index].chart); wsName = "'" + wsName + "'";
else null;
} if (startCell.getID() == endCell.getID())
else { result = wsName + "!" + startCell.getID();
// Check iframe chart editor else
for (var i = 0; i < _this.countDrawingObjects(); i++) { result = wsName + "!" + startCell.getID() + ":" + endCell.getID();
if ( aObjects[i].isChart() && aObjects[i].chart.bChartEditor ) }
return new asc.asc_CChart(aObjects[i].chart); }
} }
return result;
// New chart object }();
var chart = new asc.asc_CChart(_this.createDrawingObject().chart); chart.range.intervalObject = function() {
return chart; return worksheet ? worksheet.getSelectedRange() : null;
}();
} }
return chart;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -3456,32 +3426,26 @@ function DrawingObjects() { ...@@ -3456,32 +3426,26 @@ function DrawingObjects() {
_this.selectDrawingObjectRange = function(id) { _this.selectDrawingObjectRange = function(id) {
worksheet.arrActiveChartsRanges = []; worksheet.arrActiveChartsRanges = [];
for (var i = 0; i < aObjects.length; i++) { for (var i = 0; i < aObjects.length; i++) {
var obj = aObjects[i]; var drawingObject = aObjects[i].graphicObject;
if ( obj.isChart() && (obj.graphicObject.Id == id) ) { if ( drawingObject.isChart() && (drawingObject.Id == id) ) {
if ( !obj.chart.range.intervalObject ) if ( !drawingObject.chart.range.intervalObject )
_this.intervalToIntervalObject(obj.chart); _this.intervalToIntervalObject(drawingObject.chart);
// Проверка для id листа // Проверка для id листа
if (obj.chart.range.intervalObject.worksheet.Id != worksheet.model.Id) if ( drawingObject.chart.range.intervalObject.worksheet.Id != worksheet.model.Id )
return; return;
var BB = obj.chart.range.intervalObject.getBBox0(), var BB = drawingObject.chart.range.intervalObject.getBBox0(),
range = asc.Range(BB.c1,BB.r1,BB.c2,BB.r2,true); range = asc.Range(BB.c1,BB.r1,BB.c2,BB.r2,true);
worksheet.arrActiveChartsRanges.push(range); worksheet.arrActiveChartsRanges.push(range);
worksheet.isChartAreaEditMode = true; worksheet.isChartAreaEditMode = true;
worksheet.overlayCtx.save() worksheet.overlayCtx.rect(worksheet.cellsLeft, worksheet.cellsTop, worksheet.overlayCtx.getWidth() - worksheet.cellsLeft, worksheet.overlayCtx.getHeight() - worksheet.cellsTop);
.beginPath() worksheet._drawFormulaRange(worksheet.arrActiveChartsRanges);
.rect(worksheet.cellsLeft, worksheet.cellsTop, worksheet.overlayCtx.getWidth() - worksheet.cellsLeft, worksheet.overlayCtx.getHeight() - worksheet.cellsTop)
.clip();
worksheet.overlayCtx.clear();
worksheet._drawFormulaRange(worksheet.arrActiveChartsRanges)
worksheet.overlayCtx.restore();
// слой c объектами должен быть выше селекта // слой c объектами должен быть выше селекта
_this.raiseLayerDrawingObjects(); _this.raiseLayerDrawingObjects();
...@@ -3740,7 +3704,6 @@ function DrawingObjects() { ...@@ -3740,7 +3704,6 @@ function DrawingObjects() {
// Update graphic object // Update graphic object
obj.graphicObject.setPosition( pxToMm(obj.getRealLeftOffset(true)), pxToMm(obj.getRealTopOffset(true)) ); obj.graphicObject.setPosition( pxToMm(obj.getRealLeftOffset(true)), pxToMm(obj.getRealTopOffset(true)) );
//obj.graphicObject.setExtents( pxToMm(obj.getWidthFromTo()), pxToMm(obj.getHeightFromTo()) );
obj.graphicObject.recalculateTransform(); obj.graphicObject.recalculateTransform();
obj.graphicObject.calculateTransformTextMatrix(); obj.graphicObject.calculateTransformTextMatrix();
} }
......
...@@ -1996,7 +1996,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1996,7 +1996,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
asc_editChartDrawingObject: function(chart) { asc_editChartDrawingObject: function(chart) {
this.wb.controller.isSelectDrawingObject = true; this.wb.controller.isSelectDrawingObject = true;
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
return ws.objectRender.controller.editChartDrawingObjects(chart); return ws.objectRender.editChartDrawingObject(chart);
}, },
asc_addImageDrawingObject: function(imageUrl) { asc_addImageDrawingObject: function(imageUrl) {
......
...@@ -739,8 +739,8 @@ function asc_CCellCommentator(currentSheet) { ...@@ -739,8 +739,8 @@ function asc_CCellCommentator(currentSheet) {
if ( !metrics.result || (metrics.width <= 0) || (metrics.height <= 0) ) if ( !metrics.result || (metrics.width <= 0) || (metrics.height <= 0) )
continue; continue;
// Inside drawing object // Inside drawing object
if ( _this.worksheet.objectRender.checkCursorDrawingObject(metrics.left + metrics.width, metrics.top) ) //if ( _this.worksheet.objectRender.checkCursorDrawingObject(metrics.left + metrics.width, metrics.top) )
continue; // continue;
this.overlayCtx.beginPath(); this.overlayCtx.beginPath();
this.overlayCtx.setFillStyle(this.commentIconColor); this.overlayCtx.setFillStyle(this.commentIconColor);
......
...@@ -25,7 +25,7 @@ DrawingObjectsController.prototype = ...@@ -25,7 +25,7 @@ DrawingObjectsController.prototype =
getAscChartObject: function() getAscChartObject: function()
{ {
if(this.selectedObjects.length === 1) if (this.selectedObjects.length === 1)
{ {
if(this.selectedObjects[0].isChart()) if(this.selectedObjects[0].isChart())
return this.selectedObjects[0].chart; return this.selectedObjects[0].chart;
...@@ -38,36 +38,8 @@ DrawingObjectsController.prototype = ...@@ -38,36 +38,8 @@ DrawingObjectsController.prototype =
} }
} }
} }
var chart = new asc_CChart();
var worksheet = this.drawingObjects.getWorksheet(); return null;
chart.range.interval = function() {
var result = "";
if (worksheet) {
var selectedRange = worksheet.getSelectedRange();
if (selectedRange) {
var box = selectedRange.getBBox0();
var startCell = new CellAddress(box.r1, box.c1, 0);
var endCell = new CellAddress(box.r2, box.c2, 0);
if (startCell && endCell) {
var wsName = worksheet.model.sName;
if ( !rx_test_ws_name.test(wsName) )
wsName = "'" + wsName + "'";
if (startCell.getID() == endCell.getID())
result = wsName + "!" + startCell.getID();
else
result = wsName + "!" + startCell.getID() + ":" + endCell.getID();
}
}
}
return result;
}();
chart.range.intervalObject = function() {
return worksheet ? worksheet.getSelectedRange() : null;
}();
return chart;
}, },
editChartDrawingObjects: function(chart) editChartDrawingObjects: function(chart)
...@@ -777,6 +749,12 @@ DrawingObjectsController.prototype = ...@@ -777,6 +749,12 @@ DrawingObjectsController.prototype =
{ {
var api = window["Asc"]["editor"]; var api = window["Asc"]["editor"];
var themeColors = api.GuiControlColorsMap; var themeColors = api.GuiControlColorsMap;
var aObjects = this.drawingObjects.getDrawingObjects();
for (var i = 0; i < aObjects.length; i++) {
if ( aObjects[i].graphicObject.isChart() )
aObjects[i].graphicObject.recalculate();
}
} }
}; };
......
...@@ -329,7 +329,7 @@ function NullState(drawingObjectsController, drawingObjects) ...@@ -329,7 +329,7 @@ function NullState(drawingObjectsController, drawingObjects)
if(isRealNumber(e.charCode)) if(isRealNumber(e.charCode))
{ {
selected_objects[0].paragraphAdd(new ParaText(String.fromCharCode(e.charCode))); selected_objects[0].paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
this.drawingObjects.showDrawingObjects(false); this.drawingObjects.showDrawingObjects(true);
} }
} }
...@@ -1601,6 +1601,7 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY, ...@@ -1601,6 +1601,7 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY,
if(gr_obj.isChart()) if(gr_obj.isChart())
{ {
this.drawingObjectsController.changeCurrentState(new ExtpectDoubleClickState(this.drawingObjectsController, this.drawingObjects)); this.drawingObjectsController.changeCurrentState(new ExtpectDoubleClickState(this.drawingObjectsController, this.drawingObjects));
asc["editor"].asc_endAddShape();
return; return;
/* if(false === this.graphicObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_Element_and_Type , Element : gr_obj.Parent, CheckType : changestype_Paragraph_Content} )) { /* if(false === this.graphicObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_Element_and_Type , Element : gr_obj.Parent, CheckType : changestype_Paragraph_Content} )) {
var chart = this.graphicObjects.majorGraphicObject.GraphicObj.chart.serializeChart(); var chart = this.graphicObjects.majorGraphicObject.GraphicObj.chart.serializeChart();
......
...@@ -605,7 +605,7 @@ ...@@ -605,7 +605,7 @@
} }
var graphicObjects = t.handlers.trigger("getSelectedGraphicObjects"); var graphicObjects = t.handlers.trigger("getSelectedGraphicObjects");
if ( graphicObjects.length ) { if ( graphicObjects.length && t.enableKeyEvents ) {
if (t.handlers.trigger("graphicObjectWindowKeyDown", event)) if (t.handlers.trigger("graphicObjectWindowKeyDown", event))
return true; return true;
} }
...@@ -903,7 +903,7 @@ ...@@ -903,7 +903,7 @@
if (t.settings.isViewerMode || t.isSelectionDialogMode) {return true;} if (t.settings.isViewerMode || t.isSelectionDialogMode) {return true;}
var graphicObjects = t.handlers.trigger("getSelectedGraphicObjects"); var graphicObjects = t.handlers.trigger("getSelectedGraphicObjects");
if ( graphicObjects.length ) { if ( graphicObjects.length && t.enableKeyEvents ) {
if (t.handlers.trigger("graphicObjectWindowKeyPress", event)) if (t.handlers.trigger("graphicObjectWindowKeyPress", event))
return true; return true;
} }
......
...@@ -5848,10 +5848,11 @@ ...@@ -5848,10 +5848,11 @@
if (isCoord) { if (isCoord) {
var drawingInfo = this.objectRender.checkCursorDrawingObject(x, y); var drawingInfo = this.objectRender.checkCursorDrawingObject(x, y);
if ( drawingInfo ) { if ( drawingInfo ) {
if ( drawingInfo.isGraphicObject ) this.objectRender.selectGraphicObject();
asc["editor"].isStartAddShape = true; }
else else {
asc["editor"].isStartAddShape = false; if ( !asc["editor"].isStartAddShape )
this.objectRender.unselectDrawingObjects();
} }
// move active range to coordinates x,y // move active range to coordinates x,y
...@@ -9136,6 +9137,7 @@ ...@@ -9136,6 +9137,7 @@
t._trigger("selectionChanged", t.getSelectionInfo()); t._trigger("selectionChanged", t.getSelectionInfo());
} }
t.objectRender.rebuildChartGraphicObjects();
t.cellCommentator.updateCommentPosition(); t.cellCommentator.updateCommentPosition();
t.draw(lockDraw); t.draw(lockDraw);
}, },
......
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