Commit d5243457 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug 25175 - Вставка автофигуры происходит некорректно, если курсор попадает на уровень меню

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57105 954022d7-b5bf-4e40-9824-e11837661b57
parent cb67ab1a
...@@ -181,18 +181,28 @@ function FrozenPlace(ws, type) { ...@@ -181,18 +181,28 @@ function FrozenPlace(ws, type) {
return vr; return vr;
}; };
_this.getRect = function() { _this.getRect = function(bEvent) {
var rect = { x: 0, y: 0, w: 0, h: 0 }; var rect = { x: 0, y: 0, w: 0, h: 0, r: 0, b: 0 };
rect.x = _this.worksheet.getCellLeftRelative(_this.range.c1, 0); rect.x = _this.worksheet.getCellLeftRelative(_this.range.c1, 0);
rect.y = _this.worksheet.getCellTopRelative(_this.range.r1, 0); rect.y = _this.worksheet.getCellTopRelative(_this.range.r1, 0);
rect.w = _this.worksheet.getCellLeftRelative(_this.range.c2, 0) + _this.worksheet.getColumnWidth(_this.range.c2, 0) - rect.x; rect.w = _this.worksheet.getCellLeftRelative(_this.range.c2, 0) + _this.worksheet.getColumnWidth(_this.range.c2, 0) - rect.x;
rect.h = _this.worksheet.getCellTopRelative(_this.range.r2, 0) + _this.worksheet.getRowHeight(_this.range.r2, 0) - rect.y; rect.h = _this.worksheet.getCellTopRelative(_this.range.r2, 0) + _this.worksheet.getRowHeight(_this.range.r2, 0) - rect.y;
rect.r = rect.x + rect.w;
rect.b = rect.y + rect.h;
switch (_this.type) { switch (_this.type) {
case FrozenAreaType.Top: case FrozenAreaType.Top:
{ {
rect.w = +Infinity; rect.w = +Infinity;
rect.r = +Infinity;
if(bEvent)
{
rect.x = -Infinity;
rect.y = -Infinity;
}
break; break;
} }
...@@ -200,12 +210,26 @@ function FrozenPlace(ws, type) { ...@@ -200,12 +210,26 @@ function FrozenPlace(ws, type) {
{ {
rect.w = +Infinity; rect.w = +Infinity;
rect.h = +Infinity; rect.h = +Infinity;
rect.r = +Infinity;
rect.b = +Infinity;
if(bEvent)
{
rect.x = -Infinity;
}
break; break;
} }
case FrozenAreaType.Left: case FrozenAreaType.Left:
{ {
rect.h = +Infinity; rect.h = +Infinity;
rect.b = +Infinity;
if(bEvent)
{
rect.x = -Infinity;
rect.y = -Infinity;
}
break; break;
} }
...@@ -214,6 +238,13 @@ function FrozenPlace(ws, type) { ...@@ -214,6 +238,13 @@ function FrozenPlace(ws, type) {
rect.w = +Infinity; rect.w = +Infinity;
rect.h = +Infinity; rect.h = +Infinity;
rect.r = +Infinity;
rect.b = +Infinity;
if(bEvent)
{
rect.y = -Infinity;
}
break; break;
} }
...@@ -221,23 +252,45 @@ function FrozenPlace(ws, type) { ...@@ -221,23 +252,45 @@ function FrozenPlace(ws, type) {
{ {
rect.w = +Infinity; rect.w = +Infinity;
rect.h = +Infinity; rect.h = +Infinity;
rect.r = +Infinity;
rect.b = +Infinity;
if(bEvent)
{
rect.x = -Infinity;
rect.y = -Infinity;
}
break; break;
} }
// Other // Other
case FrozenAreaType.LeftTop: case FrozenAreaType.LeftTop:
{ {
if(bEvent)
{
rect.x = -Infinity;
rect.y = -Infinity;
}
break; break;
} }
case FrozenAreaType.RightTop: case FrozenAreaType.RightTop:
{ {
rect.w = +Infinity; rect.w = +Infinity;
rect.r = +Infinity;
if(bEvent)
{
rect.y = -Infinity;
}
break; break;
} }
case FrozenAreaType.LeftBottom: case FrozenAreaType.LeftBottom:
{ {
rect.h = +Infinity; rect.h = +Infinity;
rect.b = +Infinity;
if(bEvent)
{
rect.x = -Infinity;
}
break; break;
} }
...@@ -245,6 +298,8 @@ function FrozenPlace(ws, type) { ...@@ -245,6 +298,8 @@ function FrozenPlace(ws, type) {
{ {
rect.w = +Infinity; rect.w = +Infinity;
rect.h = +Infinity; rect.h = +Infinity;
rect.r = +Infinity;
rect.b = +Infinity;
break; break;
} }
} }
...@@ -322,10 +377,10 @@ function FrozenPlace(ws, type) { ...@@ -322,10 +377,10 @@ function FrozenPlace(ws, type) {
return fv; return fv;
}; };
_this.isPointInside = function(x, y) _this.isPointInside = function(x, y, bEvent)
{ {
var rect = _this.getRect(); var rect = _this.getRect(bEvent);
var result = (x >= rect.x ) && (y >= rect.y) && (x <= rect.x + rect.w) && (y <= rect.y + rect.h); var result = (x >= rect.x ) && (y >= rect.y) && (x <= rect.r) && (y <= rect.b);
if ( log && result ) if ( log && result )
console.log( x + "," + y + " in " + _this.type); console.log( x + "," + y + " in " + _this.type);
return result; return result;
...@@ -765,9 +820,9 @@ function DrawingArea(ws) { ...@@ -765,9 +820,9 @@ function DrawingArea(ws) {
} }
}; };
_this.getOffsets = function(x, y) { _this.getOffsets = function(x, y, bEvents) {
for ( var i = 0; i < _this.frozenPlaces.length; i++ ) { for ( var i = 0; i < _this.frozenPlaces.length; i++ ) {
if ( _this.frozenPlaces[i].isPointInside(x, y) ) { if ( _this.frozenPlaces[i].isPointInside(x, y, bEvents) ) {
return { x: _this.frozenPlaces[i].getHorizontalScroll(), y: _this.frozenPlaces[i].getVerticalScroll() } return { x: _this.frozenPlaces[i].getHorizontalScroll(), y: _this.frozenPlaces[i].getVerticalScroll() }
} }
} }
......
...@@ -4756,7 +4756,7 @@ function DrawingObjects() { ...@@ -4756,7 +4756,7 @@ function DrawingObjects() {
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
_this.graphicObjectMouseDown = function(e, x, y) { _this.graphicObjectMouseDown = function(e, x, y) {
var offsets = _this.drawingArea.getOffsets(x, y); var offsets = _this.drawingArea.getOffsets(x, y, true);
if ( offsets ) if ( offsets )
_this.controller.onMouseDown( e, pxToMm(x - offsets.x), pxToMm(y - offsets.y) ); _this.controller.onMouseDown( e, pxToMm(x - offsets.x), pxToMm(y - offsets.y) );
}; };
...@@ -4764,13 +4764,13 @@ function DrawingObjects() { ...@@ -4764,13 +4764,13 @@ function DrawingObjects() {
_this.graphicObjectMouseMove = function(e, x, y) { _this.graphicObjectMouseMove = function(e, x, y) {
e.IsLocked = e.isLocked; e.IsLocked = e.isLocked;
var offsets = _this.drawingArea.getOffsets(x, y); var offsets = _this.drawingArea.getOffsets(x, y, true);
if ( offsets ) if ( offsets )
_this.controller.onMouseMove( e, pxToMm(x - offsets.x), pxToMm(y - offsets.y) ); _this.controller.onMouseMove( e, pxToMm(x - offsets.x), pxToMm(y - offsets.y) );
}; };
_this.graphicObjectMouseUp = function(e, x, y) { _this.graphicObjectMouseUp = function(e, x, y) {
var offsets = _this.drawingArea.getOffsets(x, y); var offsets = _this.drawingArea.getOffsets(x, y, true);
if ( offsets ) if ( offsets )
_this.controller.onMouseUp( e, pxToMm(x - offsets.x), pxToMm(y - offsets.y) ); _this.controller.onMouseUp( e, pxToMm(x - offsets.x), pxToMm(y - offsets.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