'Angular 10 : Zoom and draw only on a configured country

I have a map and I can draw an area in a country, I want to draw and zoom only on the configured country.

initTools() {

  if (this.draw == null) {
    this.draw = new Draw({
      source: this.mainSource,
      type: this.mode === "CREATE_POINT" ? "Point" : "Polygon",
      freehandCondition: this.freehandConditionHandler.bind(this),
      condition: this.conditionHandler.bind(this),
    });

    this.draw.on("drawstart", this.handleDrawStart.bind(this));
    this.draw.on("drawend", this.handleDrawEnd.bind(this));

    this.currentCoords = [];
  }
}


handleDrawStart() {
 
// if(this.#country) compare with  where we want to draw

}

please help me to resolve the issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source