Version 2 (modified by crschmidt, 6 years ago)

more

  • Old Style Controls
    • MouseDefaults
    • MouseToolbar
    • Can't be turned off, only added to the map
    • Control of display is difficult
    • Not designed to be used with other tools
  • New style controls
    • have activate/deactivate methods which turn handlers on/off
    • When activated, goes to front of event queue and handles events
    • when deactivated, removes event handlers
    • uses handler classes for most 'hard' work -- box, drag, etc. are done via callbacks
    • Support for 'button' types, which just have a 'trigger' method which causes an action to happen instantly.
    • examples
      • Navigation.js
      • NavToolbar.js

Implementing a new control:

  • requires:
    • initialize()
    • draw
    • Tool types (have state)
      • activate()
      • deactivate()
    • Button Types
      • trigger
    • properties:
      • displayClass (a la olControlName) or CLASS_NAME (OpenLayers.Control.Name)