Commit 13d18478 authored by GoshaZotov's avatar GoshaZotov

change position special paste button(shape)

parent ffbf1f28
......@@ -1389,30 +1389,27 @@
if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart)
{
var sProps = Asc.c_oSpecialPasteProps;
var curParPos = isIntoShape.Content[isIntoShape.CurPos.ContentPos].CurPos;
var curShape = isIntoShape.Parent.parent;
var asc_getcvt = Asc.getCvtRatio;
var mmToPx = asc_getcvt(3/*px*/, 0/*pt*/, worksheet._getPPIX());
var ptToPx = asc_getcvt(1/*px*/, 0/*pt*/, worksheet._getPPIX());
var cellsLeftPx = worksheet.cellsLeft * ptToPx;
var cellsTopPx = worksheet.cellsTop * ptToPx;
var offsetXPx = worksheet.cols[worksheet.visibleRange.c1].left * ptToPx - cellsLeftPx;
var offsetYPx = worksheet.rows[worksheet.visibleRange.r1].top * ptToPx - cellsTopPx;
var cellsLeft = worksheet.cellsLeft * ptToPx;
var cellsTop = worksheet.cellsTop * ptToPx;
var x_curParPosPx = curParPos.X * mmToPx;
var x_curShapePosPx = curShape.x * mmToPx + cellsLeftPx;
var xPos = x_curParPosPx + x_curShapePosPx - offsetXPx;
var y_curParPosPx = curParPos.Y * mmToPx;
var y_curShapePosPx = curShape.y * mmToPx + cellsTopPx;
var yPos = y_curParPosPx + y_curShapePosPx - offsetYPx;
var position = {x: xPos, y: yPos};
var cursorPos = target_doc_content.Cursor_GetPos();
var offsetX = worksheet.cols[worksheet.visibleRange.c1].left * ptToPx - cellsLeft;
var offsetY = worksheet.rows[worksheet.visibleRange.r1].top * ptToPx - cellsTop;
var posX = curShape.transformText.TransformPointX(cursorPos.X, cursorPos.Y) * mmToPx - offsetX + cellsLeft;
var posY = curShape.transformText.TransformPointY(cursorPos.X, cursorPos.Y) * mmToPx - offsetY + cellsTop;
var position = {x: posX, y: posY};
var allowedSpecialPasteProps = [sProps.sourceformatting, sProps.destinationFormatting];
worksheet.showSpecialPasteOptions(allowedSpecialPasteProps, null, position);
window["Asc"]["editor"].wb.clipboard.specialPasteRange = cursorPos;
window["Asc"]["editor"].wb.clipboard.specialPasteShapeId = isIntoShape.Id;
}
},
......
......@@ -8815,7 +8815,8 @@
window["Asc"]["editor"].wb.clipboard.start_paste();
//откатываемся до того, что было до вставки
if(preSpecialPasteData && preSpecialPasteData.data)
var isIntoShape = this.objectRender.controller.getTargetDocContent(true);
if(!isIntoShape && preSpecialPasteData && preSpecialPasteData.data)
{
var tempProps = new Asc.SpecialPasteProps();
api.wb.clipboard.specialPasteProps = tempProps;
......@@ -8828,13 +8829,12 @@
undoPreviousPaste();
}
else if(preSpecialPasteData && preSpecialPasteData.shapeSelectionState)
else if(isIntoShape && preSpecialPasteData && preSpecialPasteData.shapeSelectionState)
{
//таким образом удаляю вставляенный фрагмент до специальной вставки
var docContent = this.objectRender.controller.getTargetDocContent(true);
var State = preSpecialPasteData.shapeSelectionState;
docContent.Set_SelectionState(State, State.length - 1);
docContent.Remove(1, true, true);
isIntoShape.Set_SelectionState(State, State.length - 1);
isIntoShape.Remove(1, true, true);
}
//далее специальная вставка
......@@ -9847,7 +9847,43 @@
WorksheetView.prototype.updateSpecialPasteOptionsPosition = function()
{
var _clipboard = window["Asc"]["editor"].wb.clipboard;
if(_clipboard.showSpecialPasteButton && _clipboard.specialPasteRange)
var isIntoShape = this.objectRender.controller.getTargetDocContent(true);
if(_clipboard.showSpecialPasteButton && isIntoShape)
{
if(_clipboard.specialPasteShapeId === isIntoShape.Id && _clipboard.specialPasteRange)
{
var specialPasteShowOptions = new Asc.SpecialPasteShowOptions();
var range = _clipboard.specialPasteRange;
/*var trueShapeSelection = isIntoShape.Get_SelectionState();
isIntoShape.Set_SelectionState(range, range.length - 1);*/
var sProps = Asc.c_oSpecialPasteProps;
var curShape = isIntoShape.Parent.parent;
var asc_getcvt = Asc.getCvtRatio;
var mmToPx = asc_getcvt(3/*px*/, 0/*pt*/, this._getPPIX());
var ptToPx = asc_getcvt(1/*px*/, 0/*pt*/, this._getPPIX());
var cellsLeft = this.cellsLeft * ptToPx;
var cellsTop = this.cellsTop * ptToPx;
var cursorPos = range//isIntoShape.Cursor_GetPos();
var offsetX = this.cols[this.visibleRange.c1].left * ptToPx - cellsLeft;
var offsetY = this.rows[this.visibleRange.r1].top * ptToPx - cellsTop;
var posX = curShape.transformText.TransformPointX(cursorPos.X, cursorPos.Y) * mmToPx - offsetX + cellsLeft;
var posY = curShape.transformText.TransformPointY(cursorPos.X, cursorPos.Y) * mmToPx - offsetY + cellsTop;
cellCoord = new AscCommon.asc_CRect( posX, posY, 0, 0 );
specialPasteShowOptions.asc_setCellCoord(cellCoord);
this.handlers.trigger("showSpecialPasteOptions", specialPasteShowOptions);
//isIntoShape.Set_SelectionState(trueShapeSelection, trueShapeSelection.length - 1);
}
}
else if(_clipboard.showSpecialPasteButton && _clipboard.specialPasteRange)
{
var specialPasteShowOptions = new Asc.SpecialPasteShowOptions();
var range = _clipboard.specialPasteRange;
......
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