Commit b1612b73 authored by Alexey.Musinov's avatar Alexey.Musinov

add images fixed

parent 343aa07e
......@@ -4823,7 +4823,9 @@ function OfflineEditor () {
if (imageUrl && !objectRender.isViewerMode()) {
var _image = _api.ImageLoader.LoadImage(imageUrl, 1);
var _image = new Image();
_image.src = imageUrl
var isOption = true;//options && options.cell;
var calculateObjectMetrics = function (object, width, height) {
......@@ -4852,7 +4854,7 @@ function OfflineEditor () {
var findVal = pxToPt(realLeftOffset + width);
var toCell = worksheet.findCellByXY(findVal, 0, true, false, true);
while (toCell.col === null && worksheet.cols.length < AscCommon.gc_nMaxCol) {
while (toCell.col === null && worksheet.cols.length < gc_nMaxCol) {
worksheet.expandColsOnScroll(true);
toCell = worksheet.findCellByXY(findVal, 0, true, false, true);
}
......@@ -4861,30 +4863,22 @@ function OfflineEditor () {
findVal = pxToPt(realTopOffset + height);
toCell = worksheet.findCellByXY(0, findVal, true, true, false);
while (toCell.row === null && worksheet.rows.length < AscCommon.gc_nMaxRow) {
while (toCell.row === null && worksheet.rows.length < gc_nMaxRow) {
worksheet.expandRowsOnScroll(true);
toCell = worksheet.findCellByXY(0, findVal, true, true, false);
}
object.to.row = toCell.row;
object.to.rowOff = ptToMm(toCell.rowOff);
// worksheet.handlers.trigger("reinitializeScroll");
};
var addImageObject = function (_image) {
//if (!_image.Image) {
// worksheet.model.workbook.handlers.trigger("asc_onError", Asc.c_oAscError.ID.UplImageUrl, Asc.c_oAscError.Level.NoCritical);
//} else {
var drawingObject = _this.createDrawingObject();
drawingObject.worksheet = worksheet;
var activeCell = worksheet.model.selectionRange.activeCell;
drawingObject.from.col = //isOption ? options.cell.col :
activeCell.col;
drawingObject.from.row = //isOption ? options.cell.row :
activeCell.row;
drawingObject.from.col = activeCell.col;
drawingObject.from.row = activeCell.row;
// Проверяем начальные координаты при вставке
while (!worksheet.cols[drawingObject.from.col]) {
......@@ -4897,8 +4891,6 @@ function OfflineEditor () {
}
worksheet.expandRowsOnScroll(true); // для rowOff
//calculateObjectMetrics(drawingObject, isOption ? options.width : _image.Image.width, isOption ? options.height : _image.Image.height);
calculateObjectMetrics(drawingObject, options[1], options[2]);
var coordsFrom = _this.coordsManager.calculateCoords(drawingObject.from);
......@@ -4911,11 +4903,8 @@ function OfflineEditor () {
if (bLock !== true)
return;
_this.controller.resetSelection();
_this.controller.addImageFromParams(imageUrl,
// _image.src,
pxToMm(coordsFrom.x) + AscFormat.MOVE_DELTA, pxToMm(coordsFrom.y) + AscFormat.MOVE_DELTA, pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y));
_this.controller.addImageFromParams(_image.src, pxToMm(coordsFrom.x) + MOVE_DELTA, pxToMm(coordsFrom.y) + MOVE_DELTA, pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y));
});
//}
worksheet.setSelectionShape(true);
......@@ -4924,7 +4913,7 @@ function OfflineEditor () {
}
};
addImageObject(new Image());
addImageObject(_image);
}
return objectId;
......
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