mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Revisit gesture plugin initialization

Open kiryldz opened this issue 4 years ago • 0 comments

Capturing from this comment:

Now thinking of this part of the initialisation of GesturesPlugin, why does it need to be a separate constructor for context, attrs and pixel ratio? As far as I see, the GesturesPlugin extends ContextBinder

fun interface ContextBinder {
  /**
   * Bind the ViewPlugin with current map context. This will create a View that
   * will be added to the MapView.
   *
   * @param context The hosting context
   * @param attrs parent attributes
   * @param pixelRatio the pixel ratio of the device
   * @return View that will be added to the MapView
   */
  fun bind(context: Context, attrs: AttributeSet?, pixelRatio: Float)
}

So the GesturesPlugin can be initialised properly when the plugin is created through the MapPluginRegistry.

kiryldz avatar Jul 27 '21 12:07 kiryldz