Cobinja / CobiAnalogClock

GNU General Public License v2.0
1 stars 3 forks source link

[Contribution] Minor Change #15

Closed Phx01 closed 1 year ago

Phx01 commented 1 year ago

Since I have never contributed to any project online, I am not sure how to do so with proper respect to the author/maintainer nor am I sure if this change is even wanted. So, I decided to ask you here.

I made a minor change in the "_updateClock" function of "3.0/desklet.js" I got from linuxmint's cinnamon-spices-desklets to smoothen updates for the minute and hour hands while the seconds hand is displayed. While the hour hand was already updated every other minute, I did not see any performance impact as to why all hands cannot be updated every second instead.

Essentially I added the following underneath line 446:

    else {
      let seconds = this._displayTime.get_second();
    }

and updated the two if blocks from line 452 reading the following now:

    if (this._initialUpdate) {
      this._initialUpdate = false;
    }
    this._clock.hour.actor.set_rotation_angle(Clutter.RotateAxis.Z_AXIS, DEG_PER_HOUR * hours + (minutes * 0.5));
    if (this._settings.values["show-seconds"]) {
      this._clock.minute.actor.set_rotation_angle(Clutter.RotateAxis.Z_AXIS, DEG_PER_SECOND * minutes + (seconds * 0.1));
      this._clock.second.actor.set_rotation_angle(Clutter.RotateAxis.Z_AXIS, DEG_PER_SECOND * seconds);
    }
    else {
      this._clock.minute.actor.set_rotation_angle(Clutter.RotateAxis.Z_AXIS, DEG_PER_SECOND * minutes);
    }

My IDE also discovered a small issue with a missing semicolon on line 91, which I added as well.

If this is an acceptable change, please let me know and I will see if I can upload it there. Otherwise you can simply close this "issue" without further comment and then I know that this change is not wanted and I will just keep it locally for myself.

Cobinja commented 1 year ago

While your system might not show a performance hit, other systems might. That's why I did it this way in the first place.