OpenLayers OpenLayers

Ticket #1343 (closed feature: fixed)

Opened 10 months ago

Last modified 10 months ago

Trigger more events and pass around relevant event related information.

Reported by: tschaub Assigned to: tschaub
Priority: minor Milestone: 2.6 Release
Component: Events Version: 2.5
Keywords: Cc:
State: Complete

Description

In the trunk, we've made events.triggerEvent take an arbitrary number of arguments to be passed to the listeners - in addition to the event object. For non-browser events, this event object has references to the "object" (events.object) and "element" (events.element). Instead of tacking on additional positional parameters, it makes sense to add on additional event related information as properties of this event object.

In addition, we often call events.register and events.unregister multiple times sequentially with the same scope (object argument). This can be made a bit more convenient by introducing events.on and events.un methods. These convenience methods are similar to those on observables in Ext, only supporting the case with a common scope right now.

Attachments

events.patch (35.7 kB) - added by tschaub on 02/08/08 16:16:54.
enhanced event handling
vector_events.patch (1.8 kB) - added by tschaub on 02/09/08 12:01:10.
concatenate event types while extending

Change History

02/08/08 16:16:54 changed by tschaub

  • attachment events.patch added.

enhanced event handling

02/08/08 16:23:39 changed by tschaub

  • owner set to tschaub.
  • status changed from new to assigned.
  • state set to Review.
  • component changed from general to Events.

Tests pass in FF and all examples work. Checking elsewhere now.

02/08/08 16:26:44 changed by tschaub

And Safari.

02/08/08 18:05:06 changed by crschmidt

  • state changed from Review to Commit.

Tests pass in IE as well. Looks good. Hit it.

02/08/08 18:31:27 changed by tschaub

  • status changed from assigned to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [6149]) Trigger feature related events with feature information and layer related events with layer information. Also adding events.on and events.un convenience methods. r=crschmidt (closes #1343)

02/09/08 09:32:32 changed by elemoine

One thing:

Does it make sense to document the loadstart, loadend, loadcancel and visibilitychanged event types in the Layer.Vector class? These are already documented in the Layer class where they belong. Documenting them also in the Layer.Vector class may make the reader believe they are specific to Layer.Vector.

Related to this: why does Layer.Vector redefine the EVENT_TYPES property instead of complementing it?

02/09/08 09:33:53 changed by crschmidt

  • status changed from closed to reopened.
  • state changed from Complete to Needs More Work.
  • resolution deleted.

02/09/08 09:34:27 changed by crschmidt

Good questions; I'll ask Tim when he gets in and see if there's a good reason. Reopening for now.

02/09/08 09:35:39 changed by elemoine

Forgot to say that I've been greatly supporting this work. Thanks a lot Tim for putting this together. This is great!

02/09/08 12:01:10 changed by tschaub

  • attachment vector_events.patch added.

concatenate event types while extending

02/09/08 12:08:21 changed by tschaub

  • state changed from Needs More Work to Review.

Comments welcome on this. The idea we tossed around here is that if you want to define event types specific to a subclass, you put them in the subclass prototype's EVENT_TYPES array. These will get concatenated with the parent EVENT_TYPES upon construction. So, you can't get a smaller set of events on a subclass.

02/09/08 13:30:54 changed by crschmidt

  • state changed from Review to Commit.

I'm happy with this, and believe it addresses elemoine's concerns.

02/09/08 14:16:25 changed by tschaub

  • status changed from reopened to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [6173]) The vector layer now only adds events to those available from the layer superclass. r=crschmidt (closes #1343)