[mapguide-commits] r5430 - trunk/MgDev/Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Dec 2 01:45:19 EST 2010
Author: liuar
Date: 2010-12-01 22:45:19 -0800 (Wed, 01 Dec 2010)
New Revision: 5430
Modified:
trunk/MgDev/Web/src/viewerfiles/quickplot.js
Log:
Ticket#1546 - Ajax quick plot enhancements: mouse cursor and event controlling
1. It's an issue: when move the mouse pointer to the center point of the capture box, the cursor is "rotate". The correct cursor should be "move". I fixed it by moving the "start point" of the rotate handler to the "capture box" canvas.
2. It's an enhancement: add a method to suppress all events for the capture box, like move, rotate, warning message etc. Then some functions could use quick plot to draw only a rectangle on screen. In these cases, the events are not necessary.
Because the fix and the enhancement are connected closely, I just combine them into a single submission.
Modified: trunk/MgDev/Web/src/viewerfiles/quickplot.js
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/quickplot.js 2010-12-01 14:01:32 UTC (rev 5429)
+++ trunk/MgDev/Web/src/viewerfiles/quickplot.js 2010-12-02 06:45:19 UTC (rev 5430)
@@ -45,6 +45,8 @@
paperSize : {width : 0, height : 0},
scaleDenominator : 1,
+ eventSuppressed : false,
+
initialize : function()
{
this.mapWindow = window;
@@ -253,7 +255,7 @@
this.handleGraphics.drawLine(start.X, start.Y, end.X, end.Y);
// Draw the rotate start point
- this.gripGraphics.fillEllipse(start.X - this.rotateGripDiameter / 2, start.Y - this.rotateGripDiameter / 2, this.rotateGripDiameter, this.rotateGripDiameter);
+ this.boxGraphics.fillEllipse(start.X - this.rotateGripDiameter / 2, start.Y - this.rotateGripDiameter / 2, this.rotateGripDiameter, this.rotateGripDiameter);
// Draw the end point
this.gripGraphics.setColor(this.strokeColor);
this.gripGraphics.fillEllipse(end.X - this.rotateGripDiameter / 2, end.Y - this.rotateGripDiameter / 2, this.rotateGripDiameter, this.rotateGripDiameter);
@@ -262,20 +264,36 @@
this.handleGraphics.paint();
this.gripGraphics.paint();
- // Set the cursor styles
+ this.setCursor();
+ },
+
+ setCursor : function()
+ {
+ var moveCursor = this.eventSuppressed ? "default" : "move";
+ var rotateCursor = this.eventSuppressed ? "default" : "url(../stdicons/rotate.cur), default";
+
var nodes = this.boxCanvas.childNodes;
for (var i = 0; i < nodes.length; ++i)
{
- nodes[i].style.cursor = "move";
+ nodes[i].style.cursor = moveCursor;
}
nodes = this.gripCanvas.childNodes;
for (var i = 0; i < nodes.length; ++i)
{
- nodes[i].style.cursor = "url(../stdicons/rotate.cur), default";
+ nodes[i].style.cursor = rotateCursor;
}
},
+ // Suppress all event handlers, like move, rotate, show warning message when the capture box "overflows" the current viewport.
+ // It's kind of "back-door" for some functions which are using the quick plot map capturer to draw a rectangle on the screen. Those
+ // functions need only to draw a rectangle on the screen but don't need any events
+ suppressEvent : function(suppress)
+ {
+ this.eventSuppressed = suppress;
+ this.setCursor();
+ },
+
validateResolution : function()
{
if (this.captureBox)
@@ -334,7 +352,7 @@
{
var result = false;
- if (this.active)
+ if (this.active && !this.eventSuppressed)
{
var point = this.getMousePosition(evt);
@@ -482,7 +500,7 @@
if (this.active)
{
- if (this.validateResolution())
+ if (this.validateResolution() || this.eventSuppressed)
{
this.mapWindow.ClearMapMessage();
this.draw(this.captureBox);
More information about the mapguide-commits
mailing list