Some Magnifier DBus methods incorrectly interpret rectangles.

Modified methods to use [left, top, right, bottom] instead of
[left, top, width, height].

https://bugzilla.gnome.org/show_bug.cgi?id=626123
This commit is contained in:
Joseph Scheuhammer 2010-08-06 13:07:49 -04:00
parent e88f08072c
commit 399ebcc049

View File

@ -109,14 +109,14 @@ ShellMagnifier.prototype = {
* ZoomRegion. * ZoomRegion.
* @roi Array of integers defining the region of the * @roi Array of integers defining the region of the
* screen/desktop to magnify. The array has the form * screen/desktop to magnify. The array has the form
* [x, y, width, height]. * [left, top, right, bottom].
* @viewPort Array of integers, [ x, y, width, height ] that defines * @viewPort Array of integers, [left, top, right, bottom] that defines
* the position of the ZoomRegion on screen. * the position of the ZoomRegion on screen.
* @return The newly created ZoomRegion. * @return The newly created ZoomRegion.
*/ */
createZoomRegion: function(xMagFactor, yMagFactor, roi, viewPort) { createZoomRegion: function(xMagFactor, yMagFactor, roi, viewPort) {
let ROI = { x: roi[0], y: roi[1], width: roi[2], height: roi[3] }; let ROI = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
let viewBox = { x: viewPort[0], y: viewPort[1], width: viewPort[2], height: viewPort[3] }; let viewBox = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
let realZoomRegion = Main.magnifier.createZoomRegion(xMagFactor, yMagFactor, ROI, viewBox); let realZoomRegion = Main.magnifier.createZoomRegion(xMagFactor, yMagFactor, ROI, viewBox);
let objectPath = ZOOM_SERVICE_PATH + '/zoomer' + _zoomRegionInstanceCount; let objectPath = ZOOM_SERVICE_PATH + '/zoomer' + _zoomRegionInstanceCount;
_zoomRegionInstanceCount++; _zoomRegionInstanceCount++;
@ -325,12 +325,12 @@ ShellMagnifierZoomRegion.prototype = {
/** /**
* setRoi: * setRoi:
* Sets the "region of interest" that the ZoomRegion is magnifying. * Sets the "region of interest" that the ZoomRegion is magnifying.
* @roi Array, [x, y, width, height], defining the region of the screen to * @roi Array, [left, top, right, bottom], defining the region of the
* magnify. The values are in screen (unmagnified) coordinate * screen to magnify. The values are in screen (unmagnified)
* space. * coordinate space.
*/ */
setRoi: function(roi) { setRoi: function(roi) {
let roiObject = { x: roi[0], y: roi[1], width: roi[2], height: roi[3] }; let roiObject = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
this._zoomRegion.setROI(roiObject); this._zoomRegion.setROI(roiObject);
}, },
@ -339,11 +339,14 @@ ShellMagnifierZoomRegion.prototype = {
* Retrieves the "region of interest" -- the rectangular bounds of that part * Retrieves the "region of interest" -- the rectangular bounds of that part
* of the desktop that the magnified view is showing (x, y, width, height). * of the desktop that the magnified view is showing (x, y, width, height).
* The bounds are given in non-magnified coordinates. * The bounds are given in non-magnified coordinates.
* @return an array, [x, y, width, height], representing the bounding * @return an array, [left, top, right, bottom], representing the bounding
* rectangle of what is shown in the magnified view. * rectangle of what is shown in the magnified view.
*/ */
getRoi: function() { getRoi: function() {
return this._zoomRegion.getROI(); let roi = this._zoomRegion.getROI();
roi[2] += roi[0];
roi[3] += roi[1];
return roi;
}, },
/** /**
@ -362,11 +365,11 @@ ShellMagnifierZoomRegion.prototype = {
/** /**
* moveResize * moveResize
* Sets the position and size of the ZoomRegion on screen. * Sets the position and size of the ZoomRegion on screen.
* @viewPort Array, [x, y, width, height], defining the position and size * @viewPort Array, [left, top, right, bottom], defining the position and
* on screen to place the zoom region. * size on screen to place the zoom region.
*/ */
moveResize: function(viewPort) { moveResize: function(viewPort) {
let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2], height: viewPort[3] }; let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
this._zoomRegion.setViewPort(viewRect); this._zoomRegion.setViewPort(viewRect);
} }
}; };