Skip to content

[FEATURE]: Add generic MapLibreEvent and MapEventType models #163

@desmondinho

Description

@desmondinho

Is your feature request related to a problem?

I was trying to add a couple of new event handlers:

  • Rotate
  • Pitch
public Task<Listener> OnRotate( Action<...> handler, string? layerId = null ) =>
    AddListener( "rotate", handler, layerId );

public Task<Listener> OnRotate( Func<..., Task> handler, string? layerId = null ) =>
    AddAsyncListener( "rotate", handler, layerId );

public Task<Listener> OnPitch( Action<...> handler, string? layerId = null ) =>
    AddListener( "pitch", handler, layerId );

public Task<Listener> OnPitch( Func<..., Task> handler, string? layerId = null ) =>
    AddAsyncListener( "pitch", handler, layerId );

But realized that there is no suitable event model, so I had to create my own.

Describe the solution you'd like

Would be nice to have these included in the library.

public enum MapEventType
{
    Rotate,

    Pitch
}

public class MapLibreEvent
{
    [JsonPropertyName( "type" )]
    [JsonConverter( typeof( JsonStringEnumConverter ) )]
    public required MapEventType Type { get; set; }
}

Describe alternatives you've considered

No response

MapLibre JS Reference

Example Usage

Additional context

No response

Contribution

  • I'm interested in implementing this feature with guidance

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions