anastr / SpeedView

Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:
Apache License 2.0
1.3k stars 324 forks source link

Positioning of tick-labels without rotation #226

Open RayBreslin opened 3 years ago

RayBreslin commented 3 years ago

Hello,

first of all I am a huge fan of this library and I realy enjoy using it.

Recently I came across a small problem, when it comes to properly positioning tick-labels on the outside of a circle-speedview when the rotation of the tick-labels is disabled (app:sv_tickRotation).

When the tick-padding is applied (app:sv_tickPadding), then by default - due to the handling in drawTicks() - you will get an unsymmetrical/uneven positioning around the speedview. That happens since all tick-labels - except position 0 - experience a different rotation depending on their placement around the circle.

So I made some minor modifications to the Speedometer-class (still using speedview-lib v1.3.1) that allows an individual configuration of the tick-paddings per tick-label in order to still achieve a symmetrical/even positioning.

Here is my git-patch - maybe someone will find it useful!

speedometer-tick-handling-adaption.txt

Note: In order to apply it, just rename the .txt-file to a .patch-file! (I am sorry in advance for this unconventional way of proposing that change - still have to get used a bit more on how to properly add/show code-changes here.)

anastr commented 3 years ago

Hi @RayBreslin ! Since this's an old and Java version of the library I'm not sure I can help with that.

What're you trying to do, and what's the problem with the current positions and rotations of the ticks?

RayBreslin commented 3 years ago

Hi @anastr,

maybe you missunderstood my posting - I already fixed the identified "bug" and proposed my solution for it, so that you can eventually consider it (the theory behind) as an enhancement for the ongoing development of your library.

Unfortunately I cant set any issue-labels myself so it was categorized as bug-report.

If you want to know what the initial problem was, I can make screenshots before/after my fix.

Regards

anastr commented 3 years ago

Thanks for your contributing @RayBreslin . It'd be nice to share a screenshot to look for it later on.

Best wishes.