Ticket #2822 (closed feature: wontfix)

Opened 3 years ago

Last modified 3 years ago

Scale control: Implement methods activate/deactivate.

Reported by: jorix Owned by:
Priority: minor Milestone: 2.11 Release
Component: Control.Scale Version: 2.10 RC2
Keywords: Cc:
State:

Description

The attached patch implements the methods activate/deactivate on the control.

The patch includes a specific test.

The tests work well in: FF368, IE8, Chrome6 & Safari5.

Attachments

ControlScale-activate-2822.patch Download (3.3 KB) - added by jorix 3 years ago.
ControlScale-activate-2822(2).patch Download (3.7 KB) - added by jorix 3 years ago.

Change History

Changed 3 years ago by jorix

  Changed 3 years ago by jorix

  • state set to Review

  Changed 3 years ago by jorix

  • state changed from Review to Needs More Work

Changed 3 years ago by jorix

  Changed 3 years ago by jorix

  • state changed from Needs More Work to Review

In the new patch moves the creation of "element" from draw to initialize.
Also it controls whether "element" comes from the initialize parameter (with (this.div === this.element) due to the assignment this.div = this.element; in initialize).

follow-up: ↓ 5   Changed 3 years ago by ahocevar

  • status changed from new to closed
  • resolution set to invalid

Same situation as with #2519 and #2831.

in reply to: ↑ 4   Changed 3 years ago by jorix

Replying to ahocevar:

Same situation as with #2519 and #2831.

Also added missing "destroy".
Same as in #2831 that missing "unregister" for 'changelayer' and 'changebaselayer' in "destroy"

follow-up: ↓ 7   Changed 3 years ago by ahocevar

And the fix to the destroy method is related to the title of this ticket in which way?

in reply to: ↑ 6   Changed 3 years ago by jorix

Replying to ahocevar:

And the fix to the destroy method is related to the title of this ticket in which way?

I do not seemed relevant, is just a justification of the increase of code.

On the other hand, in 3.0 all code into "if" of the type "if (this.div === this.element) {" can be removed.
I put a comment in the code to find them easily?

I can reopen this ticket for the same reason that #2831 was reopened?

follow-up: ↓ 9   Changed 3 years ago by ahocevar

Interesting. jorix seems to know more about 3.0 than we do. Feel free to reopen and find someone to review your patch.

in reply to: ↑ 8   Changed 3 years ago by jorix

  • status changed from closed to reopened
  • resolution invalid deleted

Replying to ahocevar:

Interesting. jorix seems to know more about 3.0 than we do. Feel free to reopen and find someone to review your patch.

No, no, please!
I only followed very carefully everything that refers to 3.0: "3.0 IRC Meeting", performance, shorter code, GitHub and the ideas presented by Tim talking about constructor signatures (in Popups: 6 args!, or more. The sixth in "Popup.js" is the same as the seventh in "FramedCloud.js", what a nightmare!)
We arrive at the single signature? I do not know. But it would be good to eliminate optional args. And desirable that derived classes have the same number of arguments as base class.

...

Thanks, I reopen this ticket

follow-up: ↓ 11   Changed 3 years ago by ahocevar

  • state changed from Review to Needs More Work

This this.div == this.element stuff is so ugly! Why can't you just add this.div to this.element on activate, and remove it from its this.element parent on deactivate? Also, since no events are attached to this.div, there is no need to perform any destroy action.

in reply to: ↑ 10 ; follow-up: ↓ 12   Changed 3 years ago by jorix

Replying to ahocevar:

This this.div == this.element stuff is so ugly!

Yes you are right, is ugly.
I thought about putting a flag like "elelemtIsArgument" but I looked ugly, and I put something uglier.
The flag is required when "element" is an argument, when control is activated the "element" is added as a child of "div" and the scale out the map disappears and appears inside the map
How would you like a flag?
Or is it better to reformulate the constructor removing the argument "element" and put the ticket in Milestone 3.0?

in reply to: ↑ 11 ; follow-up: ↓ 13   Changed 3 years ago by jorix

Replying to jorix:

Replying to ahocevar:

This this.div == this.element stuff is so ugly!

Yes you are right, is ugly...

I thought that "this.div = this.element" could be replaced by
"this.div = this.element.parentNode" (also ugly), but has the advantage that can remove the "if" in "activate", "deactivate" and "destroy"
Is acceptable?

in reply to: ↑ 12   Changed 3 years ago by jorix

  • state Needs More Work deleted

I do not see an elegant way to address the problem of the argument "element". I close it.

Note: I think the questions in the comment:11 are valid, but comment:12 is not valid, causes more problems than it solves.

  Changed 3 years ago by jorix

  • status changed from reopened to closed
  • resolution set to wontfix
Note: See TracTickets for help on using tickets.