On Thu, Sep 23, 2010 at 3:28 PM, AJ <[email protected]> wrote:
> On Thu, Sep 23, 2010 at 3:18 PM, Andreas Hocevar <[email protected]> wrote:
>> Hi,
>>
>> if your handler functions for the "beforefeaturemodified" or
>> "beforefeatureadded" events return false, no action will be performed.
>
> That works brilliantly. Thanks a ton :)
Andreas,
This works in most cases but I'm encountering a weird issue. Can you
help me with this?
This is the code I'm using:
var currentLoc = new OpenLayers.Feature.Vector(initialWayPoint, {type:
"wayPoint"});
vlayer.events.register("beforefeaturemodified", null, function(evt) {
var feature = evt.feature;
console.log("currentLoc == feature::" + (currentLoc == feature));
if(currentLoc == feature) {
console.log("2: currentLoc == feature::" + (currentLoc == feature));
return false;
}
});
Firebug output:
Case 1: When currentLoc is the only feature in the layer:
currentLoc == feature::true
2: currentLoc == feature::true
Case 2: After adding a few more points to the layer, moving another
point and then trying to move the point corresponding to currentLoc:
currentLoc == feature::true
2: currentLoc == feature::true
currentLoc == feature::false
currentLoc == feature::true
2: currentLoc == feature::true
currentLoc == feature::true
2: currentLoc == feature::true
this.feature is null
[Break on this error]
if(this.geometryTypes==null||OpenLayer...eature!=vertex){this.feature=vertex;}
OpenLayers.js (line 1859)
this.feature is null
[Break on this error]
if(this.geometryTypes==null||OpenLayer...eature!=vertex){this.feature=vertex;}
(a whole list of this error follows)
I'm not sure why it is failing after adding a few more point even
after returning false.
What am I doing wrong?
AJ
--
bLogging at - http://ramblings.ajaxed.net
Twitter - http://twitter.com/anant
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users