CN-121541967-B - Method and system for selecting and merging layout windows based on mouse frame
Abstract
The invention discloses a method and a system for selecting and merging layout windows based on a mouse frame, wherein the method comprises the steps of establishing event monitoring, entering a frame selection standby state, setting coordinate rolling offset correction and boundary cutting rules, recording initial coordinates when a mouse is pressed down and entering the frame selection state, determining the position and the size of a rectangular frame according to the initial coordinates and the current coordinates during the movement of the mouse, displaying a frame selection range in real time by semitransparent elements in a layout container, acquiring final coordinates of the rectangular frame when the mouse is lifted up, traversing a layout window set, determining a hit window set according to the overlapping relation of circumscribed rectangles of all windows and the rectangular frame, solving the minimum circumscribed boundary according to four-corner coordinates of the hit window set to generate a target merging window with boundary parameters, removing the hit window from the layout container, and integrating display contents of the hit window into a target merging window area. The technical scheme of the invention solves the problems of low efficiency, lack of pre-judgment and inaccurate judgment of the existing multi-window batch merging.
Inventors
- JI HAIJIAO
- CHEN KUAN
- WANG BINBIN
- TAN MIN
- WU JIULING
- DUAN YUJIE
- SUN DEZHI
Assignees
- 深圳市东微智能科技股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260119
Claims (7)
- 1. The method for selecting and combining layout windows based on the mouse frame is applied to a browser page with a layout container and a plurality of layout windows, and each layout window is provided with a corresponding circumscribed rectangle, and is characterized by comprising the following steps: Establishing event monitoring, entering a frame selection standby state, and setting coordinate rolling offset correction and boundary cutting rules; Recording initial coordinates and entering a frame selection state when the mouse is detected to be pressed down; determining the position and the size of a rectangular frame according to the initial coordinate and the current coordinate during the movement of the mouse, and displaying the frame selection range in real time by using semitransparent elements in a layout container; The method comprises the steps of obtaining final coordinates of a rectangular frame when a mouse is detected to be lifted, traversing a layout window set, and determining a hit window set according to the overlapping relation between each window circumscribed rectangle and the rectangular frame, wherein the method specifically comprises the steps of establishing a candidate window set based on the boundary relation between the rectangular frame and each layout window circumscribed rectangle; The method comprises the steps of obtaining a minimum circumscribed boundary according to four corner coordinates of a hit window set, and generating a target merging window with parameters of the minimum circumscribed boundary, wherein the method specifically comprises the steps of aligning the boundary of the target merging window according to a preset grid of a layout container, executing edge adsorption when the distance between the merging boundary and the edge of the container or adjacent windows which do not participate in merging is smaller than a preset gap, checking whether the outer edge distance after merging is not smaller than a preset edge distance value, fine-tuning the boundary along the shortest direction if the outer edge distance is not smaller than the preset edge distance value, detecting whether the target merging window overlaps with the windows which do not participate in merging, and preferentially displacing along the direction consistent with the normal of an overlapping area until the overlapping is eliminated if the outer edge distance is smaller than the preset edge distance value, and when the displacement is beyond the boundary of the layout container, reducing the size of the target merging window according to priority to meet the minimum gap requirement, writing the displacement and scaled adjustment quantity into a layout description data structure to keep the follow-up layout calculation consistent; And removing the hit window from the layout container, integrating the display content of the hit window into the target merge window area, updating the layout description data structure and the stacking sequence, and if the hit window is not detected, canceling the presentation of the rectangular frame and maintaining the existing layout unchanged.
- 2. The method for selecting and merging layout windows based on a mouse frame according to claim 1, wherein the step of establishing the candidate window set based on the boundary relation between the rectangle frame and the bounding rectangle of each layout window further comprises: Dividing the layout container into grid sub-barrels by adopting a space partition index to locate windows which are adjacent to the rectangular frame and serve as initial candidates; Performing neighborhood extension on the initial candidate to include windows whose boundaries are close but do not fall into the sub-bucket; And eliminating windows in a hidden state or beyond the visible area to reduce the candidate size.
- 3. The method for selecting and merging layout windows based on a mouse frame according to claim 1, wherein before the step of recording start coordinates and entering the frame selection state when the mouse is pressed, further comprising: Constructing a window index table, and recording the identification, the external rectangle, the stacking sequence and the affiliated layout container of each window; Subscribing window size change and position change events, and carrying out increment update on the index table when detecting the change; The scroll offset is recorded and provided to the coordinate correction rules for use when scrolling the page.
- 4. The method for selecting and merging layout windows based on a mouse frame according to claim 1, wherein the steps of removing the hit window from the layout container, integrating the display content thereof into the target merge window area, updating the layout description data structure and the stacking sequence, and if the hit window is not detected, withdrawing the presentation of the rectangular frame and maintaining the existing layout unchanged, specifically comprise: Organizing the integrated content according to the spatial sequence of the hit window from top left to bottom right in the original layout; Migrating the interaction state and the visibility of each hit window to the corresponding area of the target merging window; Setting a target merging window as a focus and updating a stacking sequence; and when the hit window is not detected, canceling the presentation of the rectangular frame and cleaning the temporary cache related to the current frame selection.
- 5. A system for selecting and merging layout windows based on a mouse frame, comprising: the establishing module is used for establishing event monitoring and entering a frame selection standby state, and setting coordinate rolling offset correction and boundary cutting rules; The recording module is used for recording the initial coordinates and entering a frame selection state when the mouse is pressed; The display module is used for determining the position and the size of the rectangular frame according to the initial coordinate and the current coordinate during the movement of the mouse, and displaying the frame selection range in real time by using semitransparent elements in the layout container; The determining module is used for acquiring the final coordinates of the rectangular frame when the mouse is detected to be lifted, traversing the layout window set, and determining a hit window set according to the overlapping relation between the circumscribed rectangle of each window and the rectangular frame, and concretely comprises the steps of establishing a candidate window set based on the boundary relation between the rectangular frame and the circumscribed rectangle of each layout window, calculating the proportion of the overlapping area of the candidate window and the rectangular frame to the area of the candidate window, comparing the proportion with a preset first threshold value, and determining the window as a hit when the proportion is not less than the first threshold value; The generation module is used for solving the minimum circumscribed boundary according to the four-corner coordinates of the hit window set and generating a target merging window with parameters of the minimum circumscribed boundary, and concretely comprises the steps of aligning the boundary of the target merging window according to a preset grid of a layout container, executing edge adsorption when the distance between the merging boundary and the edge of the container or adjacent windows which do not participate in merging is smaller than a preset gap, checking whether the outer edge after merging is not smaller than a preset edge distance value, fine-tuning the boundary along the shortest direction if the outer edge distance is not smaller than the preset edge distance value, detecting whether the target merging window and the windows which do not participate in merging overlap, preferentially displacing along the direction which is normal to the overlapping area until the overlapping is eliminated if the outer edge distance is smaller than the preset edge distance value, and reducing the size of the target merging window according to the priority when the displacement is going beyond the boundary of the layout container so as to meet the minimum gap requirement, and writing the displacement and scaled adjustment quantity into a layout description data structure so as to keep the follow-up layout calculation consistency; and the integration module is used for removing the hit window from the layout container, integrating the display content of the hit window into the target merge window area, updating the layout description data structure and the stacking sequence, and if the hit window is not detected, canceling the presentation of the rectangular frame and maintaining the existing layout unchanged.
- 6. A computer device comprising a memory having stored therein computer readable instructions which when executed implement the steps of the method of mouse frame based selection and layout window of any of claims 1 to 4.
- 7. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the method of mouse-frame based selection and layout window of any of claims 1 to 4.
Description
Method and system for selecting and merging layout windows based on mouse frame Technical Field The invention relates to the technical field of front-end interface interaction, in particular to a method and a system for selecting and combining layout windows based on a mouse frame. Background The existing scheme of the current Web-side multi-window layout management is mainly divided into two types, namely a two-by-two merging process triggered by a button, a user needs to select one window first and then select other windows one by one, a system generates a new boundary for covering the two windows, a two-dependent shortcut key and multiple options, and once merging is performed after a selected set is established through one-by-one click. Although the proposal can finish merging, the interactive links still take multiple point selection as the main part under the batch scene, the range determination and result confirmation are difficult to finish in single operation, visual pre-judgment feedback which directly corresponds to the final coverage area is lacking before merging, users easily perform false selection or miss selection near the boundary, meanwhile, the boundary determination generally depends on simple coordinate value and traversal, the situation of inaccurate merging range is easy to occur when the dense window and rolling offset are faced, and the partial realization is also limited by a specific front end frame or shortcut key mechanism and the adaptability under different operating system environments. Disclosure of Invention The embodiment of the application aims to provide a method and a system for selecting and combining layout windows based on a mouse frame, which are used for solving the technical problems of poor combination efficiency, precision and compatibility of multiple windows at present. In order to solve the above technical problems, the embodiments of the present application provide a method for selecting and combining layout windows based on a mouse frame, which adopts the following technical scheme: A method for selecting and combining layout windows based on a mouse frame is applied to a browser page with a layout container and a plurality of layout windows, each layout window is provided with a corresponding circumscribed rectangle, and comprises the following steps: Establishing event monitoring, entering a frame selection standby state, and setting coordinate rolling offset correction and boundary cutting rules; Recording initial coordinates and entering a frame selection state when the mouse is detected to be pressed down; determining the position and the size of a rectangular frame according to the initial coordinate and the current coordinate during the movement of the mouse, and displaying the frame selection range in real time by using semitransparent elements in a layout container; When the mouse is detected to be lifted, the final coordinates of the rectangular frame are obtained, a layout window set is traversed, and a hit window set is determined according to the overlapping relation between the circumscribed rectangle of each window and the rectangular frame; Obtaining the minimum external boundary according to four-corner coordinates of the hit window set, and generating a target merging window with the boundary parameters; And removing the hit window from the layout container, integrating the display content of the hit window into the target merge window area, updating the layout description data structure and the stacking sequence, and if the hit window is not detected, canceling the presentation of the rectangular frame and maintaining the existing layout unchanged. In a possible implementation manner, the step of acquiring final coordinates of the rectangular frame when the mouse is detected to be lifted, traversing the layout window set, and determining the hit window set according to the overlapping relation between the rectangle circumscribed by each window and the rectangular frame specifically includes: Establishing a candidate window set based on the boundary relation between the rectangular frame and the circumscribed rectangle of each layout window; calculating the proportion of the overlapping area of the candidate window and the rectangular frame to the area of the window, comparing the proportion with a preset first threshold value, and determining that the window is hit when the proportion is not smaller than the first threshold value; when a plurality of windows simultaneously satisfy the hit condition, deduplication is performed in the stacking order and the forefront visible person is retained. In one possible implementation manner, the step of establishing the candidate window set based on the boundary relationship between the rectangle frame and the bounding rectangle of each layout window further includes: Dividing the layout container into grid sub-barrels by adopting a space partition index to locate windows which are adjacent to the