Page layout method and device, medium and computing equipment
By constraining page elements and surrounding box configuration, the problem of poor responsiveness of page elements generated by free layout is solved, and the responsiveness of parent-son relationships and brother relationships is improved.
Patent Information
- Application Number
- CN202410629611.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-11-12
AI Technical Summary
Free layout generated pages have the problem of poor response between elements, especially when the parent element size changes, the child elements cannot achieve horizontal, vertical, and other fixation.
After inserting elements on the page, the elements in the page are constrained to fix the distance and equal-scale scaling between elements in the parent-child relationship, and configure the corresponding bounding box for the elements in the page, so that the page is adjusted by free layout For linear layout, the distance and equal-scale scaling between elements are used to cure the box model.
It improves the responsiveness of elements in the page generated by free layout, so that elements of the father-son relationship and brother relationship can respond to each other, solving the problem of poor responsiveness between elements.
Smart Images

Figure CN118939247A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the technical field of page layout, and more specifically, embodiments of the present disclosure relate to a page layout method, apparatus, medium, and computing device. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the present disclosure. No description herein is admitted to be prior art by virtue of its inclusion in this section.
[0003] Page layout refers to the use of visual tools and a small amount of code to design and arrange the structure and elements of an application interface.
[0004] Page layouts include free layouts. Free layouts allow users to freely place and adjust elements in an intuitive way. With free layouts, users can create personalized and entrepreneurial page layouts more quickly.
[0005] However, elements based on free layout are positioned by coordinates. When the size of the parent element changes in free layout, the child element can only be fixed on top and cannot be fixed in other ways, and horizontal and vertical proportional scaling cannot be achieved; when the size or number of child elements increases, the parent element cannot change its own size to adapt to the child elements. From the above, it can be seen that the page generated by free layout has the problem of poor response between elements. Summary of the invention
[0006] The present disclosure provides a page layout method, apparatus, medium and computing device to solve the problem of poor response between elements in a page generated by a free layout.
[0007] In a first aspect of an embodiment of the present disclosure, a page layout method is provided, comprising: displaying a first page; in response to an element setting operation for the first page, inserting an element corresponding to the element setting operation into the first page to obtain a second page; performing constraint processing on the elements in the second page to obtain a third page, wherein the constraint processing is used to fix the distance and proportional scaling between elements in a parent-child relationship in the second page; and configuring a corresponding bounding box for each element in the third page to adjust the layout of the third page.
[0008] In an embodiment of the present disclosure, configuring a corresponding bounding box for each element in the third page includes:
[0009] In the third page, a first bounding box is configured for each element in the third page, and each of the elements is located in the first bounding box;
[0010] Projecting the first bounding box to obtain a shadow of the element in the first bounding box;
[0011] Determine, according to the size of the shadow, a first element from among the elements in the first bounding box, the size of the first element being smaller than the size of the shadow;
[0012] In response to the number of the first elements being at least one, configuring a second bounding box for each of the first elements, wherein each of the first elements is located within the second bounding box;
[0013] The second bounding box is updated to the first bounding box, and the step of projecting the first bounding box is returned to be executed.
[0014] In an embodiment of the present disclosure, the constraining the elements in the second page includes:
[0015] Obtaining constraint rules for elements in the second page;
[0016] Constraint processing is performed on the elements in the second page according to the constraint rules.
[0017] In an embodiment of the present disclosure, the step of obtaining the constraint rules of the elements in the second page includes:
[0018] Outputting a setting interface of the constraint rules corresponding to the second element;
[0019] In response to detecting a setting operation for a constraint rule in the setting interface, the constraint rule corresponding to the setting operation is acquired.
[0020] In one embodiment of the present disclosure, the setting interface includes a first area and a second area, the first area is used to display setting controls for constraint rules, and the second area is used to display constraint auxiliary lines, and the constraint auxiliary lines are used to represent the constraint rules set based on the setting controls.
[0021] In an embodiment of the present disclosure, the step of obtaining the constraint rules of the elements in the second page includes:
[0022] Obtaining the target area where the element in the second page is located;
[0023] The constraint rule associated with the target area is determined as the constraint rule of the element corresponding to the target area.
[0024] In an embodiment of the present disclosure, the step of obtaining the constraint rules of the elements in the second page includes:
[0025] In response to detecting an alignment operation acting on a second element in the second page, determining an alignment control corresponding to the alignment operation, the second element being any element in the second page;
[0026] The constraint rule associated with the alignment control is determined as the constraint rule of the second element.
[0027] In an embodiment of the present disclosure, the step of performing constraint processing on the elements in the second page according to the constraint rule includes:
[0028] Generate execution code corresponding to the constraint rule;
[0029] The execution code is run to perform constraint processing on the elements in the second page.
[0030] In one embodiment of the present disclosure, the method further includes:
[0031] In response to a zoom operation on a target page, determining a zoom ratio corresponding to the zoom operation, the zoom ratio including a zoom-in ratio or a zoom-out ratio, the target page being the second page, the third page or the fourth page, and the fourth page being the third page after a bounding box is configured;
[0032] The target page and the elements in the target page are displayed as a size corresponding to the zoom ratio, and the zoom ratio of the target page is the same as the zoom ratio of the elements in the target page.
[0033] In an embodiment of the present disclosure, after configuring a corresponding bounding box for each element in the third page, the method further includes:
[0034] In response to an element selection operation in a fourth page, the arrangement of each element corresponding to the element selection operation in the fourth page is set to the arrangement specified by the element selection operation, wherein the arrangement includes vertical arrangement or horizontal arrangement, and the fourth page is the third page after the bounding box is configured.
[0035] In a second aspect of the embodiments of the present disclosure, a page layout device is provided, comprising:
[0036] Get module, used to display the first page;
[0037] an inserting module, configured to respond to an element setting operation on the first page and insert an element corresponding to the element setting operation into the first page to obtain a second page;
[0038] A processing module, used for performing constraint processing on the elements in the second page to obtain a third page, wherein the constraint processing is used for fixing the distance and geometric scaling between the elements in the parent-child relationship in the second page;
[0039] The configuration module is used to configure a corresponding bounding box for each element in the third page to adjust the layout of the third page.
[0040] In a third aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method described above is implemented.
[0041] In a fourth aspect of the embodiments of the present disclosure, a computing device is provided, including:
[0042] at least one processor;
[0043] and a memory communicatively coupled to the at least one processor;
[0044] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the computing device to perform the method as described above.
[0045] According to the page layout method, apparatus, medium and computing device of the embodiments of the present disclosure, after inserting elements on the page, the elements in the page are constrained to fix the distance and geometric scaling between elements in the parent-child relationship, and then corresponding bounding boxes are configured for the elements in the page, so that the page is adjusted from a free layout to a linear layout. The linear layout page has a bounding box corresponding to the box model that solidifies the distance and geometric scaling between elements, thereby ensuring the responsiveness between the elements, thereby improving the responsiveness of the elements in the page generated by the free layout. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0047] Figure 1 A schematic diagram of an application scenario of a page layout method according to an embodiment of the present disclosure is schematically shown;
[0048] Figure 2 The flowchart according to an embodiment of the present disclosure is schematically shown;
[0049] Figure 3 The flowchart according to another embodiment of the present disclosure is schematically shown;
[0050] Figure 4 The following is a schematic diagram showing the process of setting the bounding box of an element in a page;
[0051] Figure 5Schematically shows a flow chart according to another embodiment of the present disclosure;
[0052] Figure 6 The flowchart according to another embodiment of the present disclosure is schematically shown;
[0053] Figure 7 A diagram schematically shows a setting interface of constraint rules;
[0054] Figure 8 Another setting interface diagram of constraint rules is schematically shown;
[0055] Fig. 9 Schematically shows a flow chart according to another embodiment of the present disclosure;
[0056] Fig.10 A schematic diagram schematically shows a program product provided according to an embodiment of the present disclosure;
[0057] Fig.11 The structure diagram of the page layout device provided according to the embodiment of the present disclosure is schematically shown;
[0058] Fig.12 The schematic diagram shows the structure of a computing device provided according to an embodiment of the present disclosure.
[0059] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0060] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0061] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0062] According to an embodiment of the present disclosure, a page layout method, apparatus, medium and computing device are proposed.
[0063] Furthermore, any number of elements in the drawings is for illustrative purposes only and not limiting, and any naming is for distinction only and does not have any limiting meaning.
[0064] In addition, the data involved in the present disclosure may be data authorized by the user or fully authorized by all parties, and the collection, dissemination, and use of the data shall comply with the requirements of relevant laws and regulations. The implementation methods / examples of the present disclosure may be combined with each other.
[0065] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure. SUMMARY OF THE INVENTION
[0067] Page layout refers to the use of visual tools and a small amount of code to design and arrange the structure and elements of an application interface.
[0068] Common ways of page layout include linear layout. Linear layout allows users to easily arrange and position interface elements through simple drag and drop operations. However, the elements of linear layout are arranged horizontally or vertically. When making complex, irregular or creative element layouts, the box model is needed. The box model treats the element as a bounding box, which affects the size, spacing and position of the element through the bounding box.
[0069] Users need to learn knowledge such as the box model to complete a good linear layout of elements. In order to reduce the user's learning cost, you can use the free layout method to generate pages. Free layout allows users to freely place and adjust elements in an intuitive way. Through the free layout method, users can create personalized and entrepreneurial page layouts more quickly.
[0070] The inventor of the present disclosure found that the elements based on the free layout are positioned by coordinates. When the size of the parent element in the free layout changes, the child element can only be fixed on top and cannot be fixed in other ways, and cannot achieve horizontal and vertical proportional scaling; and when the size or number of child elements increases, the parent element cannot change its own size to adapt to the child elements. From the above, it can be seen that the page generated by the free layout has the problem of poor response between elements.
[0071] The inventor of the present disclosure therefore came up with the idea of constraining the elements in the page to fix the distance and proportional scaling between elements in the parent-child relationship after inserting the elements on the page, and then configuring corresponding bounding boxes for the elements in the page, so that the page is adjusted from a free layout to a linear layout. The linear layout page has a bounding box corresponding to the box model that solidifies the distance and proportional scaling between the elements, thereby ensuring the responsiveness between the elements, thereby improving the responsiveness of the elements in the page generated by the free layout.
[0072] Application Scenario Overview
[0073] First reference Figure 1 , Figure 1Schematic diagram of application scenario of the page layout method of the embodiment of the present disclosure. The page layout device displays the first page 100, and the user can freely layout the elements in the first page 100 to obtain the second page 200, that is, the second page 200 has multiple elements inserted, and the elements are, for example, gray box images in the second page 200. The page layout device then performs constraint processing on the elements in the second page 200 to fix the distance between the elements in the parent-child relationship and the proportional scaling of the parent-child relationship to obtain the third page 300. The page layout device then configures corresponding bounding boxes for the elements in the third page 300, thereby converting the third page 300 into a linear layout page 400, and the bounding box is a dotted box in the page 400, and the dotted box is used to represent the bounding box. In fact, there are no dotted lines or solid lines in the bounding box.
[0074] Exemplary Methods
[0075] Combine the following Figure 1 For application scenarios, refer to Figure 2-Figure 9 To describe the page layout method according to an exemplary embodiment of the present disclosure. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this regard. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0076] Reference Figure 2 , Figure 2 The following is a flow chart showing an exemplary embodiment of a page layout method according to an embodiment of the present disclosure. The page layout method includes:
[0077] Step S201, displaying the first page.
[0078] In this embodiment, the execution subject is a page layout device. For ease of description, the page layout device is referred to as a device below. The device can be any terminal device with display and page layout functions, such as a mobile phone, a computer, a tablet, etc.
[0079] The device displays a first page, which may be a canvas displayed in the device, and the user may drag elements stored in the device to the canvas to set elements on the first page. The elements may be images or icons, and the icons may be icons representing functions within an application, for example.
[0080] Step S202 , in response to an element setting operation on the first page, insert an element corresponding to the element setting operation into the first page to obtain a second page.
[0081] The user inserts the element into the first page by dragging. When the device detects the drag operation on the first page, it is considered to have detected the element setting operation for the first page, and the device inserts the element dragged by the drag operation to the position where the drag operation last stopped on the first page. When the element that the user needs to insert is inserted into the first page, the second page can be obtained.
[0082] It should be noted that the elements in the second page have a parent-child relationship and a sibling relationship. Figure 3 , element B and element C are inserted into element A, then element A is the parent element of element B and element C, that is, element A and element B are in a parent-child relationship, and element A and element C are also in a parent-child relationship. That is, element A is the parent element of element B; and element B and element C are sibling elements, that is, element C and element B are in a sibling relationship.
[0083] Step S203, performing constraint processing on the elements in the second page to obtain a third page, wherein the constraint processing is used to fix the distance and geometric scaling between the elements in the parent-child relationship in the second page.
[0084] There are elements with preset relationships on the second page, and the preset relationships include at least one of a parent-child relationship and a sibling relationship, that is, there are parent elements and child elements, as well as sibling elements. The elements on the second page are inserted by the user by dragging, and the page layout mode of the second page is free layout. The elements with parent-child relationships on the second page of free layout have the problem of poor responsiveness, so it is necessary to improve the responsiveness of the elements with parent-child relationships on the second page.
[0085] In this regard, the device first performs constraint processing on the elements on the second page to obtain the third page. Constraint processing refers to fixing the distance and proportional scaling between the elements of the parent-child relationship in the second page. Distance fixing includes left fixing, right fixing, top fixing, bottom fixing, left and right fixing, horizontal center fixing, vertical center fixing, left and right fixing, and top and bottom fixing.
[0086] The constraints of Fixed Left, Fixed Right, Fixed Top, and Fixed Bottom have the following effects: no matter how the element size changes, the element will always maintain a fixed distance from the left, right, top, and bottom edges of the parent element.
[0087] The constraint effect of horizontal center fixation and vertical center fixation is that no matter how the size of the parent element changes, the child element will always maintain a fixed distance from the center of the parent element.
[0088] The constraint effects of left and right fixed and top and bottom fixed are: the left and right sides of the child element maintain a fixed distance from the left and right sides of the parent element, and the top and bottom sides of the child element maintain a fixed distance from the top and bottom sides of the parent element.
[0089] Proportional scaling includes horizontal proportional scaling and vertical proportional scaling. The constraint effect of horizontal proportional scaling and vertical proportional scaling is that the height of the child element will be proportionally scaled with the size of the parent element.
[0090] Specifically, to fix top, bottom, left, and right, you can set the sub-elements' style.left, style.right, style.top, and style.bottom. That is, when the device displays style.left, it will be fixed on the left; when the device displays style.right, it will be fixed on the right; when the device displays style.top, it will be fixed on the top; and when the device displays style.bottom, just fill in the corresponding values.
[0091] When vertical center fixation and horizontal center fixation are required, the style.left of the child element is set to: half the width of the parent element minus the offset, where the offset refers to the offset of the child element relative to the center of the parent element.
[0092] If horizontal proportional scaling is required, set the style.left of the child element to the ratio of the child element's offset from the left side of the parent element to the width of the parent element; and set the child element's width to the ratio of the child element's width to the width of the parent element.
[0093] If vertical proportional scaling is required, set the style.bottom of the child element to the ratio of the child element's offset from the bottom of the parent element to the parent element's height; and set the child element's height to the ratio of the child element's height to the parent element's height.
[0094] If horizontal and vertical center fixing is required, set the child element's style.left to half the width of the parent element minus the offset. The offset refers to the offset of the child element relative to the center of the parent element.
[0095] If left and right fixing is required, set the child element's style.left to the child element's offset relative to the left side of the parent element, and set the child element's style.right to the child element's offset relative to the right side of the parent element.
[0096] If you need to fix the top and bottom, set the child element's style.top to the child element's offset from the bottom of the parent element, and set the child element's style.bottom to the child element's offset from the bottom of the parent element.
[0097] Step S204: configuring a corresponding bounding box for each element in the third page to adjust the layout of the third page.
[0098] After completing the constraint processing of the elements in the second page, the third page is obtained. The elements in the third page are constrained, but the layout of the third page is still free layout, and there is a problem of poor responsiveness between parent and child elements. In addition, in the free layout page, when the size of child element A in the parent element changes, child element B located after child element A cannot change its position to maintain the order of child elements A and child elements B, that is, there is also a problem of poor responsiveness between elements with a sibling relationship.
[0099] In this regard, the device configures a corresponding bounding box for each element in the third page. The bounding box refers to the box corresponding to the box model. By enclosing the elements with the bounding box corresponding to the box model, the third page can be converted from a free layout to a linear layout. In the third page of the linear layout, since the bounding box encloses the elements, the parent element can respond to the child element, and the elements with a sibling relationship can also respond to each other, which improves the responsiveness between the elements with a parent-child relationship and a sibling relationship. It should be noted that the bounding box is a virtual box, and there is no solid line in the third page.
[0100] In this embodiment, after inserting elements on the page, the elements in the page are constrained to fix the distance and proportional scaling between elements in the parent-child relationship, and then corresponding bounding boxes are configured for the elements in the page, so that the page is adjusted from a free layout to a linear layout. The linear layout page has a bounding box corresponding to the box model that solidifies the distance and proportional scaling between elements, thereby ensuring the responsiveness between the elements, thereby improving the responsiveness of the elements in the page generated by the free layout.
[0101] Reference Figure 3 , Figure 3 A schematic diagram showing another embodiment of the page layout method according to an embodiment of the present disclosure is shown. Figure 2 In the illustrated embodiment, step S204 includes:
[0102] Step S301: In a third page, a first bounding box is configured for each element in the third page, and each element is located in the first bounding box.
[0103] In this embodiment, the device sets a corresponding bounding box for each element. For ease of understanding, the setting of the bounding box is explained in a projection manner.
[0104] Specifically, refer to Figure 4 The device first puts each element in the third page 410 into a bounding box, which is defined as a first bounding box, that is, a bounding box is set on the third page, and the page for setting the first bounding box specifically refers to the bounding box 421 in the page 420. Each element is, for example, element A, element B, element C, element D, and element E.
[0105] Step S302: Project the first bounding box to obtain the shadow of the element in the first bounding box.
[0106] Continue to refer to Figure 4 , each element in the first bounding box 421 in the page 420 is regarded as a three-dimensional object. The device projects the first bounding box 421 (projecting the first bounding box 421 with a flashlight), and a shadow 422 is obtained. The shadow 422 is the projection of an element in the first bounding box 421. For example, the shadow 422 is the shadow of element A.
[0107] Step S303 , determining a first element from among the elements in the first bounding box according to the size of the shadow, wherein the size of the first element is smaller than the size of the shadow.
[0108] Shadow 422 has a size, which is either height or width. Figure 4 , the projection method is from left to right, and the embodiment is that the flashlight shines toward the left side of the first bounding box 421. Therefore, if the projection method is from left to right, the size of the shadow 422 is the height. Of course, if the projection method is from right to left, the size of the shadow 422 is also the height. When the projection method is from top to bottom or from bottom to top, the size of the shadow 422 is the width.
[0109] The device determines the first element among the elements in the first bounding box based on the size of the shadow, and the size of the first element is smaller than the size of the shadow. Specifically, after the device obtains the size of the shadow 422, it obtains the element with the largest size of each element as the target element, and the shadow is the shadow of the target element. Figure 4 , element A has the largest height, so shadow 422 is the shadow of element A.
[0110] When performing projection, the largest element will cover the smaller elements, for example, element A covers elements B, C, D, and E. In this case, the device removes the target element and uses the remaining elements as the first element, that is, configures a bounding box for the remaining elements. For example, remove element A and keep elements B, C, D, and E as the first element.
[0111] Step S304 , in response to there being at least one first element, configuring a second bounding box for each first element, and each first element is located within the second bounding box.
[0112] The device determines the number of first elements. If the number of first elements is at least one, a corresponding bounding box needs to be configured for each first element. The bounding box is defined as a second bounding box, and each first element is located in the second bounding box. Figure 4 , remove element A to obtain page 430, and then configure a second bounding box 431 for elements B, C, D and E.
[0113] Step S305: update the second bounding box to the first bounding box, and return to the step of projecting the first bounding box.
[0114] The device updates the second bounding box to the first bounding box, and then returns to perform the step of projecting the first bounding box.
[0115] Continue to refer to Figure 4 , the device projects the second bounding box 431 on page 430 to obtain a mirror 432, and there are two shadows 432, one is the shadow of element B, and the other is the shadow of element C. Therefore, element B and element C are the target shadows of this round. Elements B and element C are removed to obtain page 440, and the remaining elements D and element E are the new first elements. The device configures a third bounding box 441 for elements D and element E on page 440, and projects the third bounding box 441. The shadow 442 obtained is the shadow of element D and element E, so there will be no remaining elements. Therefore, bounding boxes 443 are configured for elements D and element E respectively. At this point, the configuration of bounding boxes for elements A, B, C, D, and E is completed. For the page after the bounding boxes of elements A, B, C, D, and E are configured, please refer to page 450.
[0116] It can be understood that the device first puts all the elements into a bounding box, projects the bounding box to obtain a shadow, removes the elements with the same size as the shadow, and then puts the elements in the shadow into a new bounding box; repeats the steps of projecting, removing elements, and placing the elements in the shadow into a new bounding box until the final configured bounding box has only one element, at which point the configuration of the bounding boxes for all elements is completed.
[0117] It should be noted that the bounding box does not have a solid line. Figure 4 The solid lines representing the bounding boxes in are just for the convenience of describing the scheme.
[0118] In this embodiment, the device configures a corresponding bounding box for each element by projection, so that a page with a free layout is converted into a page with a linear layout, thereby improving the responsiveness between elements in the page.
[0119] Reference Figure 5 , Figure 5 A schematic diagram of a flow chart of another embodiment of a page layout method according to an embodiment of the present disclosure is exemplarily shown. Figure 2 or Figure 3 In the illustrated embodiment, step 203 includes:
[0120] Step S501: Obtain constraint rules for elements in the second page.
[0121] In this embodiment, the device is provided with constraint rules for elements in a freely laid out page, and the elements in the second page can be constrained by the constraint rules. For this, the device pre-stores preset rules.
[0122] Step S502: performing constraint processing on the elements in the second page according to the constraint rules.
[0123] After obtaining the constraint rules, the device performs constraint processing on the elements in the second page according to the constraint rules.
[0124] Exemplarily, the constraint rule can be a specific value of the preset distance and geometric scaling between the parent and child elements, and can be the geometric scaling between the parent and child elements. The preset distance is the fixed distance mentioned above, and the preset geometric scaling is the fixed geometric scaling mentioned above. With reference to the above description, no further description will be given here.
[0125] In this regard, the device sets the distance between the elements of the parent-child relationship in the second page to a preset distance, and sets the geometric scaling of the elements of the parent-child relationship in the second page to a preset geometric scaling, thereby completing the constraint processing of the elements in the second page.
[0126] In this embodiment, the device can quickly complete the constraint processing of the elements in the second page through the constraint rules, thereby improving the layout efficiency of the page.
[0127] Reference Figure 6 , Figure 6 A schematic diagram of a flow chart of another embodiment of a page layout method according to an embodiment of the present disclosure is shown exemplarily. Figure 5 In the embodiment shown in , step S501 includes:
[0128] Step S601: outputting a setting interface of a constraint rule corresponding to the second element.
[0129] In this embodiment, the constraint rules can be set by the user. Specifically, the device sets a setting control of the associated constraint rules for the second element on the second page, and when the device detects a selection operation on the second page, the setting control pops up, and when the device detects a click operation on the setting control, the setting interface of the preset rule corresponding to the second element is output.
[0130] Step S602: in response to detecting a setting operation for a constraint rule in a setting interface, obtaining a constraint rule corresponding to the setting operation.
[0131] After the setting interface is output, the user can set the constraint rules on the setting interface. When the device detects the setting operation of the constraint rules in the setting interface, it obtains the constraint rules corresponding to the setting operation.
[0132] For example, refer to Figure 7 , the constraint rules can be set on the setting interface 700. The setting interface 700 displays the fixed left and fixed top, but other fixed can also be selected on the setting interface. For example, in the setting interface 700, the fixed top is changed to the fixed right. In addition, fixed values can also be set on the setting interface 700. For example, the fixed left is set to 234px, and the fixed top is set to 9px. px is a relative length unit, representing pixels, that is, the distance between the left side of the child element and the parent element is 234 pixels. In addition, the setting interface can also set controls for batch operations. Through batch operations, constraint rules can be set for multiple elements in batches to improve page layout efficiency.
[0133] Furthermore, component alignment is also provided in the setting interface 700, and the component alignment includes alignment controls for left alignment, center alignment on the x-axis, right alignment, center alignment on the y-axis, top alignment, and bottom alignment, and the alignment controls are six icons in the alignment area 710. Left alignment is used to indicate left fixation, center alignment on the x-axis is used for x-axis center fixation, right alignment is used for right fixation, top alignment is used for top fixation, center alignment on the y-axis is used for y-axis center fixation, and bottom alignment is used for bottom fixation. It can be understood that constraint rules can also be obtained by means of component alignment. Specifically, when the device detects an alignment operation acting on the second element in the second page, it determines the alignment control corresponding to the alignment operation, and determines the constraint rules associated with the alignment control as the constraint rules of the second element. The alignment operation refers to a click operation on the alignment control.
[0134] Furthermore, the setting interface includes a first area and a second area, the first area is used to display setting controls for constraint rules, and the second area is used to display constraint auxiliary lines, and the constraint auxiliary lines are used to represent constraint rules set based on the setting controls.
[0135] Specifically, refer to Figure 8 The setting interface 800 includes a first area 810, and the first area 810 is provided with setting controls. The controls and information displayed in the first area 810 are Figure 7The information displayed in the setting interface 800 will not be repeated here. The setting interface 800 also includes a second area 820, and the second area 820 displays constraint auxiliary lines, which are dotted lines in the second area. The second area 820 also displays elements, such as "OK" and "Button". When the "OK" element is selected, and a constraint auxiliary line is displayed as fixed at 96px on the top, and a constraint auxiliary line is displayed as fixed at 234px on the left, and the state of "OK" being selected will display a toolbar, and the toolbar will display "+" and "Delete" icons, and will display a "More" icon, such as a triangle in the toolbar. "+" is used to increase and decrease the value of the top or left fix, and "Delete" is used to delete the top fixed and left fixed values that have been set in the first area 810. If the top fixed and left fixed values that have been set in the first area 810 are deleted, the auxiliary lines in the second area 820 will also be deleted, and the elements will also change position. It should be noted that when the value in the first area changes, the constraint auxiliary line in the second area 8 will change, and the value on the constraint auxiliary line will also change accordingly.
[0136] In this embodiment, the device displays a setting interface to provide the user with the setting of constraint rules, thereby improving the user experience. Furthermore, through constraint auxiliary lines, the user can perceive the current constraint rules in a more intuitive way.
[0137] In one embodiment, after obtaining the constraint rules, the device performs constraint processing on the elements in the second page by means of code. Specifically, after obtaining the constraint rules, an execution code corresponding to the constraint rules is generated, and the execution code is run to perform constraint processing on the elements in the second page, that is, the execution code corresponding to the constraint rules is run to perform constraint processing on the elements corresponding to the constraint rules. It should be noted that the execution code can be generated in advance, and the generated execution code is associated with the constraint rules and stored. After determining the target constraint rules corresponding to the elements, the device runs the execution code associated with the target constraint rules to perform constraint processing on the elements corresponding to the target constraint conditions, thereby quickly performing constraint operations on the elements and improving the layout efficiency of the page.
[0138] Reference Fig. 9 , Fig. 9 The schematic diagram of the process of another embodiment of the page layout method provided by the embodiment of the present disclosure is exemplarily shown. Figure 5 In the illustrated embodiment, step S501 includes:
[0139] Step S901, obtaining an element in a second page and a target area where the element is located in the second page.
[0140] In this embodiment, the device is provided with intelligent constraint judgment capability, and constraint rules are automatically set by the area where the user drags the element.
[0141] Specifically, the page is set to multiple regions, each region is associated with a constraint rule. In this regard, the device obtains the region where the element in the second page is located in the second page, and the region is defined as the target region.
[0142] Step S902: determine the constraint rules associated with the target area as the constraint rules of the elements corresponding to the target area.
[0143] The target area is associated with a constraint rule, and the device determines the constraint rule associated with the target area as the constraint rule of the element corresponding to the target area.
[0144] For example, the page is divided into the upper left region A, the upper right region B, the lower left region C, and the lower right region D. The constraints associated with region A are fixed to the left and fixed to the top, the constraints associated with region B are fixed to the right and fixed to the top, the constraints associated with region C are fixed to the left and fixed to the bottom, and the constraints associated with region D are fixed to the right and fixed to the bottom. If the element is in region A, the constraints are fixed to the left and fixed to the top.
[0145] Furthermore, when an element is in a specific position, a specific method of fixing will be triggered, such as horizontal center fixing and vertical center fixing.
[0146] Specifically, when the distance between the position of the element and the position of the horizontal center point in the second page is less than the first preset distance, it can be determined that the element is located near the horizontal center point, and the constraint rule of the element is horizontally centered and fixed, and the element is vertically on the top or bottom, and the horizontal center point is located on the second page, then the constraint rule also includes being fixed on the top, and the horizontal center point is located on the second page, then the constraint rule also includes being fixed on the bottom; when the distance between the position of the element and the position of the vertical center point in the second page is less than the second preset distance, it can be determined that the element is located near the vertical center point, and the constraint rule of the element is vertically centered and fixed, and the element is horizontally on the left or right, and the vertical center point is located on the left on the second page, then the constraint rule also includes being fixed on the left, and the vertical center point is located on the right on the second page, then the constraint rule also includes being fixed on the right.
[0147] In this embodiment, by setting associated constraint rules in various areas of the page, constraint rules can be quickly set according to the area where the element is located, which lowers the threshold for users to set constraint rules and improves user experience.
[0148] In one embodiment, the scaling ratio of the page is set for the proportional relationship between the size of the canvas and the size of the terminal device. The terminal device is, for example, an application, and the application is, for example, a browsing application. The size of the terminal device refers to the size of the display interface of the application.
[0149] In this regard, when the device detects a zoom operation on the target page, it determines the zoom ratio corresponding to the zoom operation, the zoom ratio includes a zoom-in ratio or a zoom-out ratio, and the target page is the first page, the second page, the third page or the fourth page, and the fourth page is the third page after the bounding box is configured. The zoom operation is, for example, a click operation on a setting control for the canvas size, and the setting control includes two options, off and on. If a click operation based on the on option is detected, the zoom ratio is obtained, and the zoom ratio is the proportional relationship between the size of the canvas and the size of the terminal device.
[0150] The device displays the target page and the elements in the target page in a size corresponding to the zoom ratio, and the zoom ratio in the target page is the same as the zoom ratio of the elements in the target page.
[0151] In this embodiment, the device sets the ratio between the elements in the page and the page to the zoom ratio corresponding to the zoom operation based on the zoom operation. When the page size changes, the relative position relationship between the elements in the page and the page is maintained, thereby facilitating the adjustment of the layout of the page.
[0152] In one embodiment, the layout of the fourth page is a page adjusted from a free layout to a linear layout. After the conversion from the free layout to the linear layout, the arrangement of all elements in the fourth page is the same, for example, the arrangement of all elements is vertical arrangement or horizontal arrangement. In this regard, the device provides a function of changing the arrangement of some elements, that is, some elements can be arranged horizontally and some elements can be arranged vertically.
[0153] In this regard, the user can select elements on the fourth page, and before making the selection, the user selects the arrangement method, that is, the device detects the element selection operation for the fourth page, and the device sets the arrangement method of each element corresponding to the element selection operation on the fourth page to the arrangement method specified by the element selection operation. For example, the element selection operation specifies vertical arrangement, and each selected element is changed from horizontal arrangement to vertical arrangement. Of course, if the arrangement method referred to by the element selection operation is the same as the arrangement method of each selected element, the device outputs a prompt message to indicate that the operation is invalid. It should be noted that the device will embed a bounding box for each selected element, and the bounding box is close to the outermost layer of each component to facilitate the change of the arrangement method of each selected element.
[0154] In this embodiment, the device provides a function of changing the arrangement of some elements, so that the user can change the arrangement of elements on the linear layout to a desired arrangement, thereby improving the user experience.
[0155] Exemplary Media
[0156] After introducing the method of the exemplary embodiment of the present disclosure, next, refer to Fig.10 A storage medium according to an exemplary embodiment of the present disclosure is described.
[0157] refer to Fig.10 As shown, the storage medium 100 stores a program product for implementing the above method according to an embodiment of the present disclosure, which may adopt a portable compact disk read-only memory (CD-ROM) and include computer execution instructions, which are used to enable a computing device to execute the page layout method provided by the present disclosure. However, the program product of the present disclosure is not limited thereto.
[0158] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium, and the readable storage medium may be a computer-readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0159] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-executable instructions. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium.
[0160] Computer-executable instructions for performing the disclosed operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The computer-executable instructions may be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0161] Exemplary Devices
[0162] After introducing the medium of the exemplary embodiment of the present disclosure, next, reference is made to Fig.11 A page layout device according to an exemplary embodiment is disclosed for illustration, and the page layout device is used to implement a method in any of the above-mentioned page layout method embodiments, and its implementation principle and technical effect are similar.
[0163] refer to Fig.11 , Fig.11 The structural diagram of the page layout device provided according to the embodiment of the present disclosure is schematically shown.
[0164] like Fig.11 As shown, the page layout device includes: an acquisition module 1110, used to display a first page; an insertion module 1120, used to respond to an element setting operation for the first page, and insert the element corresponding to the element setting operation into the first page to obtain a second page; a processing module 1130, used to perform constraint processing on the elements in the second page to obtain a third page, and the constraint processing is used to fix the distance and proportional scaling between the elements of the parent-child relationship in the second page; a configuration module 1140, used to configure corresponding bounding boxes for each element in the third page to adjust the layout of the third page.
[0165] In one embodiment, the page layout device is specifically used for:
[0166] On the third page, a first bounding box is configured for each element in the third page, and each element is located in the first bounding box;
[0167] Project the first bounding box to obtain the shadow of the element in the first bounding box;
[0168] According to the size of the shadow, determine a first element from among the elements in the first bounding box, where the size of the first element is smaller than the size of the shadow;
[0169] In response to the number of the first elements being at least one, configuring a second bounding box for each first element, wherein each first element is located within the second bounding box;
[0170] The second bounding box is updated to the first bounding box, and the step of projecting the first bounding box is returned to be executed.
[0171] In one embodiment, the page layout device is specifically used for:
[0172] Get the constraint rules of the elements in the second page;
[0173] Constraint processing is performed on the elements in the second page according to the constraint rules.
[0174] In one embodiment, the page layout device is specifically used for:
[0175] Output the setting interface of the constraint rules corresponding to the second element;
[0176] In response to detecting a setting operation for a constraint rule in a setting interface, the constraint rule corresponding to the setting operation is acquired.
[0177] In one embodiment, the setting interface includes a first area and a second area, the first area is used to display setting controls for constraint rules, and the second area is used to display constraint auxiliary lines, and the constraint auxiliary lines are used to represent constraint rules set based on the setting controls.
[0178] In one embodiment, the page layout device is specifically used for:
[0179] Get the element in the second page and the target area where it is located in the second page;
[0180] The constraint rules associated with the target area are determined as the constraint rules of the elements corresponding to the target area.
[0181] In one embodiment, the page layout device is specifically used for:
[0182] In response to detecting an alignment operation on a second element in a second page, determining an alignment control corresponding to the alignment operation, where the second element is any element in the second page;
[0183] The constraint rules associated with the alignment control are determined as the constraint rules of the second element.
[0184] In one embodiment, the page layout device is specifically used for:
[0185] Generate execution code corresponding to constraint rules;
[0186] Run the execution code to perform constraint processing on the elements in the second page.
[0187] In one embodiment, the page layout device is specifically used for:
[0188] In response to a zoom operation on a target page, determining a zoom ratio corresponding to the zoom operation, the zoom ratio including a zoom-in ratio or a zoom-out ratio, the target page being the second page, the third page or the fourth page, the fourth page being the third page after the bounding box is configured;
[0189] The target page and the elements in the target page are displayed as sizes corresponding to the zoom ratio, and the zoom ratio of the target page is the same as the zoom ratio of the elements in the target page.
[0190] In one embodiment, the page layout device is specifically used for:
[0191] In response to the element selection operation in the fourth page, the arrangement of each element corresponding to the element selection operation in the fourth page is set to the arrangement specified by the element selection operation, and the arrangement includes vertical arrangement or horizontal arrangement. The fourth page is the third page after the bounding box is configured.
[0192] Exemplary Computing Devices
[0193] After introducing the method, medium and apparatus of the exemplary embodiments of the present disclosure, next, reference is made to Fig.12 A computing device according to an exemplary embodiment of the present disclosure is described.
[0194] Fig.12 The computing device 120 shown is only an example and should not limit the functionality and scope of use of the embodiments of the present disclosure. Fig.12 As shown, the computing device 120 is in the form of a general computing device. The components of the computing device 120 may include, but are not limited to: at least one processing unit (processor) 1201, at least one storage unit (processor) 1202, and a bus 1203 connecting different system components (including the processing unit 1201 and the storage unit 1202). Among them, at least one storage unit 1202 stores computer-executable instructions; at least one processing unit 1201 includes a processor, and the processor executes the computer-executable instructions to implement the method described above.
[0195] The bus 1203 includes a data bus, a control bus, and an address bus.
[0196] The storage unit 1202 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 12021 and / or a cache memory 12022 , and may further include a readable medium in the form of a non-volatile memory, such as a read-only memory (ROM) 12023 .
[0197] The storage unit 1202 may also include a program / utility 12025 having a set (at least one) of program modules 12024, such program modules 12024 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0198] The computing device 120 may also communicate with one or more external devices 1204 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 1205. In addition, the computing device 120 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1206. Fig.12 As shown, the network adapter 1206 communicates with other modules of the computing device 120 via the bus 1203. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the computing device 120, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0199] It should be noted that although several units / modules or sub-units / modules of the terminal device / server are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules for embodiment.
[0200] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0201] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A page layout method, characterized in that: include: Display the first page; In response to an element setting operation for the first page, inserting an element corresponding to the element setting operation into the first page to obtain a second page; Performing constraint processing on the elements in the second page to obtain a third page, wherein the constraint processing is used to fix the distance and geometric scaling between the elements in the parent-child relationship in the second page; For each element in the third page, a corresponding bounding box is configured to adjust the layout of the third page.
2. The page layout method according to claim 1, characterized in that: The configuring a corresponding bounding box for each element in the third page includes: In the third page, a first bounding box is configured for each element in the third page, and each of the elements is located in the first bounding box; Projecting the first bounding box to obtain a shadow of the element in the first bounding box; Determine, according to the size of the shadow, a first element from among the elements in the first bounding box, the size of the first element being smaller than the size of the shadow; In response to the number of the first elements being at least one, configuring a second bounding box for each of the first elements, wherein each of the first elements is located within the second bounding box; The second bounding box is updated to the first bounding box, and the step of projecting the first bounding box is returned to be executed.
3. The page layout method according to claim 1, characterized in that: The constraining the elements in the second page includes: Obtaining constraint rules for elements in the second page; Constraint processing is performed on the elements in the second page according to the constraint rules.
4. The page layout method according to claim 3, characterized in that: The obtaining of constraint rules for elements in the second page includes: Outputting a setting interface of the constraint rules corresponding to the second element; In response to detecting a setting operation for a constraint rule in the setting interface, the constraint rule corresponding to the setting operation is acquired.
5. The page layout method according to claim 4, characterized in that: The setting interface includes a first area and a second area, the first area is used to display setting controls for constraint rules, and the second area is used to display constraint auxiliary lines, and the constraint auxiliary lines are used to represent the constraint rules set based on the setting controls.
6. The page layout method according to claim 3, characterized in that: The obtaining of constraint rules for elements in the second page includes: Obtaining the target area where the element in the second page is located; The constraint rule associated with the target area is determined as the constraint rule of the element corresponding to the target area.
7. The page layout method according to claim 3, characterized in that: The obtaining of constraint rules for elements in the second page includes: In response to detecting an alignment operation acting on a second element in the second page, determining an alignment control corresponding to the alignment operation, the second element being any element in the second page; The constraint rule associated with the alignment control is determined as the constraint rule of the second element.
8. A page layout device, characterized in that: include: Get module, used to display the first page; an inserting module, configured to respond to an element setting operation on the first page and insert an element corresponding to the element setting operation into the first page to obtain a second page; A processing module, used for performing constraint processing on the elements in the second page to obtain a third page, wherein the constraint processing is used for fixing the distance and geometric scaling between the elements in the parent-child relationship in the second page; The configuration module is used to configure a corresponding bounding box for each element in the third page to adjust the layout of the third page.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 7 is implemented.
10. A computing device, characterized in that include: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the computing device to perform the method as claimed in any one of claims 1 to 7.
