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:
@@ -29,7 +29,7 @@ OpenLayers.Icon.prototype = {
|
|||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
if (offset == null) {
|
if (offset == null) {
|
||||||
// default offset
|
// default offset
|
||||||
this.offset = new OpenLayers.Pixel(size.w / 2, size.h);
|
this.offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ OpenLayers.Marker.prototype = {
|
|||||||
generateMarker: function(pixel) {
|
generateMarker: function(pixel) {
|
||||||
// Create a div here, and set the location to the pixel above modified
|
// Create a div here, and set the location to the pixel above modified
|
||||||
// by the icon size.
|
// 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,
|
var markerObject = OpenLayers.Util.createImage(this.icon.url,
|
||||||
this.icon.size,
|
this.icon.size,
|
||||||
iconPosition);
|
iconPosition);
|
||||||
|
|||||||
+1
-23
@@ -44,27 +44,6 @@ OpenLayers.Pixel.prototype = {
|
|||||||
return new OpenLayers.Pixel(this.x, this.y);
|
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
|
* @param {OpenLayers.Pixel} px
|
||||||
*
|
*
|
||||||
@@ -72,8 +51,7 @@ OpenLayers.Pixel.prototype = {
|
|||||||
* @type bool
|
* @type bool
|
||||||
*/
|
*/
|
||||||
equals:function(px) {
|
equals:function(px) {
|
||||||
var d = this.diff(px);
|
return ((this.x == px.x) && (this.y == px.y));
|
||||||
return ((d.x == 0) && (d.y == 0));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,36 +31,6 @@
|
|||||||
t.eq( pixel.x, 5, "changing oldPixel.x doesn't change pixel.x");
|
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) {
|
function test_06_Pixel_equals(t) {
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
pixel = new OpenLayers.Pixel(5,6);
|
pixel = new OpenLayers.Pixel(5,6);
|
||||||
|
|||||||
Reference in New Issue
Block a user