zoom_arr change & Fix 0 == 0.0 bug

This commit is contained in:
Nutbuster 2021-07-19 08:42:10 +10:00
parent 0f581c1344
commit 24a8aeadc1

View File

@ -68,7 +68,9 @@ init python:
loadGallery()
#for zooming in and out
zoom_arr = []
zoom_arr = [0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.5, 1.75, 2.0]
"""
for x in range(1,5):
_zoom = 1.0
_zoom *= 1+(x*0.25)
@ -80,6 +82,7 @@ init python:
zoom_arr.append(_zoom)
zoom_arr.sort()
"""
"""
'Recursive' / Loopable / Roundtrip Screens
_0 <-> _1
@ -94,10 +97,10 @@ screen cg_gallery_1( __yoffset = 0, origin = 'CG'):
use cg_gallery('0', __yoffset, origin)
#screen view_image(fn, _origin, zoom=1):
screen view_image_a(fn, _origin, zoom):
screen view_image_a(fn, _origin, zoom = zoom_arr.index(1.0)):
tag menu
use view_image(fn, _origin, zoom, 'b')
screen view_image_b(fn, _origin, zoom):
screen view_image_b(fn, _origin, zoom = zoom_arr.index(1.0)):
tag menu
use view_image(fn, _origin, zoom, 'a')
@ -192,7 +195,7 @@ screen flag_button(item, yoffset, origin):
if flag:
button:
action ShowMenu('view_image_a', item, ShowMenu('cg_gallery_0', yoffset, origin), 0.0)
action ShowMenu('view_image_a', item, ShowMenu('cg_gallery_0', yoffset, origin))
xcenter 0.5 ycenter 0.5
padding (1,0,1,2)
vbox:
@ -209,10 +212,8 @@ screen flag_button(item, yoffset, origin):
"""
view_image, Loads the image in fullscreen with viewport control.
"""
screen view_image(item, _origin, zoom=0.0, flag='a'):
screen view_image(item, _origin, zoom = zoom_arr.index(1.0), flag='a'):
python:
if zoom == 0.0:
zoom = zoom_arr.index(1.0)
zoom_a = zoom+1
zoom_a_f = ShowMenu('view_image_'+flag, item, _origin, zoom_a)
zoom_b = zoom-1
@ -222,10 +223,10 @@ screen view_image(item, _origin, zoom=0.0, flag='a'):
key "game_menu" action _origin
# mousewheel & insert+delete
if zoom_a < len(zoom_arr): #zoom in
if zoom < len(zoom_arr)-1: #zoom in
key 'mousedown_4' action zoom_a_f
key 'K_INSERT' action zoom_a_f
if zoom_b > 0: #and (item['wh'][0] <= 1920 or item['wh'][1] <= 1080):
if zoom > 0: #and (item['wh'][0] <= 1920 or item['wh'][1] <= 1080):
key 'mousedown_5' action zoom_b_f
key 'K_DELETE' action zoom_b_f