remove unused diff and diffABS functions from OpenLayers.Pixel

git-svn-id: http://svn.openlayers.org/trunk/openlayers@129 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-18 05:19:51 +00:00
parent 6b43a2d977
commit bb55859445
4 changed files with 3 additions and 55 deletions

View File

@@ -29,7 +29,7 @@ OpenLayers.Icon.prototype = {
this.offset = offset;
if (offset == null) {
// default offset
this.offset = new OpenLayers.Pixel(size.w / 2, size.h);
this.offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
}
},

View File

@@ -38,7 +38,7 @@ OpenLayers.Marker.prototype = {
generateMarker: function(pixel) {
// Create a div here, and set the location to the pixel above modified
// by the icon size.
var iconPosition = pixel.diff(this.icon.offset);
var iconPosition = pixel.add(this.icon.offset.x, this.icon.offset.y);
var markerObject = OpenLayers.Util.createImage(this.icon.url,
this.icon.size,
iconPosition);

View File

@@ -44,27 +44,6 @@ OpenLayers.Pixel.prototype = {
return new OpenLayers.Pixel(this.x, this.y);
},
/**
* @param {OpenLayers.Pixel} px
*
* @return a Pixel object with the difference between the two pixels
* @type OpenLayers.Pixel
*/
diff:function(px) {
return new OpenLayers.Pixel(this.x - px.x, this.y - px.y);
},
/**
* @param {OpenLayers.Pixel} px
*
* @return Pixel object with the absolute difference between the two pixels
* @type OpenLayers.Pixel
*/
diffABS:function(px) {
return new OpenLayers.Pixel(Math.abs(this.x - px.x),
Math.abs(this.y - px.y));
},
/**
* @param {OpenLayers.Pixel} px
*
@@ -72,8 +51,7 @@ OpenLayers.Pixel.prototype = {
* @type bool
*/
equals:function(px) {
var d = this.diff(px);
return ((d.x == 0) && (d.y == 0));
return ((this.x == px.x) && (this.y == px.y));
},
/**

View File

@@ -31,36 +31,6 @@
t.eq( pixel.x, 5, "changing oldPixel.x doesn't change pixel.x");
}
function test_04_Pixel_diff(t) {
t.plan( 4 );
pixelA = new OpenLayers.Pixel(10,100);
pixelB = new OpenLayers.Pixel(15,150);
diffpx = pixelA.diff(pixelB);
t.eq( pixelA.x, 10, "pixelA.x is not modified by diff operation");
t.eq( pixelA.y, 100, "pixelA.y is not modified by diff operation");
t.eq( diffpx.x, -5, "diffpx.x is set correctly");
t.eq( diffpx.y, -50, "diffpx.y is set correctly");
}
function test_05_Pixel_diffABS(t) {
t.plan( 4 );
pixelA = new OpenLayers.Pixel(10,100);
pixelB = new OpenLayers.Pixel(15,150);
diffABSpx = pixelA.diffABS(pixelB);
t.eq( pixelA.x, 10, "pixelA.x is not modified by diffABS operation");
t.eq( pixelA.y, 100, "pixelA.y is not modified by diffABS operation");
t.eq( diffABSpx.x, 5, "diffABSpx.x is set correctly");
t.eq( diffABSpx.y, 50, "diffABSpx.y is set correctly");
}
function test_06_Pixel_equals(t) {
t.plan( 4 );
pixel = new OpenLayers.Pixel(5,6);