"use strict"; function init_before_resize(win_id) { var cursor_mousedown_x = null; var cursor_mousedown_y = null; var active_window = null; var window_obj_width = null; var window_obj_height = null; var window_obj_left = null; var window_obj_top = null; var window_obj_offset_x = null; var window_obj_offset_y = null; var move_x = null; var move_y = null; var active_win_id = null; var icon_img = null; var icon_offset_x = null; var icon_offset_y = null; var is_maximized = null; var window_id = null; var global_css_pixel_ratio = null; global_css_pixel_ratio = get_pixel_ratio(); active_win_id = set_active_window(win_id); global_active_window = document.getElementById(active_win_id); //2023-09-22: //instead of assigning default CSS animations for all //CSS properties, assign CSS animations to a window depending //on its action. This function removes CSS animations from //the window, and sets animation to the width and height. //See file: 'window_2.js' set_animations_resize_window(win_id); //2024-03-19: //when the window is not in a cascaded state, then automatically remove //the "view more window actions" table that lists various window actions //that can be performed. remove_more_window_actions_box(win_id); //alert(active_win_id); if (global_active_window != null && active_win_id != false) { //alert("Active Window Exists"); if (global_left_mouse_button_down == true) { is_maximized = global_active_window.getAttribute("data-is_maximized"); if (is_maximized == "true") { return; } else if (is_maximized == "false") { //proceed - window is not in a maximized state } else { global_active_window.setAttribute("data-is_maximized", "false"); } //alert("Left Mouse Button is Down"); global_window_mode = "resize"; //set the window mode to "move" from the default of "standby" if (global_window_mode == "resize") { cursor_mousedown_x = global_mouse_coords_x; cursor_mousedown_y = global_mouse_coords_y; window_id = global_active_window.id; if (window_id != null) { active_window = document.getElementById(window_id); if (active_window != null) { get_coords(); window_obj_offset_x = parseFloat(parseFloat(global_mouse_coords_x) - parseFloat(active_window.style.left)); // null; //cursor_x - (elem_left); window_obj_offset_y = parseFloat(parseFloat(global_mouse_coords_y) - parseFloat(active_window.style.top)); // null; //cursor_y - (elem_top); active_window.setAttribute("data-cursor_offset_x", window_obj_offset_x); active_window.setAttribute("data-cursor_offset_y", window_obj_offset_y); icon_img = document.getElementById(window_id + "_tbl_0000_tr_0002_td_0007_img_0007"); icon_offset_x = global_mouse_coords_x - (parseFloat(active_window.style.left) + parseFloat(active_window.style.width)); //icon_offset_y = global_mouse_coords_y - (active_window.clientTop + active_window.clientHeight); icon_offset_y = global_mouse_coords_y - (parseFloat(active_window.style.top) + parseFloat(active_window.style.height)); active_window.setAttribute("data-click_resize_offset_x", icon_offset_x); active_window.setAttribute("data-click_resize_offset_y", icon_offset_y); //alert(icon_offset_y); save_window_params(active_window.id); place_ui_blocking_layer(); //2024-05-18: //set all windows' zIndex property in order. tabbed windows are set //with the lowest zIndex. cascaded windows are set next. minimized //windows are set next. finally, the maximized window(s) are set. //see file: 'window_2.js' ////set_all_window_zIndexes(); ////reset_all_window_zIndexes(); move_all_minimized_windows_to_front(); ////move_all_maximized_windows_to_front(); //2024-07-16: //this function updates the window's details //menu values (if it is currently displayed), //such as Top and Left coords. //see file: 'show_window_details.js' update_details(active_window.id); } } } } } } function resize_web_window() { var win = null; var tbl = null; var cursor_x = null; var cursor_y = null; var win_top = null; var win_left = null; var win_height = null; var win_width = null; var offset_x = null; var offset_y = null; var td_cell_div_id = null; var td_cell_div_obj = null; var click_icon_offset_x = null; var click_icon_offset_y = null; var min_width = null; var min_height = null; var pixel_ratio = null; var resize_xy = null; if (global_active_window === null) { ////console.log("global active window is null. \nexiting function"); return; } resize_xy = get_win_resize_xy_attribute(global_active_window.id); //2023-09-21: //This variable is an argument that specifies //if the window rsizes width & height, or width alone, //or height alone. It defaults to "xy" to resize both width (x), //and height (y). //2024-06-14: //the code below checks to see if the resize_xy variable //is not a null value if (resize_xy !== null) { resize_xy = resize_xy.toLowerCase(); if (resize_xy !== "xy" && resize_xy !== "x" && resize_xy !== "y") { resize_xy = "xy"; } } else { return; } //reset_css_pixel_ratio(); //pixel_ratio = get_pixel_ratio(); min_width = 180; min_height = 30; if (global_active_window != null) { if (global_left_mouse_button_down == true) { if (global_window_mode == "resize") { //2024-07-16: //this function updates the window's details //menu values (if it is currently displayed), //such as Width and Height coords. //see file: 'show_window_details.js' ////update_details(global_active_window.id); //alert("resize"); //save_window_params(win_id); get_coords(); cursor_x = parseFloat(global_mouse_coords_x); // / pixel_css_ratio; cursor_y = parseFloat(global_mouse_coords_y); // / pixel_css_ratio; win_top = parseFloat(global_active_window.style.top); win_left = parseFloat(global_active_window.style.left); win_width = parseFloat(global_active_window.style.width); win_height = parseFloat(global_active_window.style.height); click_icon_offset_x = global_active_window.getAttribute("data-click_resize_offset_x"); click_icon_offset_y = global_active_window.getAttribute("data-click_resize_offset_y"); tbl = global_active_window.childNodes[0]; tbl.style.width = parseFloat(global_active_window.style.width) + "px"; //offset_x = cursor_x - win_left; //offset_y = cursor_y - win_top; offset_x = parseInt(click_icon_offset_x); offset_y = parseInt(click_icon_offset_y); td_cell_div_id = (global_active_window.id + "_tbl_0000_tr_0001_td_0000_div_0000"); td_cell_div_obj = document.getElementById(td_cell_div_id); // td_cell_div_obj.style.minHeight = "60px"; td_cell_div_obj.style.overflow = "hidden"; if ((parseFloat(window.scrollX) * get_pixel_ratio()) + parseFloat(cursor_x) - parseFloat(win_left) > 277) { //cursor_x = parseFloat(cursor_x) / parseFloat(pixel_css_ratio); //2023-09-21: //Created a variable from an argument ('resizeXY') which //determines if height & width, or just width, or just //height is to be resized. The default value if not set, //or invalid value is "xy". if (resize_xy === "xy" || resize_xy === "x") { global_active_window.style.width = ((parseFloat(cursor_x) - parseFloat(win_left)) - parseInt(offset_x)) + "px"; //- parseFloat(td_cell_div_obj.style.left)) + "px"; } } ////else { // ////} if (((parseFloat(window.scrollY) * get_pixel_ratio()) + (parseFloat(cursor_y)) - parseFloat(win_top)) > 90) { ////if (parseFloat(global_active_window.offsetHeight) > 90) { //cursor_y = parseFloat(cursor_y) / parseFloat(pixel_css_ratio); //2023-09-21: //Created a variable from an argument ('resizeXY') which //determines if height & width, or just width, or just //height is to be resized. The default value if not set, //or invalid value is "xy". if (resize_xy === "xy" || resize_xy === "y") { global_active_window.style.height = ((parseFloat(cursor_y) - parseFloat(win_top)) - parseInt(offset_y)) + "px"; //- parseFloat(td_cell_div_obj.style.left)) + "px"; } } ////else { ////} global_active_window.childNodes[0].style.width = parseFloat(global_active_window.style.width) + "px"; global_active_window.childNodes[0].style.height = parseFloat(global_active_window.style.height) + "px"; //global_active_window.style.width = global_active_window.childNodes[0].style.width; //global_active_window.style.height = global_active_window.childNodes[0].style.height; resize_contents_container(global_active_window.id); save_window_params(global_active_window.id); populate_details(global_active_window.id); //resize the ui blocking layer that prevents unwanted user interaction resize_window_adjust_blocking_image(global_active_window.id); //2023-09-22: //This resizes the bar X object for resizing. In this case, //we are resizing the bar that provides only X resizing. //See file 'set_x_resize.js' set_size_resize_bar_x(global_active_window.id); //2023-09-23: //This resizes the bar Y object for resizing. In this case, //we are resizing the bar that provides only Y resizing. //See file 'set_y_resize.js' set_size_resize_bar_y(global_active_window.id); //2024-07-16: //this function updates the window's details //menu values (if it is currently displayed), //such as window state (Cascade, Maximize, etc.). //see file: 'show_window_details.js' update_details(global_active_window.id); //if the code editor is present in the window, //then show the code editor, and size the code //editor objects to fit the window's content //container. see file: 'code_editor_functions.js' if (is_code_editor_present(global_active_window.id) === true) { show_code_editor(global_active_window.id); resize_tabs_bar(global_active_window.id); on_cascade_resize_objects(global_active_window.id); }; /* tbl.style.width = parseFloat(global_active_window.style.width) + "px"; save_window_params(global_active_window.id); //return; } else { global_active_window.style.width = (min_width + 1) + "px"; //- parseFloat(td_cell_div_obj.style.left)) + "px"; tbl.style.width = parseFloat(global_active_window.style.width) + "px"; ////global_active_window.style.width = parseFloat(tbl.style.width) + "px"; //save_window_params(global_active_window.id); //return; } if (parseFloat(global_active_window.style.height) > min_height) { */ ////global_active_window.style.height = ((parseFloat(cursor_y) - parseFloat(win_top)) - parseInt(offset_y)) + "px"; //- parseFloat(td_cell_div_obj.style.left)) + "px"; /* tbl.style.height = parseFloat(global_active_window.style.height) + "px"; save_window_params(global_active_window.id); //return; } else { global_active_window.style.height = (min_height + 1) + "px"; //- parseFloat(td_cell_div_obj.style.left)) + "px"; ////global_active_window.style.height = parseFloat(tbl.style.height) + "px"; tbl.style.height = parseFloat(global_active_window.style.height) + "px"; //save_window_params(global_active_window.id); //return; } */ /* if (win_width <= min_width) { global_active_window.style.width = (min_width + 1) + "px"; tbl.style.width = parseFloat(global_active_window.style.width) + "px"; save_window_params(global_active_window.id); //return; } if (win_height <= min_height) { global_active_window.style.height = (min_height + 1) + "px"; tbl.style.height = parseFloat(global_active_window.style.height) + "px"; save_window_params(global_active_window.id); //return; } */ ////global_active_window.style.height = ((parseFloat(cursor_y) - parseFloat(win_top)) - parseInt(offset_y)) + "px"; // - parseFloat(td_cell_div_obj.style.top)) + "px"; ////tbl.style.height = global_active_window.style.height; //save_cascade_params(global_active_window.id); //alert("test"); ////save_window_params(global_active_window.id); /* global_active_window.style.position = "relative"; global_active_window.style.left = "0"; global_active_window.style.top = "0"; global_active_window.style.width = "auto"; global_active_window.style.height = "auto"; global_active_window.childNodes[0].style.width = "auto"; global_active_window.childNodes[0].style.height = "auto"; */ } else { } } else { return; } } else { return; } } //2023-09-23: //This function sets the HTML attribute which //determines whether to resize the window by X and Y, //or just X, or just Y. //see files: 'set_x_resize.js' and 'set_y_resize.js' function set_win_resize_xy_attribute(win_id, xy) { var win = null; var resize_xy = null; win = document.getElementById(win_id); if (win !== null) { resize_xy = xy; if (resize_xy === "xy" || resize_xy === "x" || resize_xy === "y") { } else { resize_xy = "xy"; } win.setAttribute("data-resize_xy", resize_xy); } } //2023-09-23: //This function gets the HTML attribute which //determines whether to resize the window by X and Y, //or just X, or just Y. //see files: 'set_x_resize.js' and 'set_y_resize.js' function get_win_resize_xy_attribute(win_id) { var win = null; var resize_xy = null; var xy = null; win = document.getElementById(win_id); if (win !== null) { resize_xy = win.getAttribute("data-resize_xy"); if (resize_xy !== null) { if (typeof resize_xy === "string") { if (resize_xy.length > 0) { xy = resize_xy; } else { xy = "xy"; set_win_resize_xy_attribute(win_id, xy); } } else { xy = "xy"; set_win_resize_xy_attribute(win_id, xy); } } else { xy = "xy"; set_win_resize_xy_attribute(win_id, xy); } } return xy; } //2023-09-23: //This function places x resize, and y resize //bars onto the window. See files: //'resize_window.js', set_y_resize.js', //and 'set_x_resize.js', and 'create_window.js' function setup_resize_bars(win_id) { setup_resize_bars_x(win_id); setup_resize_bars_y(win_id); }