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

common/Drawings/DrawingObjectsHandlers to function-closure

delete common/Drawings/Joined.js
parent 68581759
......@@ -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",
......
"use strict";
(function(window, undefined){
// Import
var HANDLE_EVENT_MODE_HANDLE = AscFormat.HANDLE_EVENT_MODE_HANDLE;
......@@ -593,8 +595,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;
......@@ -734,4 +734,13 @@ function handleFloatTable(drawing, drawingObjectsController, e, x, y, group, pag
}
}
return false;
}
\ No newline at end of file
}
//--------------------------------------------------------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);
"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
......@@ -196,7 +196,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)
......@@ -211,7 +211,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)
......@@ -229,7 +229,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)
......@@ -245,7 +245,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)
......@@ -409,7 +409,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();
},
......@@ -492,7 +492,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);
},
......@@ -701,7 +701,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();
......@@ -750,7 +750,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)
}
};
......
......@@ -356,4 +356,4 @@ function SplineForDrawer(spline)
window['AscFormat'].SplineCommandLineTo = SplineCommandLineTo;
window['AscFormat'].SplineCommandBezier = SplineCommandBezier;
window['AscFormat'].Spline = Spline;
})(window);
\ No newline at end of file
})(window);
......@@ -164,7 +164,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);
......@@ -211,7 +211,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)
......@@ -229,7 +229,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)
......@@ -253,7 +253,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)
......@@ -282,7 +282,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)
......@@ -304,7 +304,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)
......@@ -322,7 +322,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)
......@@ -338,7 +338,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)
......@@ -439,7 +439,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);
}
};
......@@ -558,7 +558,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);
},
......@@ -708,7 +708,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();
},
......@@ -768,7 +768,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();
......@@ -812,7 +812,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)
}
};
......@@ -863,7 +863,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};
......@@ -1397,7 +1397,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;
......@@ -1482,7 +1482,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