when drawing make sure the point follow the cursor, even after zooming in or out, p=jorix, r=me (closes #3195)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11836 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -157,6 +157,7 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
|||||||
this.line.geometry.addComponent(
|
this.line.geometry.addComponent(
|
||||||
this.point.geometry, this.line.geometry.components.length
|
this.point.geometry, this.line.geometry.components.length
|
||||||
);
|
);
|
||||||
|
this.layer.addFeatures([this.point]);
|
||||||
this.callback("point", [this.point.geometry, this.getGeometry()]);
|
this.callback("point", [this.point.geometry, this.getGeometry()]);
|
||||||
this.callback("modify", [this.point.geometry, this.getSketch()]);
|
this.callback("modify", [this.point.geometry, this.getSketch()]);
|
||||||
this.drawFeature();
|
this.drawFeature();
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_bounds(t) {
|
function test_bounds(t) {
|
||||||
t.plan(2);
|
t.plan(5);
|
||||||
var geometry;
|
var geometry;
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
map.addLayer(new OpenLayers.Layer.WMS("", "", {}));
|
map.addLayer(new OpenLayers.Layer.WMS("", "", {}));
|
||||||
@@ -115,16 +115,22 @@
|
|||||||
var handler = new OpenLayers.Handler.Path(control, {},
|
var handler = new OpenLayers.Handler.Path(control, {},
|
||||||
{stopDown: true, stopUp: true});
|
{stopDown: true, stopUp: true});
|
||||||
var activated = handler.activate();
|
var activated = handler.activate();
|
||||||
|
t.eq(handler.layer.features.length, 2,
|
||||||
|
"There are two features in the layer after activation.");
|
||||||
// click on (150, 75)
|
// click on (150, 75)
|
||||||
var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
|
var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
|
||||||
handler.mousemove(evt);
|
handler.mousemove(evt);
|
||||||
handler.mousedown(evt);
|
handler.mousedown(evt);
|
||||||
handler.mouseup(evt);
|
handler.mouseup(evt);
|
||||||
|
t.eq(handler.layer.features.length, 2,
|
||||||
|
"There are two features in the layer after first click.");
|
||||||
// click on (175, 100)
|
// click on (175, 100)
|
||||||
evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
|
evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
|
||||||
handler.mousemove(evt);
|
handler.mousemove(evt);
|
||||||
handler.mousedown(evt);
|
handler.mousedown(evt);
|
||||||
handler.mouseup(evt);
|
handler.mouseup(evt);
|
||||||
|
t.eq(handler.layer.features.length, 2,
|
||||||
|
"There are two features in the layer after second click.");
|
||||||
t.ok(handler.line.geometry.getBounds().equals(
|
t.ok(handler.line.geometry.getBounds().equals(
|
||||||
new OpenLayers.Bounds(0,-35.15625,35.15625,0)),
|
new OpenLayers.Bounds(0,-35.15625,35.15625,0)),
|
||||||
"Correct bounds");
|
"Correct bounds");
|
||||||
|
|||||||
Reference in New Issue
Block a user