victordiaz / PHONK

PHONK is a coding playground for new and old Android devices
https://phonk.app
GNU General Public License v3.0
457 stars 27 forks source link

PSlider can now be vertical or horizontal. #112

Closed polhomarkho closed 2 years ago

polhomarkho commented 2 years ago

Hi!

I wanted to have a vertical slider so I have upgraded the existing horizontal slider.
I have added 2 new methods: text(String) and verticalMode(boolean)
Tested with the script below, everything is working:

/*  
 *  Tests every possible slider configuration
 *  by Paul-Emile Sublet <polhomarkho@gmail.com> 
 */

ui.addSlider(0, 0, 0.24, 0.24)
  .range(0, 100)
  .value(50)
  .text('direct')
  .mode('direct')
  .verticalMode(true);

ui.addSlider(0.25, 0, 0.24, 0.24)
  .range(0, 100)
  .value(50)
  .text('drag')
  .mode('drag')
  .verticalMode(true);

ui.addSlider(0.5, 0, 0.24, 0.24)
  .range(0, 100)
  .text('direct')
  .mode('direct')
  .verticalMode(true);

ui.addSlider(0.75, 0, 0.24, 0.24)
  .range(0, 100)
  .text('drag')
  .mode('drag')
  .verticalMode(true);

ui.addSlider(0, 0.25, 0.49, 0.24)
  .range(0, 100)
  .value(50)
  .text('direct')
  .mode('direct');

ui.addSlider(0.5, 0.25, 0.49, 0.24)
  .range(0, 100)
  .value(50)
  .text('drag')
  .mode('drag');

ui.addSlider(0, 0.5, 0.49, 0.24)
  .range(0, 100)
  .text('direct')
  .mode('direct');

ui.addSlider(0.5, 0.5, 0.49, 0.24)
  .range(0, 100)
  .text('drag')
  .mode('drag');

ui.addSlider(0, 0.75, 0.24, 0.24)
  .range(0, 100)
  .value(50)
  .mode('direct')
  .verticalMode(true);

ui.addSlider(0.25, 0.75, 0.24, 0.24)
  .range(0, 100)
  .value(50)
  .mode('drag')
  .verticalMode(true);

ui.addSlider(0.5, 0.75, 0.24, 0.24)
  .range(0, 100)
  .mode('direct')
  .verticalMode(false);

ui.addSlider(0.75, 0.75, 0.24, 0.24)
  .range(0, 100)
  .mode('drag')
  .verticalMode(false);
victordiaz commented 2 years ago

Hi @polhomarkho thanks for the pull request! they look great! As you might have seen I haven't done much work with PHONK in the last year or so since I got quite busy with life and stuff 😅 I'll try to review the pull requests in the following days. Thanks again!

polhomarkho commented 2 years ago

Hi @victordiaz! Hope you're fine!
No worries, I wanted to add some stuff in Phonk and tried to do a PR as it wasn't a lot more work.
I'm not experienced as an Android developer, I'm more of a java server developer, so I tried my best and I'm open to any suggestion :-D
Anyway, thank you for your work, it's a really nice app you made!