GMS 2 drag a window boundaries by updating mouse object's position to mouse previous x and y?

does any body know how to keep an object snapped to the mouse position only on last frame?
I thought instead of offsets I could do something like this..
Code:
//Mouse object step event
var _widget = instance_position(x, y, UI_Widget);

if (_widget != noone)
{
    var _x1 = (_widget.location.X);
    var _y1 = (_widget.location.Y);
    var _x2 = (_widget.location.X+_widget.size.W);
    var _y2 = (_widget.location.Y+_widget.size.H);

    is_inside_widget = (xprevious > _x1 && yprevious > _y1 && xprevious <= _x2 && yprevious <= _y2);
    is_at_top        = (is_inside_widget && yprevious <= _x1 + 4);
    is_at_bottom     = (is_inside_widget && yprevious >  _x2 - 4);
    is_at_left       = (is_inside_widget && xprevious <= _y1 + 4);
    is_at_right      = (is_inside_widget && xprevious >  _y2 - 4);
   
    left_pressed   = (is_inside_widget && mouse_check_button_pressed(mb_left));
    middle_pressed = (is_inside_widget && mouse_check_button_pressed(mb_middle));
    right_pressed  = (is_inside_widget && mouse_check_button_pressed(mb_right));
    any_pressed    = (is_inside_widget && mouse_check_button_pressed(mb_any));
   
    left_held    = (is_inside_widget && mouse_check_button(mb_left));
    middle_held = (is_inside_widget && mouse_check_button(mb_middle));
    right_held  = (is_inside_widget && mouse_check_button(mb_right));
    any_held    = (is_inside_widget && mouse_check_button(mb_any));
   
   
    uscroll = (is_inside_widget && mouse_wheel_up());
    dscroll = (is_inside_widget && mouse_wheel_down());
   
    var _break = 0;
}

x = mouse_x;
y = mouse_y;
Code:
/// @description perform_resize(event)

if (!is_resizing)
{
    window_set_cursor(cr_arrow);
    if ((UI_Curser.is_at_top || UI_Curser.is_at_bottom  || UI_Curser.is_at_left || UI_Curser.is_at_right))
    {
        if (UI_Curser.left_pressed)
        {
            is_resizing = true;
        }
        window_set_cursor(cr_handpoint);
    }
}

if (is_resizing)
{
    if (UI_Curser.left_held && UI_Curser.is_at_top)
    {
        window_set_cursor(cr_size_ns);
        location.Y = UI_Curser.yprevious+2; 
    }
    else
    {
        is_resizing = false;
    }
}
the problem is I think the curser object's position updates to the mouse position regardless of where it was last frame. can anybody explain if this is possible? or why it isn't possible?
 
Top