render()

in src/lib/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js [19:70]


  render(frameState, context) {
    if (!this.style) {
      return
    }

    const feature = this.feature

    const { projection, transform, pixelRatio } = frameState.viewState

    const { stroke, fill, pointRadius } = this.style

    if (typeof pointRadius === "number" && pointRadius <= 0) {
      return
    }

    const geometries = feature.getProjectedGeometries(projection)

    if (frameState.debug) {
      try {
        validateGeometries(geometries)
      } catch {
        console.error(
          `Invalid geometry. Feature skipped during rendering. Click here to inspect geometry: ${generateDebugUrl(feature)} \n`,
          feature,
        )
      }
    }

    if (pointRadius) {
      this.drawingFunction.pointRadius(
        (projection.scale() * pointRadius) / transform.k,
      )
    }

    this.drawPath(geometries, context)

    if (fill) {
      fill.drawInContext(context, transform.k)
    }

    if (stroke) {
      context.save()

      this.drawStroke(frameState, context, {
        style: stroke.getRgba(),
        width: (stroke.width / transform.k) * pixelRatio,
        position: stroke.position,
      })

      context.restore()
    }
  }