Handbook
Glossary
scaling-image-gadget
Scaling images in a gadget
Next:
autoscaling-image-gadget
Vocabulary
images
.
viewer
.
scaling
Class description
Allows clicking and dragging on an image with the right-mouse button to resize an image. It will always keep to the original aspect ratio
Definition
USING:
images.viewer
;
IN:
images.viewer.scaling
TUPLE:
scaling-image-gadget
<
image-gadget
{
scale
initial:
1
}
saved-scale
;
Methods
USING:
accessors
images.viewer.private
images.viewer.scaling
kernel
opengl.textures
ui.gadgets
ui.render
;
M:
scaling-image-gadget
draw-gadget*
dup
image>>
[
[
pref-dim
]
[
image-gadget-texture
draw-scaled-texture
]
bi
]
[
drop
]
if
;
USING:
accessors
images.viewer.scaling
kernel
math.vectors
ui.gadgets
;
M:
scaling-image-gadget
pref-dim*
dup
pref-dim>>
[
nip
]
[
[
image>>
dim>>
]
[
scale>>
]
bi
v*n
v>integer
]
if*
;