-
Book Overview & Buying
-
Table Of Contents
OpenLayers 2.10 Beginner's Guide
Now that you know the possible event types, let's play around with some.
Open up the first example from this chapter. We won't be editing the code, but instead we'll use Firebug again. We just need a vector layer and EditingToolbar control. As in the previous chapters, map.layers[1] is assumed to be the vector layer.
Open up Firebug. We'll start off by registering a beforefeatureadded event to the map. First, like in Chapter 8, we need to create a listener function that will get called when the event fires. We know from the previous list of event types that the listener function will receive an object containing the feature, so let's create our function with a feature parameter that will reference the feature. In Firebug, create a function:
function before_feature_added(feature){ console.log('before adding a feature!', feature); };All we have to do now is register the
beforefeatureadded event on our vector layer:
map.layers[1].events.register('beforefeatureadded...
Change the font size
Change margin width
Change background colour