XYZ_PARAM_CLICK_PAD
This element is similar to the XYZ_PARAM_SCRATCH_PAD, except that pressing the mouse anywhere on the surface also sets the value of the parameter (thats why it doesn't have the N_pixel_range attributes).
Attributes brief detailed show all inherited
For attributes add a 'x_', 'y_' or 'z_' prefix for each dimension. Note that only one dimension is mandatory (you do not need to connect all parameters: you can use for example the x control only).
Examples
- <!-- demo params -->
- <PARAM id="x" min="0" max="500" default="0" />
- <PARAM id="y" min="0" max="200" default="0" />
- <PARAM id="z" min="-10" max="10" default="0" />
- <!-- widget to make a background and overlay layers -->
- <WIDGET background_color="#d9f0ff" layout_type="layer_stack">
- <!-- the pad -->
- <XYZ_PARAM_CLICK_PAD id="xyz_pad" width="500" height="200" x_param_id="x" y_param_id="y" y_reverse="true" x_fine_ratio="10" y_fine_ratio="10" z_param_id="z" z_positions_count="5" />
- <!-- info line -->
- <COLUMN spacing="10">
- <ROW spacing="5">
- <TEXT value="mouse position (x/y):" />
- <PARAM_TEXT param_id="xyz_pad.mouse_position.x" />
- <PARAM_TEXT param_id="xyz_pad.mouse_position.y" />
- </ROW>
- <ROW spacing="10">
- <PARAM_TEXT_CONTROL param_id="x" content="x: {value}" />
- <PARAM_TEXT_CONTROL param_id="y" content="y: {value}" />
- <PARAM_TEXT_CONTROL param_id="z" content="z: {value}" />
- <PARAM_TEXT param_id="xyz_pad.mouse_down" value_format=".0" content="mouse_down: {value}" />
- <PARAM_TEXT param_id="xyz_pad.mouse_over" value_format=".0" content="mouse_over: {value}" />
- <PARAM_TEXT param_id="xyz_pad.focus" value_format=".0" content="focus: {value}" />
- </ROW>
- </COLUMN>
- <!-- text when mouse is pressed -->
- <TEXT id="mouse_down_text" value=" MOUSE PRESSED " v_offset="-53" font_size="+5" font_weight="bold" background_color="#7681b3" text_color="#FFFFFF" />
- <PARAM_LINK from="xyz_pad.mouse_down" to="mouse_down_text.visible" />
- <!-- detect mouse wheel events -->
- <ACTION_TRIGGER event_id="xyz_pad.mouse_wheel_up" script="
- events_info = "MOUSE WHEEL UP";
- text_events.opacity = 1;
- animate_opacity = 0;
- " requires="events_info;text_events.opacity;animate_opacity"/>
- <ACTION_TRIGGER event_id="xyz_pad.mouse_wheel_down" script="
- events_info = "MOUSE WHEEL DOWN";
- text_events.opacity = 1;
- animate_opacity = 0;
- " />
- <STRING id="events_info" default="" />
- <TEXT id="text_events" string_id="events_info" v_offset="53" font_size="+5" font_weight="bold" background_color="#7681b3" text_color="#FFFFFF" opacity="0" />
- <!-- param_animator to fade_out text -->
- <PARAM_ANIMATOR duration_ms="500" id="animate_opacity" param_id="text_events.opacity" exposed="true" />
- </WIDGET>
Take a look to XYZ_IMAGE_PARAM_JOYSTICK that can handle mouse drag of a "joystick".