Problem/Motivation

Latest version of OpenLayers is 6.4.3 and it's rolling on.

Proposed resolution

Providing support for latest versions could be nice.

Any plans on that?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Orkut Murat Yılmaz created an issue. See original summary.

AndyLicht’s picture

Hi,

maybe between christmas and new years - day. I do it all in my freetime - so this year was very strange also for me.

beste regards
Tim

orkutmuratyilmaz’s picture

@AndyLicht, thank you for your quick reply.

I wish you a beautiful new year:)

AndyLicht’s picture

Hi,
i´ve tested the openlayersd8 1.2 with openlayers 6.5.0 and it works fine. Can you explain your problems?

best regards

AndyLicht’s picture

I´ve seen same errors. I hope to fix them in the next weeks.

ilciacio made their first commit to this issue’s fork.

ilciacio’s picture

Sorry, I've problem to push to the issue fork.

The motivation is an error with customcontrol(lers) using openlayers 6.5.0

Here the changes to the code to test with Rotate custom control just for testing

in openlayers.drupal.js use this

  Drupal.OpenLayers.prototype.addOLControls = function(mapid) {
    for (var id in this.navbar.controls) {
      this.navbar.controls[id].path = this.path;
      if(this.navbar.controls[id]['machine'] == "Rotate"){
        this.olMap.addControl(new window[this.navbar.controls[id]['machine']](null, this.navbar.controls[id], mapid, this.olMap))
      } else {
              this.olMap.addControl(new window['ol'][this.navbar.controls[id]['namespace']][this.navbar.controls[id]['machine']](null, this.navbar.controls[id], mapid, this.olMap));
      }
    }
  }

And here is the new ol.customcontrol.Rotate.js (parameters are passed but not used)

var Rotate = /*@__PURE__*/(function (Control) {
  function Rotate(opt_options, settings, mapid, olMap) {
    // console.log("Rotate");

    console.log(settings);
    var options = opt_options || {};

    var button = document.createElement('button');
    button.innerHTML = 'N';

    var element = document.createElement('div');
    element.className = 'Rotate-north ol-unselectable ol-control';
    element.appendChild(button);

    Control.call(this, {
      element: element,
      target: options.target,
    });

    button.addEventListener('click', this.handleRotateNorth.bind(this), false);
  }

  if ( Control ) Rotate.__proto__ = Control;
  Rotate.prototype = Object.create( Control && Control.prototype );
  Rotate.prototype.constructor = Rotate;

  Rotate.prototype.handleRotateNorth = function handleRotateNorth () {
    console.log('button rotate Nord clicked');
    this.getMap().getView().setRotation(0);
  };

  return Rotate;
}(ol.control.Control));
AndyLicht’s picture

Thanks,
im still woking on it. But, i need this month, maybe also march to port all functions.

ilciacio’s picture

Hi AndyLicht,

I don't think that a rewrite of all the controllers is mandatory.

Using the namespacing in the controllers configuration it is possible to get most of the default controllers from openalyers.

I've tested a couple of them (Zoom from the controller and DragRotation from interaction) and they seems to works out of the box.

I've started a little bit of documentation here https://www.drupal.org/docs/contributed-modules/openlayersd8 where the configuration of the controllers is explicated.

Best reagrds.

AndyLicht’s picture

Hi,
i think i need to rewrite the most functions, because they are all configurable. So i need to modify some small parts. The "problem" with they namespaces is, that it could be easier to add custom functions. Add the moment you are right, that is a terrible solution. I´m working at a new one, i think the default ol solution is the best...
Your code at #7 is not working very well, because i have too implement the if for all others. I will push a new dev-version tomorrow, thei i´ve added a new rotate and startet with the draw-method.

is it possible to chat at wednesday or thursday?

best regards

ilciacio’s picture

Hi AndyLicht,

take a look to this commit

The openlayers.drupal.js has been restored to the original one.

The custom controller js/control/ol.customcontrol.Rotate.js is taking the parameters.

Ok for the chat wednesday or thursday, I think I can be free both the days.

Have a good day.

AndyLicht’s picture

If changed all controls, so you can use openlayers 6.5 with the module. It is important to clone the branch 3.x. For the stable release of 3.0 i want to add two new entities (projection and style) and change the layer (adding styles) and control (adding javascript config object) entities.

AndyLicht’s picture

Version: 8.x-1.x-dev » 8.x-3.x-dev
Status: Active » Fixed

I fixed it for the 8.x-3.x Version.

Please use Entity Update, to update the entities.

ilciacio’s picture

Thanks.
Using Entity update it works.

But I've this error in javascript

Only local images are allowed.

AndyLicht’s picture

You have to set a map in the widget configuration. maybe it helps to install the examples.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

orkutmuratyilmaz’s picture