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() {
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}
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);
}
}
......@@ -3151,16 +3151,53 @@ function DrawingObjects() {
var _image = api.ImageLoader.LoadImage(imageUrl, 1);
var isOption = options && options.cell;
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
function calculateObjectMetrics(object, width, height) {
// Обработка картинок большого разрешения
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
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) {
if ( !_image.Image ) {
......@@ -3217,50 +3254,13 @@ function DrawingObjects() {
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}
function calculateObjectMetrics(object, width, height) {
// Обработка картинок большого разрешения
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
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);
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
}
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,15 +3269,7 @@ function DrawingObjects() {
if ( imageUrl ) {
var _image = api.ImageLoader.LoadImage(imageUrl, 1);
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
}
}
function addImageObject(_image) {
if ( !_image.Image ) {
......@@ -3306,6 +3298,15 @@ function DrawingObjects() {
}
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