diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index c867de103..2ff37ec35 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -259,13 +259,13 @@ {"name":"draw_text_path","order":25,"path":"scripts/draw_text_path/draw_text_path.yy",}, {"name":"sh_brush_outline","order":7,"path":"shaders/sh_brush_outline/sh_brush_outline.yy",}, {"name":"s_node_grid_tri_noise","order":22,"path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",}, - {"name":"o_dialog_menubox","order":1,"path":"objects/o_dialog_menubox/o_dialog_menubox.yy",}, + {"name":"o_dialog_menubox","order":2,"path":"objects/o_dialog_menubox/o_dialog_menubox.yy",}, {"name":"s_node_blend","order":7,"path":"sprites/s_node_blend/s_node_blend.yy",}, {"name":"node_wrap_perspective","order":15,"path":"scripts/node_wrap_perspective/node_wrap_perspective.yy",}, {"name":"s_node_rigidSim_object_spawner","order":5,"path":"sprites/s_node_rigidSim_object_spawner/s_node_rigidSim_object_spawner.yy",}, {"name":"node_pb_draw_roundrectangle","order":4,"path":"scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.yy",}, {"name":"draw_text_function","order":11,"path":"scripts/draw_text_function/draw_text_function.yy",}, - {"name":"o_dialog_file_name_collection","order":5,"path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",}, + {"name":"o_dialog_file_name_collection","order":6,"path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",}, {"name":"node_line","order":3,"path":"scripts/node_line/node_line.yy",}, {"name":"s_node_frame","order":1,"path":"sprites/s_node_frame/s_node_frame.yy",}, {"name":"s_node_fluidSim_turbulence","order":10,"path":"sprites/s_node_fluidSim_turbulence/s_node_fluidSim_turbulence.yy",}, @@ -299,7 +299,7 @@ {"name":"s_node_particle_effector","order":13,"path":"sprites/s_node_particle_effector/s_node_particle_effector.yy",}, {"name":"sh_blur_bokeh","order":8,"path":"shaders/sh_blur_bokeh/sh_blur_bokeh.yy",}, {"name":"s_node_translate_point","order":14,"path":"sprites/s_node_translate_point/s_node_translate_point.yy",}, - {"name":"o_dialog_textbox_autocomplete","order":6,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",}, + {"name":"o_dialog_textbox_autocomplete","order":7,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",}, {"name":"s_node_loop_input","order":14,"path":"sprites/s_node_loop_input/s_node_loop_input.yy",}, {"name":"node_strand_length_adjust","order":11,"path":"scripts/node_strand_length_adjust/node_strand_length_adjust.yy",}, {"name":"node_blinker","order":18,"path":"scripts/node_blinker/node_blinker.yy",}, @@ -519,7 +519,7 @@ {"name":"buttonGroup","order":5,"path":"scripts/buttonGroup/buttonGroup.yy",}, {"name":"s_node_image_sheet","order":7,"path":"sprites/s_node_image_sheet/s_node_image_sheet.yy",}, {"name":"locale_data","order":1,"path":"scripts/locale_data/locale_data.yy",}, - {"name":"o_dialog_scrollbox","order":2,"path":"objects/o_dialog_scrollbox/o_dialog_scrollbox.yy",}, + {"name":"o_dialog_scrollbox","order":3,"path":"objects/o_dialog_scrollbox/o_dialog_scrollbox.yy",}, {"name":"s_node_palette","order":10,"path":"sprites/s_node_palette/s_node_palette.yy",}, {"name":"curve_damping_function","order":2,"path":"scripts/curve_damping_function/curve_damping_function.yy",}, {"name":"fd_rectangle_get_collision_mask_surface","order":6,"path":"scripts/fd_rectangle_get_collision_mask_surface/fd_rectangle_get_collision_mask_surface.yy",}, @@ -675,6 +675,7 @@ {"name":"s_node_surface_from_buffer","order":1,"path":"sprites/s_node_surface_from_buffer/s_node_surface_from_buffer.yy",}, {"name":"node_iterator_filter_output","order":2,"path":"scripts/node_iterator_filter_output/node_iterator_filter_output.yy",}, {"name":"color_function","order":9,"path":"scripts/color_function/color_function.yy",}, + {"name":"o_dialog_textbox_slider","order":9,"path":"objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy",}, {"name":"fd_rectangle_set_pressure_size","order":11,"path":"scripts/fd_rectangle_set_pressure_size/fd_rectangle_set_pressure_size.yy",}, {"name":"node_color_data","order":6,"path":"scripts/node_color_data/node_color_data.yy",}, {"name":"node_array_shift","order":12,"path":"scripts/node_array_shift/node_array_shift.yy",}, @@ -738,7 +739,7 @@ {"name":"sh_draw_single_channel","order":3,"path":"shaders/sh_draw_single_channel/sh_draw_single_channel.yy",}, {"name":"draw_sprite_ext_override","order":9,"path":"scripts/draw_sprite_ext_override/draw_sprite_ext_override.yy",}, {"name":"node_array_add","order":6,"path":"scripts/node_array_add/node_array_add.yy",}, - {"name":"o_dialog_textbox_function_guide","order":7,"path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",}, + {"name":"o_dialog_textbox_function_guide","order":8,"path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",}, {"name":"node_3d_material","order":16,"path":"scripts/node_3d_material/node_3d_material.yy",}, {"name":"pcx_server","order":2,"path":"scripts/pcx_server/pcx_server.yy",}, {"name":"s_node_array_set","order":9,"path":"sprites/s_node_array_set/s_node_array_set.yy",}, @@ -838,6 +839,7 @@ {"name":"sh_blend_subtract","order":5,"path":"shaders/sh_blend_subtract/sh_blend_subtract.yy",}, {"name":"BBMOD_Vec4","order":6,"path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",}, {"name":"s_biterator_color_slot","order":17,"path":"sprites/s_biterator_color_slot/s_biterator_color_slot.yy",}, + {"name":"o_dialog_file_name","order":1,"path":"objects/o_dialog_file_name/o_dialog_file_name.yy",}, {"name":"s_node_pb_layer","order":18,"path":"sprites/s_node_pb_layer/s_node_pb_layer.yy",}, {"name":"node_surface_from_color","order":1,"path":"scripts/node_surface_from_color/node_surface_from_color.yy",}, {"name":"s_node_pb_draw_rectangle","order":13,"path":"sprites/s_node_pb_draw_rectangle/s_node_pb_draw_rectangle.yy",}, @@ -963,7 +965,7 @@ {"name":"fd_rectangle_get_initial_value_pressure","order":7,"path":"scripts/fd_rectangle_get_initial_value_pressure/fd_rectangle_get_initial_value_pressure.yy",}, {"name":"node_timeline_preview","order":2,"path":"scripts/node_timeline_preview/node_timeline_preview.yy",}, {"name":"__polygon","order":2,"path":"scripts/__polygon/__polygon.yy",}, - {"name":"o_dialog_fontscrollbox","order":4,"path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",}, + {"name":"o_dialog_fontscrollbox","order":5,"path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",}, {"name":"sh_d3d_normal_blur","order":25,"path":"shaders/sh_d3d_normal_blur/sh_d3d_normal_blur.yy",}, {"name":"d3d_vertex","order":10,"path":"scripts/d3d_vertex/d3d_vertex.yy",}, {"name":"node_fluid_render_output","order":11,"path":"scripts/node_fluid_render_output/node_fluid_render_output.yy",}, @@ -1627,7 +1629,7 @@ {"name":"node_strand_render","order":5,"path":"scripts/node_strand_render/node_strand_render.yy",}, {"name":"s_node_3d_obj_combine","order":5,"path":"sprites/s_node_3d_obj_combine/s_node_3d_obj_combine.yy",}, {"name":"s_node_wav_file_read","order":16,"path":"sprites/s_node_wav_file_read/s_node_wav_file_read.yy",}, - {"name":"o_dialog_assetbox","order":3,"path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",}, + {"name":"o_dialog_assetbox","order":4,"path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",}, {"name":"node_lerp","order":2,"path":"scripts/node_lerp/node_lerp.yy",}, {"name":"node_3d_instancer","order":3,"path":"scripts/node_3d_instancer/node_3d_instancer.yy",}, {"name":"s_node_pixel_sort","order":42,"path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 69b482abf..27be16ad3 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -640,6 +640,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_menu_separator.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_menu_white.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_shadow_drop_down_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_textbox_number_slider.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_timeline_dopesheet_bg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_tool_side.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_toolbar_shadow.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",}, @@ -679,6 +680,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_slider.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_text_box_header.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_textbox_code_line.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_textbox_number_slider.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_textbox.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_widget_highlight.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"meta.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default",}, @@ -1300,6 +1302,7 @@ {"id":{"name":"s_node_surface_from_buffer","path":"sprites/s_node_surface_from_buffer/s_node_surface_from_buffer.yy",},}, {"id":{"name":"node_iterator_filter_output","path":"scripts/node_iterator_filter_output/node_iterator_filter_output.yy",},}, {"id":{"name":"color_function","path":"scripts/color_function/color_function.yy",},}, + {"id":{"name":"o_dialog_textbox_slider","path":"objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy",},}, {"id":{"name":"d3d_cube_faces","path":"scripts/d3d_cube_faces/d3d_cube_faces.yy",},}, {"id":{"name":"fd_rectangle_set_pressure_size","path":"scripts/fd_rectangle_set_pressure_size/fd_rectangle_set_pressure_size.yy",},}, {"id":{"name":"node_color_data","path":"scripts/node_color_data/node_color_data.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index b9da09347..ddd4a0a58 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/_p_dialog/Create_0.gml b/objects/_p_dialog/Create_0.gml index a1fa50d74..864b3b4aa 100644 --- a/objects/_p_dialog/Create_0.gml +++ b/objects/_p_dialog/Create_0.gml @@ -1,7 +1,8 @@ /// @description init #region data - with(_p_dialog) - other.depth = min(depth - 1, other.depth); + with(_p_dialog) other.depth = min(depth - 1, other.depth); + //print($"{object_get_name(object_index)}: {depth}"); + ds_list_add(DIALOGS, self); active = true; diff --git a/objects/o_dialog_color_quick_pick/Create_0.gml b/objects/o_dialog_color_quick_pick/Create_0.gml index e0e2b66ca..d25e9cc31 100644 --- a/objects/o_dialog_color_quick_pick/Create_0.gml +++ b/objects/o_dialog_color_quick_pick/Create_0.gml @@ -1,4 +1,5 @@ /// @description -depth = -999; +depth = -19999; + selecting = noone; onApply = noone; \ No newline at end of file diff --git a/objects/o_dialog_textbox_slider/Create_0.gml b/objects/o_dialog_textbox_slider/Create_0.gml new file mode 100644 index 000000000..9c00ac989 --- /dev/null +++ b/objects/o_dialog_textbox_slider/Create_0.gml @@ -0,0 +1,10 @@ +/// @description +depth = -19999; +tb = noone; + +function activate() { + slide_da = -1; + + slide_dx = mouse_mx; + slide_dy = mouse_my; +} \ No newline at end of file diff --git a/objects/o_dialog_textbox_slider/Draw_64.gml b/objects/o_dialog_textbox_slider/Draw_64.gml new file mode 100644 index 000000000..faf112521 --- /dev/null +++ b/objects/o_dialog_textbox_slider/Draw_64.gml @@ -0,0 +1,78 @@ +/// @description +if(tb == noone) exit; + +if(!MOUSE_WRAPPING) { + var _adx = mouse_mx - slide_dx; + var _ady = slide_dy - mouse_my; + + if(slide_da == -1 && abs(_ady - _adx) > 8) slide_da = abs(_adx) > abs(_ady); + else if(slide_da == 0 && abs(_ady) > abs(_adx) + 8 && abs(mouse_my - slide_dy) > 64) slide_da = 1; + else if(slide_da == 1 && abs(_adx) > abs(_ady) + 8 && abs(mouse_mx - slide_dx) > 64) slide_da = 0; + + var spd = (slide_da? _ady : _adx) * tb.slide_speed; + var _val = value_snap(tb.slide_sv + spd, tb.slide_speed); + + draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text); + + var _stp_sz = 50 * tb.slide_speed; + var _stp_fl = round(_val / _stp_sz) * _stp_sz; + var _stp_md = _val - _stp_fl; + + var _tw = 48; + for( var i = -2; i <= 2; i++ ) { + var _v = _stp_fl + i * _stp_sz; + _tw = max(_tw, string_width(_v) + 16); + } + + var _snp_s = 50 * tb.slide_speed; + var _snp_v = round(_val / _snp_s) * _snp_s; + if(abs(_val - _snp_v) < 5 * tb.slide_speed) + _val = _snp_v; + + if(slide_da) { + var _sdw = _tw; + var _sdh = 256; + var _sdx = slide_dx - _sdw / 2; + var _sdy = mouse_my - _sdh / 2; + + draw_sprite_stretched_ext(THEME.textbox_number_slider, 0, _sdx, _sdy, _sdw, _sdh, COLORS.panel_inspector_group_bg, 1); + + for( var i = -2; i <= 2; i++ ) { + var _v = _stp_fl + i * _stp_sz; + + draw_set_alpha(0.4 - abs(i) * 0.1); + draw_text(slide_dx, slide_dy - (_v - tb.slide_sv) / tb.slide_speed, _v); + } + + draw_set_alpha(1); + draw_text(slide_dx, slide_dy - (_val - tb.slide_sv) / tb.slide_speed, _val); + } else { + var _sdw = 240; + var _sdh = 48; + var _sdx = mouse_mx - _sdw / 2; + var _sdy = slide_dy - _sdh / 2; + + draw_sprite_stretched_ext(THEME.textbox_number_slider, 0, _sdx, _sdy, _sdw, _sdh, COLORS.panel_inspector_group_bg, 1); + + for( var i = -2; i <= 2; i++ ) { + var _v = _stp_fl + i * _stp_sz; + + draw_set_alpha(0.4 - abs(i) * 0.1); + draw_text(slide_dx + (_v - tb.slide_sv) / tb.slide_speed, slide_dy, _v); + } + + draw_set_alpha(1); + draw_text(slide_dx + (_val - tb.slide_sv) / tb.slide_speed, slide_dy, _val); + } + + tb._input_text = string_real(_val); + if(tb.apply()) UNDO_HOLDING = true; +} + +if(MOUSE_WRAPPING) { + slide_dx = mouse_mx; + slide_dy = mouse_my; +} + +setMouseWrap(); +tb = noone; \ No newline at end of file diff --git a/objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy b/objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy new file mode 100644 index 000000000..84ec769f6 --- /dev/null +++ b/objects/o_dialog_textbox_slider/o_dialog_textbox_slider.yy @@ -0,0 +1,34 @@ +{ + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "o_dialog_textbox_slider", + "eventList": [ + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, + ], + "managed": true, + "overriddenProperties": [], + "parent": { + "name": "widget", + "path": "folders/dialog/widget.yy", + }, + "parentObjectId": null, + "persistent": false, + "physicsAngularDamping": 0.1, + "physicsDensity": 0.5, + "physicsFriction": 0.2, + "physicsGroup": 1, + "physicsKinematic": false, + "physicsLinearDamping": 0.1, + "physicsObject": false, + "physicsRestitution": 0.1, + "physicsSensor": false, + "physicsShape": 1, + "physicsShapePoints": [], + "physicsStartAwake": true, + "properties": [], + "solid": false, + "spriteId": null, + "spriteMaskId": null, + "visible": true, +} \ No newline at end of file diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 69e82124b..a83f606da 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -246,6 +246,8 @@ globalvar DIALOGS, WIDGET_TAB_BLOCK; DIALOGS = ds_list_create(); WIDGET_TAB_BLOCK = false; + + instance_create(0, 0, o_dialog_textbox_slider); #endregion #region async diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 8abcc6199..8a074fc4b 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -16,8 +16,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { slidable = false; sliding = false; - slide_mx = 0; - slide_my = 0; + slide_sv = 0; slide_speed = 1 / 10; starting_char = 1; @@ -331,52 +330,6 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { _text = string_real(_text); _current_text = _text; - if(sliding > 0) { - var dx = _m[0] - slide_mx; - var dy = -(_m[1] - slide_my); - - if(sliding == 1 && (abs(dx) > 16 || abs(dy) > 16)) { - sliding = 2; - slide_mx = _m[0]; - slide_my = _m[1]; - - dx = 0; - dy = 0; - } - - if(sliding == 2) { - var _ip = _input_text; - - if(!MOUSE_WRAPPING) { - var spd = (abs(dx) > abs(dy)? dx : dy) * slide_speed; - - if(key_mod_press(ALT)) - spd /= 10; - if(key_mod_press(CTRL)) - spd *= 10; - - _input_text = string_real(toNumber(_input_text) + spd); - - if(apply()) - UNDO_HOLDING = true; - } - - if(MOUSE_WRAPPING || _input_text != _ip) { - slide_mx = _m[0]; - slide_my = _m[1]; - } - - setMouseWrap(); - if(mouse_release(mb_left)) - deactivate(); - } - - if(mouse_release(mb_left)) { - sliding = 0; - UNDO_HOLDING = false; - } - } - var tb_surf_x = _x + ui(8); var tb_surf_y = _y; @@ -491,7 +444,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { if(!hoverRect && mouse_press(mb_left)) deactivate(); - } else { + } else { #region draw draw_set_text(font == noone? f_p0 : font, fa_left, fa_center); var _display_text = _raw_text; if(input == TEXTBOX_INPUT.number) { @@ -545,7 +498,29 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { BLEND_ALPHA draw_surface(text_surface, tb_surf_x, tb_surf_y); BLEND_NORMAL - } + } #endregion + + if(sliding > 0) { #region + var dx = _m[0] - slide_mx; + var dy = -(_m[1] - slide_my); + + if(sliding == 1 && (abs(dx) > 16 || abs(dy) > 16)) { + sliding = 2; + slide_sv = toNumber(_input_text); + o_dialog_textbox_slider.activate() + } + + if(sliding == 2) { + o_dialog_textbox_slider.tb = self; + + if(mouse_release(mb_left)) deactivate(); + } + + if(mouse_release(mb_left)) { + sliding = 0; + UNDO_HOLDING = false; + } + } #endregion if(DRAGGING && (DRAGGING.type == "Text" || DRAGGING.type == "Number") && hover && hoverRect) { draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _y, _w, _h, COLORS._main_value_positive, 1);