Commit d9afb666 authored by Alexander.Trofimov's avatar Alexander.Trofimov

common/Drawings/DrawingObjectsHandlers to function-closure

delete common/Drawings/Joined.js
parent ae4af0bb
......@@ -34,7 +34,6 @@
"../common/Charts/DrawingObjects.js",
"../common/Charts/3DTransformation.js",
"../common/Charts/ChartsDrawer.js",
"../common/Drawings/TrackObjects/AdjustmentTracks.js",
"../common/Drawings/TrackObjects/MoveTracks.js",
"../common/Drawings/TrackObjects/NewShapeTracks.js",
......@@ -42,6 +41,7 @@
"../common/Drawings/TrackObjects/ResizeTracks.js",
"../common/Drawings/TrackObjects/RotateTracks.js",
"../common/Drawings/TrackObjects/Spline.js",
"../common/Drawings/DrawingObjectsHandlers.js",
"../common/scroll.js",
"../cell/view/iscroll.js",
......@@ -100,7 +100,6 @@
"../common/Shapes/SerializeWriter.js",
"../common/SerializeCommonWordExcel.js",
"../common/SerializeChart.js",
"../common/Drawings/DrawingObjectsHandlers.js",
"../common/Drawings/TextDrawer.js",
"../cell/view/DrawingObjectsController.js",
"../cell/model/DrawingObjects/Graphics.js",
......
......@@ -34,7 +34,6 @@
"../common/Charts/DrawingObjects.js",
"../common/Charts/3DTransformation.js",
"../common/Charts/ChartsDrawer.js",
"../common/Drawings/TrackObjects/AdjustmentTracks.js",
"../common/Drawings/TrackObjects/MoveTracks.js",
"../common/Drawings/TrackObjects/NewShapeTracks.js",
......@@ -42,6 +41,7 @@
"../common/Drawings/TrackObjects/ResizeTracks.js",
"../common/Drawings/TrackObjects/RotateTracks.js",
"../common/Drawings/TrackObjects/Spline.js",
"../common/Drawings/DrawingObjectsHandlers.js",
"../common/scroll.js",
......@@ -75,7 +75,6 @@
"../word/Editor/Common.js",
"../word/Editor/Sections.js",
"../word/Editor/History.js",
"../common/Drawings/DrawingObjectsHandlers.js",
"../word/Drawing/HatchPattern.js",
"../word/Drawing/Graphics.js",
"../common/Overlay.js",
......
......@@ -37,7 +37,6 @@
"../common/Charts/DrawingObjects.js",
"../common/Charts/3DTransformation.js",
"../common/Charts/ChartsDrawer.js",
"../common/Drawings/TrackObjects/AdjustmentTracks.js",
"../common/Drawings/TrackObjects/MoveTracks.js",
"../common/Drawings/TrackObjects/NewShapeTracks.js",
......@@ -45,6 +44,7 @@
"../common/Drawings/TrackObjects/ResizeTracks.js",
"../common/Drawings/TrackObjects/RotateTracks.js",
"../common/Drawings/TrackObjects/Spline.js",
"../common/Drawings/DrawingObjectsHandlers.js",
"../common/scroll.js",
"../common/Scrolls/iscroll.js",
......@@ -63,8 +63,6 @@
"../word/Drawing/Externals.js",
"../common/GlobalLoaders.js",
"../word/Drawing/translations.js",
"../common/Drawings/DrawingObjectsHandlers.js",
"../common/Drawings/Joined.js",
"../common/Drawings/TextDrawer.js",
"../word/Editor/GraphicObjects/Format/ShapePrototype.js",
"../word/Editor/GraphicObjects/Format/ImagePrototype.js",
......
......@@ -24,6 +24,8 @@
*/
"use strict";
(function(window, undefined){
// Import
var HANDLE_EVENT_MODE_HANDLE = AscFormat.HANDLE_EVENT_MODE_HANDLE;
......@@ -487,8 +489,6 @@ function handleInlineChart(drawing, drawingObjectsController, e, x, y, pageIndex
return handleInlineShapeImage(drawing, drawingObjectsController, e, x, y, pageIndex);
}
function handleInlineHitNoText(drawing, drawingObjects, e, x, y, pageIndex, bInSelect)
{
var selected_objects = drawingObjects.selectedObjects;
......@@ -629,3 +629,12 @@ function handleFloatTable(drawing, drawingObjectsController, e, x, y, group, pag
}
return false;
}
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CheckCoordsNeedPage = CheckCoordsNeedPage;
window['AscFormat'].handleSelectedObjects = handleSelectedObjects;
window['AscFormat'].handleFloatObjects = handleFloatObjects;
window['AscFormat'].handleInlineObjects = handleInlineObjects;
window['AscFormat'].handleMouseUpPreMoveState = handleMouseUpPreMoveState;
})(window);
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
var min_distance_joined=2;
function JoinedH(shape1, shape2)
{
var l, r, l2, r2;
l=shape1.x;
r=l+shape1.extX;
l2=shape2.x;
r2=l2+shape2.extX;
var d=l-l2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=l-r2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=r-l2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=r-r2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
return 0;
}
function JoinedV(shape1, shape2)
{
var t, b, t2, b2;
t=shape1.y;
b=t+shape1.extY;
t2=shape2.y;
b2=t2+shape2.extY;
var d=t-t2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=t-b2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=b-t2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=b-b2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
return 0;
}
function JoinedPointH(X, shape2)
{
var l2, r2;
l2=shape2.x;
r2=l2+shape2.extX;
var d=X-l2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=X-r2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
return 0;
}
function JoinedPointV(Y, shape2)
{
var t2, b2;
t2=shape2.y;
b2=t2+shape2.extY;
var d=Y-t2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
d=Y-b2;
if(Math.abs(d)<min_distance_joined)
{
return d;
}
return 0;
}
\ No newline at end of file
......@@ -220,7 +220,7 @@ NullState.prototype =
if(selection.groupSelection)
{
ret = handleSelectedObjects(this.drawingObjects, e, x, y, selection.groupSelection, pageIndex, false);
ret = AscFormat.handleSelectedObjects(this.drawingObjects, e, x, y, selection.groupSelection, pageIndex, false);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -235,7 +235,7 @@ NullState.prototype =
}
return ret;
}
ret = handleFloatObjects(this.drawingObjects, selection.groupSelection.arrGraphicObjects, e, x, y, selection.groupSelection, pageIndex, false);
ret = AscFormat.handleFloatObjects(this.drawingObjects, selection.groupSelection.arrGraphicObjects, e, x, y, selection.groupSelection, pageIndex, false);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -253,7 +253,7 @@ NullState.prototype =
}
else if(selection.chartSelection)
{}
ret = handleSelectedObjects(this.drawingObjects, e, x, y, null, pageIndex, false);
ret = AscFormat.handleSelectedObjects(this.drawingObjects, e, x, y, null, pageIndex, false);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -269,7 +269,7 @@ NullState.prototype =
return ret;
}
ret = handleFloatObjects(this.drawingObjects, this.drawingObjects.getDrawingArray(), e, x, y, null, pageIndex, false);
ret = AscFormat.handleFloatObjects(this.drawingObjects, this.drawingObjects.getDrawingArray(), e, x, y, null, pageIndex, false);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -433,7 +433,7 @@ ChangeAdjState.prototype =
this.onMouseUp(e, x, y, pageIndex);
return;
}
var t = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.getDrawingDocument());
var t = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.getDrawingDocument());
this.drawingObjects.arrTrackObjects[0].track(t.x, t.y);
this.drawingObjects.updateOverlay();
},
......@@ -516,7 +516,7 @@ RotateState.prototype =
this.onMouseUp(e, x, y, pageIndex);
return;
}
var coords = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.getDrawingDocument());
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.getDrawingDocument());
this.drawingObjects.handleRotateTrack(e, coords.x, coords.y);
},
......@@ -725,7 +725,7 @@ ResizeState.prototype =
this.onMouseUp(e, x, y, pageIndex);
return;
}
var coords = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.getDrawingDocument());
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.getDrawingDocument());
var resize_coef = this.majorObject.getResizeCoefficients(this.handleNum, coords.x, coords.y);
this.drawingObjects.trackResizeObjects(resize_coef.kd1, resize_coef.kd2, e);
this.drawingObjects.updateOverlay();
......@@ -774,7 +774,7 @@ PreMoveState.prototype =
onMouseUp: function(e, x, y, pageIndex)
{
return handleMouseUpPreMoveState(this.drawingObjects, e, x, y, pageIndex, true)
return AscFormat.handleMouseUpPreMoveState(this.drawingObjects, e, x, y, pageIndex, true)
}
};
......
......@@ -188,7 +188,7 @@ NullState.prototype =
{
b_no_handle_selected = true;
var object_page_x, object_page_y;
var coords = CheckCoordsNeedPage(x, y, pageIndex, selection.wrapPolygonSelection.selectStartPage, this.drawingObjects.drawingDocument);
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, selection.wrapPolygonSelection.selectStartPage, this.drawingObjects.drawingDocument);
object_page_x = coords.x;
object_page_y = coords.y;
var hit_to_wrap_polygon = selection.wrapPolygonSelection.parent.hitToWrapPolygonPoint(object_page_x, object_page_y);
......@@ -235,7 +235,7 @@ NullState.prototype =
}
else if(selection.groupSelection)
{
ret = handleSelectedObjects(this.drawingObjects, e, x, y, selection.groupSelection, pageIndex, true);
ret = AscFormat.handleSelectedObjects(this.drawingObjects, e, x, y, selection.groupSelection, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -253,7 +253,7 @@ NullState.prototype =
}
if(selection.groupSelection.selectStartPage === pageIndex){
ret = handleFloatObjects(this.drawingObjects, selection.groupSelection.arrGraphicObjects, e, x, y, selection.groupSelection, pageIndex, true);
ret = AscFormat.handleFloatObjects(this.drawingObjects, selection.groupSelection.arrGraphicObjects, e, x, y, selection.groupSelection, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -277,7 +277,7 @@ NullState.prototype =
if(!b_no_handle_selected)
{
ret = handleSelectedObjects(this.drawingObjects, e, x, y, null, pageIndex, true);
ret = AscFormat.handleSelectedObjects(this.drawingObjects, e, x, y, null, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -306,7 +306,7 @@ NullState.prototype =
}
if(drawing_page)
{
ret = handleFloatObjects(this.drawingObjects, drawing_page.beforeTextObjects, e, x, y, null, pageIndex, true);
ret = AscFormat.handleFloatObjects(this.drawingObjects, drawing_page.beforeTextObjects, e, x, y, null, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -328,7 +328,7 @@ NullState.prototype =
if(!(drawing_page.inlineObjects[i].parent && drawing_page.inlineObjects[i].parent.isShapeChild()))
no_shape_child_array.push(drawing_page.inlineObjects[i]);
}
ret = handleInlineObjects(this.drawingObjects, no_shape_child_array, e, x, y, pageIndex, true);
ret = AscFormat.handleInlineObjects(this.drawingObjects, no_shape_child_array, e, x, y, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -346,7 +346,7 @@ NullState.prototype =
if(!bTextFlag)
{
ret = handleFloatObjects(this.drawingObjects, drawing_page.wrappingObjects, e, x, y, null, pageIndex, true);
ret = AscFormat.handleFloatObjects(this.drawingObjects, drawing_page.wrappingObjects, e, x, y, null, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -362,7 +362,7 @@ NullState.prototype =
return ret;
}
ret = handleFloatObjects(this.drawingObjects, drawing_page.behindDocObjects, e, x, y, null, pageIndex, true);
ret = AscFormat.handleFloatObjects(this.drawingObjects, drawing_page.behindDocObjects, e, x, y, null, pageIndex, true);
if(ret)
{
if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
......@@ -463,7 +463,7 @@ PreMoveInlineObject.prototype =
onMouseUp: function(e, x,y,pageIndex)
{
return handleMouseUpPreMoveState(this.drawingObjects, e, x, y,pageIndex, true);
return AscFormat.handleMouseUpPreMoveState(this.drawingObjects, e, x, y,pageIndex, true);
}
};
......@@ -582,7 +582,7 @@ RotateState.prototype =
this.onMouseUp(e, x, y, pageIndex);
return;
}
var coords = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
this.drawingObjects.handleRotateTrack(e, coords.x, coords.y);
},
......@@ -732,7 +732,7 @@ ChangeAdjState.prototype =
this.onMouseUp(e, x, y, pageIndex);
return;
}
var t = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
var t = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
this.drawingObjects.arrTrackObjects[0].track(t.x, t.y);
this.drawingObjects.updateOverlay();
},
......@@ -792,7 +792,7 @@ ResizeState.prototype =
this.onMouseUp(e, x, y, pageIndex);
return;
}
var coords = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
var resize_coef = this.majorObject.getResizeCoefficients(this.handleNum, coords.x, coords.y);
this.drawingObjects.trackResizeObjects(resize_coef.kd1, resize_coef.kd2, e);
this.drawingObjects.updateOverlay();
......@@ -836,7 +836,7 @@ PreMoveState.prototype =
onMouseUp: function(e, x, y, pageIndex)
{
return handleMouseUpPreMoveState(this.drawingObjects, e, x, y, pageIndex, true)
return AscFormat.handleMouseUpPreMoveState(this.drawingObjects, e, x, y, pageIndex, true)
}
};
......@@ -887,7 +887,7 @@ MoveState.prototype =
}
}
var t = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
var t = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage, this.drawingObjects.drawingDocument);
var startPage = this.drawingObjects.graphicPages[this.majorObject.selectStartPage];
var startPos = {x: this.startX, y: this.startY};
......@@ -1421,7 +1421,7 @@ ChangeWrapContour.prototype.onMouseDown = function(e, x, y, pageIndex)
{};
ChangeWrapContour.prototype.onMouseMove = function(e, x, y, pageIndex)
{
var coords = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage);
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage);
var tr_x, tr_y;
tr_x = coords.x;
tr_y = coords.y;
......@@ -1506,7 +1506,7 @@ ChangeWrapContourAddPoint.prototype.onMouseDown = function(e, x, y, pageIndex)
{};
ChangeWrapContourAddPoint.prototype.onMouseMove = function(e, x, y, pageIndex)
{
var coords = CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage);
var coords = AscFormat.CheckCoordsNeedPage(x, y, pageIndex, this.majorObject.selectStartPage);
var tr_x, tr_y;
tr_x = coords.x;
tr_y = coords.y;
......
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