Commit 8cbcb00b authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 19998 - Ошибка в консоли при повторной заливке автофигуры изображением

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49314 954022d7-b5bf-4e40-9824-e11837661b57
parent 9f60d261
...@@ -2931,7 +2931,7 @@ function DrawingObjects() { ...@@ -2931,7 +2931,7 @@ function DrawingObjects() {
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);
} }
else { else {
worksheet.model.workbook.handlers.trigger("asc_onError", api.asc_mapAscServerErrorToAscError(data.error), c_oAscError.Level.NoCritical); worksheet.model.workbook.handlers.trigger("asc_onError", api.asc_mapAscServerErrorToAscError(data["error"]), c_oAscError.Level.NoCritical);
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);
} }
} }
...@@ -3152,13 +3152,50 @@ function DrawingObjects() { ...@@ -3152,13 +3152,50 @@ function DrawingObjects() {
var _image = api.ImageLoader.LoadImage(imageUrl, 1); var _image = api.ImageLoader.LoadImage(imageUrl, 1);
var isOption = options && options.cell; var isOption = options && options.cell;
if (null != _image) { function calculateObjectMetrics(object, width, height) {
addImageObject(_image); // Обработка картинок большого разрешения
var metricCoeff = 1;
var realTopOffset = object.getRealTopOffset();
var realLeftOffset = object.getRealLeftOffset();
var areaWidth = worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) - worksheet.getCellLeft(worksheet.getFirstVisibleCol(), 0); // по ширине
if (areaWidth < width) {
metricCoeff = width / areaWidth;
width = areaWidth;
height /= metricCoeff;
} }
else {
_this.asyncImageEndLoaded = function(_image) { var areaHeight = worksheet.getCellTop(worksheet.getLastVisibleRow(), 0) - worksheet.getCellTop(worksheet.getFirstVisibleRow(), 0); // по высоте
addImageObject(_image); if (areaHeight < height) {
metricCoeff = height / areaHeight;
height = areaHeight;
width /= metricCoeff;
}
var endPoint = worksheet._findColUnderCursor(pxToPt(realLeftOffset + width), true);
while (endPoint == null) {
worksheet.expandColsOnScroll(true);
endPoint = worksheet._findColUnderCursor(pxToPt(realLeftOffset + width), true);
}
worksheet.expandColsOnScroll(true); // для colOff
object.to.col = worksheet._findColUnderCursor(pxToPt(realLeftOffset + width), true).col;
object.to.colOff = pxToMm(realLeftOffset + width - worksheet.getCellLeft(object.to.col, 0));
endPoint = worksheet._findRowUnderCursor(pxToPt(realTopOffset + height), true);
while (endPoint == null) {
worksheet.expandRowsOnScroll(true);
endPoint = worksheet._findRowUnderCursor(pxToPt(realTopOffset + height), true);
} }
worksheet.expandRowsOnScroll(true); // для rowOff
object.to.row = worksheet._findRowUnderCursor(pxToPt(realTopOffset + height), true).row;
object.to.rowOff = pxToMm(realTopOffset + height - worksheet.getCellTop(object.to.row, 0));
worksheet._trigger("reinitializeScroll");
} }
function addImageObject(_image) { function addImageObject(_image) {
...@@ -3217,50 +3254,13 @@ function DrawingObjects() { ...@@ -3217,50 +3254,13 @@ function DrawingObjects() {
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);
} }
function calculateObjectMetrics(object, width, height) { if (null != _image) {
// Обработка картинок большого разрешения addImageObject(_image);
var metricCoeff = 1;
var realTopOffset = object.getRealTopOffset();
var realLeftOffset = object.getRealLeftOffset();
var areaWidth = worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) - worksheet.getCellLeft(worksheet.getFirstVisibleCol(), 0); // по ширине
if (areaWidth < width) {
metricCoeff = width / areaWidth;
width = areaWidth;
height /= metricCoeff;
}
var areaHeight = worksheet.getCellTop(worksheet.getLastVisibleRow(), 0) - worksheet.getCellTop(worksheet.getFirstVisibleRow(), 0); // по высоте
if (areaHeight < height) {
metricCoeff = height / areaHeight;
height = areaHeight;
width /= metricCoeff;
}
var endPoint = worksheet._findColUnderCursor(pxToPt(realLeftOffset + width), true);
while (endPoint == null) {
worksheet.expandColsOnScroll(true);
endPoint = worksheet._findColUnderCursor(pxToPt(realLeftOffset + width), true);
} }
worksheet.expandColsOnScroll(true); // для colOff else {
_this.asyncImageEndLoaded = function(_image) {
object.to.col = worksheet._findColUnderCursor(pxToPt(realLeftOffset + width), true).col; addImageObject(_image);
object.to.colOff = pxToMm(realLeftOffset + width - worksheet.getCellLeft(object.to.col, 0));
endPoint = worksheet._findRowUnderCursor(pxToPt(realTopOffset + height), true);
while (endPoint == null) {
worksheet.expandRowsOnScroll(true);
endPoint = worksheet._findRowUnderCursor(pxToPt(realTopOffset + height), true);
} }
worksheet.expandRowsOnScroll(true); // для rowOff
object.to.row = worksheet._findRowUnderCursor(pxToPt(realTopOffset + height), true).row;
object.to.rowOff = pxToMm(realTopOffset + height - worksheet.getCellTop(object.to.row, 0));
worksheet._trigger("reinitializeScroll");
} }
} }
} }
...@@ -3269,14 +3269,6 @@ function DrawingObjects() { ...@@ -3269,14 +3269,6 @@ function DrawingObjects() {
if ( imageUrl ) { if ( imageUrl ) {
var _image = api.ImageLoader.LoadImage(imageUrl, 1); var _image = api.ImageLoader.LoadImage(imageUrl, 1);
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
}
}
function addImageObject(_image) { function addImageObject(_image) {
...@@ -3306,6 +3298,15 @@ function DrawingObjects() { ...@@ -3306,6 +3298,15 @@ function DrawingObjects() {
} }
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);
} }
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
}
}
} }
} }
......
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