How to comment out set location icon on the NearMe widget.

632
4
Jump to solution
08-16-2019 07:55 AM
SimonFonji
New Contributor III

I have succeeded in hiding the set location hover icon on the map ( ) but then the set location icon appears on NearMe widget tool bar which users can click  . How can I comment out the code to hide/remove the set location icon from the map so that users cannot find it.

Thanks Simon.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Simon,

  In the Widget.js file comment out the contents of the _connectMapEventHandler function.

    _connectMapEventHandler: function () {
      // if (!this._mapClickHandler) {
      //   this._disableWebMapPopup();
      //   //handle map click
      //   this._mapClickHandler = this.own(this.map.on("click", lang.hitch(this,
      //     this._onMapClick)))[0];
      //   //handle mouse move on map to show tooltip only on non-touch devices
      //   if ("ontouchstart" in document.documentElement) {
      //     domStyle.set(this._mapTooltip, "display", "none");
      //   } else {
      //     this._mapMoveHandler = this.own(this.map.on("mouse-move", lang.hitch(
      //       this, this._onMapMouseMove)))[0];
      //     this.own(this.map.on("mouse-out", lang.hitch(this, function () {
      //       domStyle.set(this._mapTooltip, "display", "none");
      //     })));
      //   }
      // }
    },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Simon,

  Just un-check the "Set location button" in the widgets settings > search settings tab.

0 Kudos
SimonFonji
New Contributor III

Hello Robert, thanks for the prompt reply. I had tried this before, it worked but then presented a new challenge/issue. When the ‘set location button’ is turned off, you don’t see this icon on the NearMe widget which is what I need but users are able to hover over map using the ‘set location’[cid:image003.png@01D55429.E5615050] . To summarize it all, by default, the set location button is turn off, users can hover over map and use the set location ( I do not want users to be able set location on the map). When the ‘set location’ is turned on, users cannot hover over the map and set location (what I want), but then the set location icon appears on the NearMe widget which then allow users to click and set location (I do not want this either).

Thanks,

Simon.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Simon,

  In the Widget.js file comment out the contents of the _connectMapEventHandler function.

    _connectMapEventHandler: function () {
      // if (!this._mapClickHandler) {
      //   this._disableWebMapPopup();
      //   //handle map click
      //   this._mapClickHandler = this.own(this.map.on("click", lang.hitch(this,
      //     this._onMapClick)))[0];
      //   //handle mouse move on map to show tooltip only on non-touch devices
      //   if ("ontouchstart" in document.documentElement) {
      //     domStyle.set(this._mapTooltip, "display", "none");
      //   } else {
      //     this._mapMoveHandler = this.own(this.map.on("mouse-move", lang.hitch(
      //       this, this._onMapMouseMove)))[0];
      //     this.own(this.map.on("mouse-out", lang.hitch(this, function () {
      //       domStyle.set(this._mapTooltip, "display", "none");
      //     })));
      //   }
      // }
    },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
SimonFonji
New Contributor III

Thanks Robert, It worked as expected.

0 Kudos