Browser size adjusting method and device, storage medium and computer equipment
1. A method for adjusting the size of a browser is characterized by comprising the following steps:
receiving a resolution adjustment instruction, and acquiring an adjusted target resolution;
when the target resolution is in a preset resolution interval, adjusting the window size of the browser according to the specified size;
when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser;
and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size.
2. The method according to claim 1, wherein the step of determining the browser resizing information when the target resolution is not in a preset resolution interval comprises:
comparing the target resolution with the minimum resolution of the preset resolution interval to obtain a comparison result;
based on the comparison result, resizing information of the browser is determined.
3. The method according to claim 2, wherein the step of determining the browser resizing information based on the comparison result comprises:
if the comparison result is that the target resolution is smaller than the minimum resolution, acquiring the maximum resolution of the preset resolution interval;
calculating a difference value between the minimum resolution and the target resolution to obtain a first result;
calculating the difference value between the maximum resolution and the minimum resolution to obtain a second result;
calculating the ratio of the first result to the second result to obtain a reduction ratio value;
and determining size adjustment information according to the reduction ratio value and the specified size.
4. The method of claim 3, wherein the resizing information comprises a resizing length and a resizing width, wherein the original browser size comprises an original browser length and an original browser width, and wherein the determining the first resized size of the browser based on the original browser size of the browser and the resizing information comprises:
calculating the difference value between the original browser length and the adjusted length to obtain the reduced length;
calculating the difference value between the original browser width and the adjusted width to obtain the reduced width;
and determining the reduced length and the reduced length as a first adjusted size of the browser.
5. The method according to claim 2, wherein the step of determining the browser resizing information based on the comparison result comprises:
if the comparison result is that the target resolution is greater than the minimum resolution, acquiring the maximum resolution of the preset resolution interval;
calculating the difference value between the target resolution and the maximum resolution to obtain a third result;
calculating a difference value between the maximum resolution and the minimum resolution to obtain a fourth result;
calculating the ratio of the third result to the fourth result to obtain an amplification ratio value;
and determining size adjustment information according to the amplification scale value and the specified size.
6. The method of claim 5, wherein the resizing information comprises a resizing length and a resizing width, wherein the original browser size comprises an original browser length and an original browser width, and wherein the determining the first resized size of the browser based on the original browser size of the browser and the resizing information comprises:
calculating the sum of the original browser length and the adjusted length to obtain an amplified length;
calculating the sum of the original browser width and the adjusted width to obtain the amplified length;
and determining the amplified length and the amplified length as a first adjusted size of the browser.
7. The method according to claim 1, wherein the browser further includes a drag area, the drag area is configured to move the browser in response to a drag operation on the drag area, and after the step of determining the first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, the method further includes:
acquiring the original dragging size of the dragging area;
determining the adjustment proportion of the browser size according to the original browser size and the first adjusted size;
and determining a second adjusted size of the dragging area according to the original dragging size and the adjustment proportion.
8. The method according to claim 6, wherein the step of obtaining the original drag size of the drag area comprises:
acquiring the data type of the original dragging size of the dragging area;
and if the data type is the first type, converting the data type of the original dragging size into the second type.
9. A browser resizing device, comprising:
the receiving module is used for receiving a resolution adjustment instruction and acquiring the adjusted target resolution;
the adjusting module is used for adjusting the size of the browser according to the specified size when the target resolution is in a preset resolution interval;
the first determining module is used for determining the size adjusting information of the browser when the target resolution is not in a preset resolution interval;
and the second determining module is used for determining the first adjusted size of the browser based on the original browser size of the browser and the size adjusting information, and displaying the browser according to the first adjusted size.
10. A computer-readable storage medium storing instructions adapted to be loaded by a processor to perform the steps of the method for resizing a browser as claimed in any one of claims 1 to 8.
11. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program performs the steps in the method for resizing a browser as claimed in any one of claims 1 to 8.
Background
In recent years, with the development of science and technology and the increasing of living standard, electronic technology products come out endlessly. The browser products are more constantly updated.
In the prior art, when a user changes the screen resolution, if the changed screen resolution is too large or too small, and if the display size of the browser is not changed, the browser in the too large screen resolution is very small; whereas in a too small screen resolution the browser appears large.
In the process of research and practice of the prior art, the inventor of the present application finds that, in the prior art, when the resolution of the display is too high or too low, the display size of the browser cannot adapt to the resolution, and the compatibility is poor.
Disclosure of Invention
The embodiment of the application provides a method and a device for adjusting the size of a browser, which can improve compatibility.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
a method for resizing a browser, comprising:
receiving a resolution adjustment instruction, and acquiring an adjusted target resolution;
when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size;
when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser;
and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size.
A browser sizing apparatus comprising:
the receiving module is used for receiving a resolution adjustment instruction and acquiring the adjusted target resolution;
the adjusting module is used for adjusting the size of the browser according to the specified size when the target resolution is in a preset resolution interval;
the first determining module is used for determining the size adjusting information of the browser when the target resolution is not in a preset resolution interval;
and the second determining module is used for determining the first adjusted size of the browser based on the original browser size of the browser and the size adjusting information, and displaying the browser according to the first adjusted size.
In some embodiments, the first determining module comprises:
the comparison submodule is used for comparing the target resolution with the minimum resolution of the preset resolution interval to obtain a comparison result;
a first determining sub-module, configured to determine, based on the comparison result, resizing information of the browser.
In some embodiments, the first determining sub-module includes:
a first obtaining unit, configured to obtain a maximum resolution of the preset resolution interval if the comparison result indicates that the target resolution is smaller than the minimum resolution;
the first calculation unit is used for calculating the difference value between the minimum resolution and the target resolution to obtain a first result;
the second calculation unit is used for calculating the difference value between the maximum resolution and the minimum resolution to obtain a second result;
the third calculating unit is used for calculating the ratio of the first result to the second result to obtain a reduced proportion value;
a first determining unit configured to determine size adjustment information according to the reduction ratio value and the designated size.
In some embodiments, the resizing information comprises a resize length and a resize width, the original browser size comprises an original browser length and an original browser width, the second determining module comprises:
the first calculation submodule is used for calculating the difference value between the original browser length and the adjusted length to obtain the reduced length;
the second calculation submodule is used for calculating the difference value between the original browser width and the adjusted width to obtain the reduced width;
and the second determining submodule is used for determining the reduced length and the reduced length as the first adjusted size of the browser.
In some embodiments, the first determining sub-module includes:
a second obtaining unit, configured to obtain a maximum resolution of the preset resolution interval if the comparison result indicates that the target resolution is greater than the minimum resolution;
a fourth calculating unit, configured to calculate a difference between the target resolution and the maximum resolution to obtain a third result;
a fifth calculating unit, configured to calculate a difference between the maximum resolution and the minimum resolution to obtain a fourth result;
a sixth calculating unit, configured to calculate a ratio of the third result to the fourth result, so as to obtain an amplification ratio value;
and the second determining unit is used for determining the size adjusting information according to the amplification scale value and the specified size.
In some embodiments, the resizing information comprises a resize length and a resize width, the original browser size comprises an original browser length and an original browser width, the second determining module comprises:
the third calculation submodule is used for calculating the sum of the original browser length and the adjusted length to obtain the amplified length;
the fourth calculation submodule is used for calculating the sum of the original browser width and the adjusted width to obtain the amplified length;
and the third determining submodule is used for determining the amplified length and the amplified length as the first adjusted size of the browser.
In some embodiments, the browser further includes a drag area, where the drag area is configured to respond to a drag operation on the drag area to move the browser, and the apparatus further includes:
the acquisition module is used for acquiring the original dragging size of the dragging area;
a third determining module, configured to determine an adjustment ratio of the browser size according to the original browser size and the first adjusted size;
and the fourth determining module is used for determining a second adjusted size of the dragging area according to the original dragging size and the adjustment proportion.
In some embodiments, the obtaining module includes:
the obtaining submodule is used for obtaining the data type of the original dragging size of the dragging area;
and the conversion sub-module is used for converting the data type of the original dragging size into a second type if the data type is the first type.
A computer readable storage medium, wherein a plurality of instructions are stored in the computer readable storage medium, and the instructions are suitable for being loaded by a processor to execute the steps in the browser resizing method.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps in the method for resizing a browser as described above when executing the program.
The method comprises the steps of obtaining an adjusted target resolution by receiving a resolution adjustment instruction; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size. Therefore, the size adjustment information of the browser is determined through the resolution before and after adjustment, and the first adjusted size to be displayed by the browser after the resolution is changed is determined according to the original size of the browser and the size adjustment information, so that the display size of the browser can be adaptively adjusted along with the screen resolution exceeding the preset resolution interval, and the compatibility is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a scene schematic diagram of a method for adjusting a size of a browser according to an embodiment of the present application.
Fig. 1b is a flowchart illustrating a method for resizing a browser according to an embodiment of the present application.
Fig. 1c is a schematic view of a presentation page of a browser according to an embodiment of the present application.
FIG. 1d is a schematic diagram of the browser displaying a page after adjustment and amplification of the resolution according to the embodiment of the present application
Fig. 2 is another schematic flow chart of a method for resizing a browser according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a size adjustment apparatus for a browser according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a browser size adjusting method and device and a computer readable storage medium.
Referring to fig. 1a, fig. 1a is a schematic diagram of a system for resizing a browser according to an embodiment of the present application, which may include at least one computer device 1000, at least one server 2000, at least one database 3000, and a network 4000. The computer device 1000 may be a mobile phone, a computer, a personal digital assistant, or other computer devices, and the computer device 1000 may be connected to the server 2000 or multiple servers 2000 through the network 4000. The network 4000 may be a wireless network or a wired network, for example, the wireless network is a Wireless Local Area Network (WLAN), a Local Area Network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, or the like. In addition, different computer devices 1000 may be connected to the server 2000 or the like using their own bluetooth network or hotspot network. In addition, the system may include a database 3000, and the database 3000 may be used to store bookmarks stored by the user during the historical time of using the browser, and accounts and passwords that the user has registered or logged in to in different websites.
The embodiment of the application provides a browser size adjusting method which can be executed by a server. As shown in FIG. 1a, the server 2000 provides browser-related content to the computer device 1000; the computer device 1000 presents the browser on a screen; receiving a resolution adjustment instruction, and acquiring an adjusted target resolution; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size.
It should be noted that the scene diagram of the browser resizing system shown in fig. 1a is merely an example, and the browser resizing system and the scene described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not constitute a limitation to the technical solution provided in the embodiment of the present application, and as can be known by those skilled in the art, along with the evolution of the browser resizing system and the appearance of a new service scene, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
In the present embodiment, the browser resizing device will be described in terms of being specifically integrated in a computer device having a storage unit and a microprocessor mounted thereon and having computing capabilities.
Referring to fig. 1b, fig. 1b is a schematic flowchart illustrating a method for adjusting a size of a browser according to an embodiment of the present disclosure. The method for adjusting the size of the browser comprises the following steps:
in step 101, a resolution adjustment instruction is received, and an adjusted target resolution is acquired.
The resolution adjustment instruction is used for adjusting the screen resolution when the screen is displayed, and the resolution adjustment instruction can be selection operation aiming at a plurality of resolutions in the resolution adjustment interface. For example, the resolutions in the resolution adjustment interface are 1920 × 1080, 1600 × 900, and 800 × 600, respectively, and when the user selects 800 × 600, a resolution adjustment instruction is generated.
Specifically, the resolution adjustment interface may be set to be turned on by a Graphics Processing Unit (GPU) in the operation interface, or may be turned on by a resolution setting page provided in the system itself.
After receiving the resolution adjustment instruction, the target resolution adjusted by the user needs to be acquired. The corresponding resolution may be determined as the target resolution by determining an operation position of the user at the time of the resolution selection operation, such as a click position or a touch position, and determining which resolution of the plurality of resolution-corresponding response regions the operation position is within. The acquisition method is not limited here.
In step 102, when the target resolution is in the preset resolution interval, the size of the browser is adjusted according to the specified size.
The preset resolution interval is a resolution interval formed by a minimum resolution to a maximum resolution which are commonly used by the computer equipment in the market. For example, the minimum resolution is 800 × 600, the maximum resolution is 1920 × 1080, and the resolutions between 800 × 600 and 1920 × 1080 include 1024 × 768 and 1600 × 900, etc. Therefore, if the adjusted target resolution is 1600 × 900, the target resolution is within a resolution interval of 800 × 600 to 1920 × 1080. The size of the browser is set to the specified size.
Specifically, the specified size is a browser size applicable to different resolutions within a preset resolution range. The specified size suitable for different resolutions within a preset resolution interval is finally determined by dividing the default size of the browser.
For example, the default size of the browser is 414 × 300, the length and width are divided by 2 to obtain a first candidate size of 207 × 150, the length and width are divided by 3 to obtain a second candidate size of 138 × 100, and the length and width are divided by 4 to obtain a third candidate size of 103.5 × 75. And finally, the third candidate size with better display effect is taken as the designated size through the browser for displaying the first candidate size, the second candidate size and the third candidate size at multiple resolutions under the preset resolution.
In step 103, when the target resolution is not in the preset resolution interval, the size adjustment information of the browser is determined.
When the target resolution is not in the preset resolution interval, it is indicated that the target resolution is smaller or larger, and therefore the size of the browser needs to be adjusted, and therefore the browser displayed at the target resolution is not larger or smaller, and therefore the size adjustment information of the browser needs to be determined.
In some embodiments, the determining the size adjustment information of the browser when the target resolution is not in the preset resolution interval includes:
(1) comparing the target resolution with the minimum resolution of the preset resolution interval to obtain a comparison result;
(2) based on the comparison result, resizing information of the browser is determined.
The target resolution is not in the preset resolution interval, so that whether the target resolution is greater than the maximum resolution or less than the minimum resolution can be determined by comparing the size relationship between the target resolution and the minimum resolution, and a comparison result is obtained. And determining the size adjustment information of the browser according to the comparison result.
In some embodiments, the step of determining the browser resizing information based on the comparison result comprises:
(1.1) if the target resolution is smaller than the minimum resolution as a result of the comparison, acquiring the maximum resolution of the preset resolution interval;
(1.2) calculating a difference between the minimum resolution and the target resolution to obtain a first result;
(1.3) calculating a difference value between the maximum resolution and the minimum resolution to obtain a second result;
(1.4) calculating a ratio of the first result to the second result to obtain a reduction ratio value;
and (1.5) determining size adjustment information according to the reduction scale value and the specified size.
If the target resolution is smaller than the minimum resolution as a result of the comparison, the target resolution is a resolution smaller than any resolution in a preset resolution interval, and a reduction ratio of resolution adjustment is determined.
Specifically, the manner of determining the reduction ratio is as follows: scale-down value ═ (minimum resolution-target resolution)/(maximum resolution value-minimum resolution value); the result of the minimum resolution-the target resolution is the first result, and the result of the maximum resolution value-the minimum resolution value is the second result; the ratio of the first result to the second result is the reduction ratio. Wherein the correlation operation of the resolution can be determined by calculating the length or width in the resolution. For example, the minimum resolution is 1024 × 768, the target resolution is 800 × 600, if the calculation is performed according to the length, the minimum resolution-target resolution is 1024-.
After the reduction ratio value is determined, the size adjustment information is determined according to the reduction ratio value and the specified size. The specific determination method is to calculate the product of the reduction ratio value and the specified size to obtain the size adjustment information. For example, if the reduction ratio is 0.25 and the designated size is 103.5 × 75, the size adjustment information is 25.875 × 18.75.
In some embodiments, the step of determining the browser resizing information based on the comparison result comprises:
(1.1) if the target resolution is greater than the minimum resolution as a result of the comparison, acquiring the maximum resolution of the preset resolution interval;
(1.2) calculating a difference value between the target resolution and the maximum resolution to obtain a third result;
(1.3) calculating a difference value between the maximum resolution and the minimum resolution to obtain a fourth result;
(1.4) calculating the ratio of the third result to the fourth result to obtain an amplification ratio value;
and (1.5) determining size adjustment information according to the amplification scale value and the specified size.
If the comparison result shows that the target resolution is greater than the minimum resolution, the target resolution is greater than any resolution within a preset resolution interval, and the magnification ratio of resolution adjustment is determined.
Specifically, the manner of determining the reduction ratio is as follows: magnification ratio value ═ (target resolution-maximum resolution)/(maximum resolution value-minimum resolution value); the result of the target resolution-the maximum resolution is the third result, and the result of the maximum resolution value-the minimum resolution value is the fourth result; the ratio of the third result to the fourth result is the amplification ratio. Wherein the correlation operation of the resolution can be determined by calculating the length or width in the resolution. For example, the maximum resolution is 1600 × 900, the target resolution is 1920 × 1080, if the resolution is calculated according to the length, the minimum resolution — the target resolution is 1920-.
And after the amplification ratio value is determined, determining size adjustment information according to the amplification ratio value and the specified size. The specific determination method is to calculate the product of the amplification ratio value and the specified size to obtain the size adjustment information. For example, if the zoom scale value is 0.25 and the specified size is 103.5 × 75, the resizing information is 25.875 × 18.75.
In step 104, a first adjusted size of the browser is determined based on the original browser size of the browser and the resizing information, and the browser is displayed according to the first adjusted size.
After the size adjustment information is determined, a first adjusted size of the browser, which is adjusted according to the size adjustment information, can be determined according to the original browser size and the size adjustment information, and the browser is displayed according to the first adjusted size.
In some embodiments, the resizing information includes a resizing length and a resizing width, the original browser size includes an original browser length and an original browser width, and the determining a first adjusted size of the browser based on the original browser size of the browser and the resizing information includes:
(1) calculating the difference value between the original browser length and the adjusted length to obtain the reduced length;
(2) calculating the difference value between the original browser width and the adjusted width to obtain the reduced width;
(3) and determining the reduced length and the reduced length as a first adjusted size of the browser.
If the target resolution is smaller than the minimum resolution, after the size adjustment information is determined, the reduced length can be obtained according to the difference value between the original browser length and the adjustment length; and obtaining the reduced width according to the difference value between the original browser width and the adjusted width. And determining the reduced length and the reduced length as a first adjusted size of the browser.
For example, the original browser length is 103.5, the original browser width is 75; the adjusted length is 25.875, the adjusted width is 18.75, the reduced length is 103.5-25.875-77.625, the reduced width is 75-18.75-56.25, and 77.625 × 56.25 is determined as the first adjusted size of the browser.
In some embodiments, the resizing information includes a resizing length and a resizing width, the original browser size includes an original browser length and an original browser width, and the determining a first adjusted size of the browser based on the original browser size of the browser and the resizing information includes:
(1) calculating the sum of the original browser length and the adjusted length to obtain an amplified length;
(2) calculating the sum of the original browser width and the adjusted width to obtain the amplified length;
(3) and determining the amplified length and the amplified length as a first adjusted size of the browser.
If the target resolution is greater than the minimum resolution, after the size adjustment information is determined, the amplified length can be obtained according to the difference value between the original browser length and the adjustment length; and obtaining the amplified length according to the difference value between the original browser width and the adjusted width. And determining the amplified length and the amplified length as a first adjusted size of the browser.
For example, the original browser length is 103.5, the original browser width is 75; the adjusted length is 25.875, the adjusted width is 18.75, the magnified length is 103.5+ 25.875-129.375, the magnified width is 75+ 18.75-93.75, and 129.375 × 93.75 is determined as the first adjusted size of the browser.
In some embodiments, the browser further includes a drag area, where the drag area is configured to respond to a drag operation on the drag area to move the browser, and after the step of determining the first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, the method includes:
(1) acquiring the original dragging size of the dragging area;
(2) determining the adjustment proportion of the browser size according to the original browser size and the first adjusted size;
(3) and determining a second adjusted size of the dragging area according to the original dragging size and the adjustment proportion.
As shown in fig. 1c, fig. 1c is a schematic view of a presentation page of a browser provided in the embodiment of the present application. The display page of the browser comprises a dragging area A, a website input area B, a function control area C such as a bookmark and a webpage display content area D. The dragging area is used for responding to dragging operation aiming at the dragging area so as to enable the browser to move. For example, a user clicks and selects the dragging area a through a mouse, and the movement of the mouse drives the entire browser to display the movement of the page. The website input area B is used for receiving website information input by the user in the area, or displaying website information corresponding to the current webpage. The function control area C is used for displaying bookmarks stored by a user in a historical access process or setting buttons of a browser, and the user can enter a webpage corresponding to the bookmarks by clicking corresponding bookmarks or enter a browser setting interface by clicking the setting buttons of the browser and perform personalized setting on the browser. The web page display content area D is used for displaying web site content corresponding to the current web site.
Specifically, as shown in fig. 1d, fig. 1d is a schematic diagram of the browser, which is provided in the embodiment of the present application, after the page is displayed and the resolution is adjusted and enlarged. It can be seen that, under certain resolutions, the adjusted dragging area a corresponding to the browser partially or completely blocks the website input area B and the function control area C, so that the user cannot operate the website input area B and the function control area C. For such a case, the original drag size of the drag area may be acquired; determining the adjustment proportion of the browser size according to the original browser size and the first adjusted size; and determining a second adjusted size of the dragging area according to the original dragging size and the adjustment proportion.
For example, the original drag size of the drag area includes an original drag length 100, an original drag width 20; the length of the original browser is 800, and the width of the original browser is 600; the first adjusted size includes a first adjusted length 400, and the first adjusted width 300, then the adjustment ratio of the browser size is determined as the ratio of the first adjusted length 400 to the original browser length of 800, and the adjustment ratio is 0.5. And then calculating the product of the adjustment ratio 0.5 and the original dragging length 100 to obtain a second adjusted length 50, and calculating the product of the adjustment ratio 0.5 and the original dragging width 20 to obtain a second adjusted width 10. The second adjusted length 50 and the second adjusted width 10 are determined as a second adjusted size of the drag area.
In some embodiments, the step of obtaining the original drag size of the drag area includes:
(1) acquiring the data type of the original dragging size of the dragging area;
(2) and if the data type is the first type, converting the data type of the original dragging size into the second type.
The original dragging size of the dragging area may be described as the number of pixels in the screen, for example, the length occupies 100 pixel units of the screen, and the width occupies 20 pixel units of the screen; or an actual value, such as the original drag length 100 and the original drag width 20. Since the actual length is calculated when the subsequent adjustment operation is performed, the original drag size, which may be described as the number of pixels in the screen, needs to be converted from the first type to the second type. The first type is a data type described as the number of pixels occupied in the screen, and the second type is an actual numerical value.
Specifically, the conversion method may be processing by a parsint method of javascript, for example, a parsint ("100 px") converts a data type occupying 100 pixel units into an actual value, and obtains a number (second type) type 10.
As can be seen from the above, in the embodiment of the present application, the adjusted target resolution is obtained by receiving the resolution adjustment instruction; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size. Therefore, the size adjustment information of the browser is determined through the resolution before and after adjustment, and the first adjusted size to be displayed by the browser after the resolution is changed is determined according to the original size of the browser and the size adjustment information, so that the display size of the browser can be adaptively adjusted along with the screen resolution exceeding the preset resolution interval, and the compatibility is improved.
The method described in connection with the above embodiments will be described in further detail below by way of example.
Referring to fig. 2, fig. 2 is another schematic flow chart illustrating a method for resizing a browser according to an embodiment of the present application. The method flow can comprise the following steps:
in step 201, the computer device receives a resolution adjustment instruction and obtains an adjusted target resolution.
The resolution adjustment instruction is used for adjusting the screen resolution when the screen is displayed, and the resolution adjustment instruction can be selection operation aiming at a plurality of resolutions in the resolution adjustment interface. For example, the resolutions in the resolution adjustment interface are 1920 × 1080, 1600 × 900, and 800 × 600, respectively, and when the user selects 800 × 600, a resolution adjustment instruction is generated.
Specifically, the resolution adjustment interface may be set to be turned on by a Graphics Processing Unit (GPU) in the operation interface, or may be turned on by a resolution setting page provided in the system itself.
After receiving the resolution adjustment instruction, the target resolution adjusted by the user needs to be acquired. The corresponding resolution may be determined as the target resolution by determining an operation position of the user at the time of the resolution selection operation, such as a click position or a touch position, and determining which resolution of the plurality of resolution-corresponding response regions the operation position is within. The acquisition method is not limited here.
In step 202, the computer device compares the target resolution with the minimum resolution of the preset resolution interval to obtain a comparison result.
When the target resolution is not in the preset resolution interval, it is indicated that the target resolution is smaller or larger, and therefore the size of the browser needs to be adjusted, and therefore the browser displayed at the target resolution is not larger or smaller, and therefore the size adjustment information of the browser needs to be determined. Because the target resolution is not in the preset resolution interval, whether the target resolution is greater than the maximum resolution or less than the minimum resolution can be determined by comparing the size relationship between the target resolution and the minimum resolution, so that a comparison result is obtained. And determining the size adjustment information of the browser according to the comparison result.
In step 203, if the comparison result indicates that the target resolution is smaller than the minimum resolution, the computer device obtains the maximum resolution of the preset resolution interval.
If the target resolution is smaller than the minimum resolution as a result of the comparison, the target resolution is a resolution smaller than any resolution in a preset resolution interval, and a reduction ratio of resolution adjustment is determined.
In step 204, the computer device calculates a difference between the minimum resolution and the target resolution to obtain a first result.
The mode of determining the reduction ratio is as follows: scale-down value ═ (minimum resolution-target resolution)/(maximum resolution value-minimum resolution value); the minimum resolution-target resolution result is the first result.
In step 205, the computer device calculates a difference between the maximum resolution and the minimum resolution to obtain a second result.
Wherein the result of the maximum resolution value-the minimum resolution value is the second result.
In step 206, the computer device calculates a ratio of the first result to the second result to obtain a scaling-down value.
Wherein, the ratio of the first result to the second result is the reduction ratio. Wherein the correlation operation of the resolution can be determined by calculating the length or width in the resolution. For example, the minimum resolution is 1024 × 768, the target resolution is 800 × 600, if the calculation is performed according to the length, the minimum resolution-target resolution is 1024-.
In step 207, the computer device determines resizing information based on the reduction ratio value and the specified size.
After the reduction ratio value is determined, the size adjustment information is determined according to the reduction ratio value and the specified size. The specific determination method is to calculate the product of the reduction ratio value and the specified size to obtain the size adjustment information. For example, if the reduction ratio is 0.25 and the designated size is 103.5 × 75, the size adjustment information is 25.875 × 18.75.
In step 208, the computer device calculates the difference between the original browser length and the adjusted length to obtain the reduced length.
If the target resolution is smaller than the minimum resolution, after the size adjustment information is determined, the reduced length can be obtained according to the difference value between the original browser length and the adjustment length; and obtaining the reduced width according to the difference value between the original browser width and the adjusted width.
In step 209, the computer device calculates the difference between the original browser width and the adjusted width to obtain the reduced width.
And obtaining the reduced width according to the difference between the original browser width and the adjusted width.
For example, the original browser length is 103.5, the original browser width is 75; when the adjustment length is 25.875 and the adjustment width is 18.75, the length after reduction is 103.5-25.875-77.625, and the width after reduction is 75-18.75-56.25.
In step 210, the computer device determines the reduced length as a first adjusted size of the browser, and presents the browser according to the first adjusted size.
And determining the reduced length and the reduced length as a first adjusted size of the browser.
For example, the reduced length is 103.5-25.875-77.625, the reduced width is 75-18.75-56.25, and 77.625-56.25 is determined as the first adjusted size of the browser.
In step 211, the computer device obtains a data type of an original drag size of the drag area.
The original dragging size of the dragging area may be described as the number of pixels in the screen, for example, the length occupies 100 pixel units of the screen, and the width occupies 20 pixel units of the screen; or an actual value, such as the original drag length 100 and the original drag width 20. Since the actual length is calculated when the subsequent adjustment operation is performed, the original drag size, which may be described as the number of pixels in the screen, needs to be converted from the first type to the second type. Thus, the data type of the original drag size of the drag area is acquired.
In step 212, if the data type is the first type, the computer device converts the data type of the original drag size to the second type.
The first type is a data type described as the number of pixels occupied in the screen, and the second type is an actual numerical value.
Specifically, the conversion method may be processing by a parsint method of javascript, for example, a parsint ("100 px") converts a data type occupying 100 pixel units into an actual value, and obtains a number (second type) type 10.
In step 213, the computer device determines an adjustment ratio of the browser size based on the original browser size and the first adjusted size.
As shown in fig. 1c, fig. 1c is a schematic view of a presentation page of a browser provided in the embodiment of the present application. The display page of the browser comprises a dragging area A, a website input area B, a function control area C such as a bookmark and a webpage display content area D. The dragging area is used for responding to dragging operation aiming at the dragging area so as to enable the browser to move. For example, a user clicks and selects the dragging area a through a mouse, and the movement of the mouse drives the entire browser to display the movement of the page. The website input area B is used for receiving website information input by the user in the area, or displaying website information corresponding to the current webpage. The function control area C is used for displaying bookmarks stored by a user in a historical access process or setting buttons of a browser, and the user can enter a webpage corresponding to the bookmarks by clicking corresponding bookmarks or enter a browser setting interface by clicking the setting buttons of the browser and perform personalized setting on the browser. The web page display content area D is used for displaying web site content corresponding to the current web site.
Specifically, as shown in fig. 1d, fig. 1d is a schematic diagram of the browser, which is provided in the embodiment of the present application, after the page is displayed and the resolution is adjusted and enlarged. It can be seen that, under certain resolutions, the adjusted dragging area a corresponding to the browser partially or completely blocks the website input area B and the function control area C, so that the user cannot operate the website input area B and the function control area C. For such a case, the original drag size of the drag area may be acquired; and determining the adjustment proportion of the browser size according to the original browser size and the first adjusted size.
For example, the original drag size of the drag area includes an original drag length 100, an original drag width 20; the length of the original browser is 800, and the width of the original browser is 600; the first adjusted size includes a first adjusted length 400, and the first adjusted width 300, then the adjustment ratio of the browser size is determined as the ratio of the first adjusted length 400 to the original browser length of 800, and the adjustment ratio is 0.5.
In step 214, the computer device determines a second adjusted size of the drag area based on the original drag size and the adjustment ratio.
And determining a second adjusted size of the dragging area according to the original dragging size and the adjustment proportion.
For example, the product of the adjustment ratio 0.5 and the original drag length 100 is calculated to obtain the second adjusted length 50, and the product of the adjustment ratio 0.5 and the original drag width 20 is calculated to obtain the second adjusted width 10. The second adjusted length 50 and the second adjusted width 10 are determined as a second adjusted size of the drag area.
As can be seen from the above, in the embodiment of the present application, the adjusted target resolution is obtained by receiving the resolution adjustment instruction; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size. Therefore, the size adjustment information of the browser is determined through the resolution before and after adjustment, and the first adjusted size to be displayed by the browser after the resolution is changed is determined according to the original size of the browser and the size adjustment information, so that the display size of the browser can be adaptively adjusted along with the screen resolution exceeding the preset resolution interval, and the compatibility is improved.
In order to better implement the method for adjusting the size of the browser provided by the embodiment of the present application, an embodiment of the present application further provides a device based on the method for adjusting the size of the browser. The terms are the same as those in the above-mentioned method for adjusting the size of the browser, and details of implementation may refer to the description in the method embodiment.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a size adjustment apparatus of a browser according to an embodiment of the present application. The browser resizing device may include a receiving module 301, a resizing module 302, a first determining module 303, a second determining module 304, and the like.
A receiving module 301, configured to receive a resolution adjustment instruction, and obtain an adjusted target resolution;
an adjusting module 302, configured to adjust a size of the browser according to a specified size when the target resolution is in a preset resolution interval;
a first determining module 303, configured to determine size adjustment information of the browser when the target resolution is not in a preset resolution interval;
a second determining module 304, configured to determine a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and display the browser according to the first adjusted size.
In some embodiments, the first determining module 303 includes:
the comparison submodule is used for comparing the target resolution with the minimum resolution of the preset resolution interval to obtain a comparison result;
a first determining sub-module, configured to determine, based on the comparison result, resizing information of the browser.
In some embodiments, the first determining sub-module comprises:
a first obtaining unit, configured to obtain a maximum resolution of the preset resolution interval if the comparison result indicates that the target resolution is smaller than the minimum resolution;
the first calculation unit is used for calculating the difference value between the minimum resolution and the target resolution to obtain a first result;
the second calculation unit is used for calculating the difference value between the maximum resolution and the minimum resolution to obtain a second result;
the third calculating unit is used for calculating the ratio of the first result to the second result to obtain a reduced proportion value;
a first determining unit configured to determine size adjustment information according to the reduction ratio value and the designated size.
In some embodiments, the resizing information includes a resize length and a resize width, the original browser size includes an original browser length and an original browser width, and the second determining module 304 includes:
the first calculation submodule is used for calculating the difference value between the original browser length and the adjusted length to obtain the reduced length;
the second calculation submodule is used for calculating the difference value between the original browser width and the adjusted width to obtain the reduced width;
and the second determining submodule is used for determining the reduced length and the reduced length as the first adjusted size of the browser.
In some embodiments, the first determining sub-module comprises:
a second obtaining unit, configured to obtain a maximum resolution of the preset resolution interval if the comparison result indicates that the target resolution is greater than the minimum resolution;
a fourth calculating unit, configured to calculate a difference between the target resolution and the maximum resolution to obtain a third result;
a fifth calculating unit, configured to calculate a difference between the maximum resolution and the minimum resolution to obtain a fourth result;
a sixth calculating unit, configured to calculate a ratio of the third result to the fourth result, so as to obtain an amplification ratio value;
and the second determining unit is used for determining the size adjusting information according to the amplification scale value and the specified size.
In some embodiments, the resizing information includes a resize length and a resize width, the original browser size includes an original browser length and an original browser width, and the second determining module 304 includes:
the third calculation submodule is used for calculating the sum of the original browser length and the adjusted length to obtain the amplified length;
the fourth calculation submodule is used for calculating the sum of the original browser width and the adjusted width to obtain the amplified length;
and the third determining submodule is used for determining the amplified length and the amplified length as the first adjusted size of the browser.
In some embodiments, the browser further includes a drag area, where the drag area is configured to respond to a drag operation on the drag area to move the browser, and the apparatus further includes:
the acquisition module is used for acquiring the original dragging size of the dragging area;
a third determining module, configured to determine an adjustment ratio of the browser size according to the original browser size and the first adjusted size;
and the fourth determining module is used for determining a second adjusted size of the dragging area according to the original dragging size and the adjustment proportion.
In some embodiments, the obtaining module includes:
the obtaining submodule is used for obtaining the data type of the original dragging size of the dragging area;
and the conversion sub-module is used for converting the data type of the original dragging size into a second type if the data type is the first type.
As can be seen from the above, in the embodiment of the present application, the receiving module 301 receives the resolution adjustment instruction, and obtains the adjusted target resolution; when the target resolution is in a preset resolution interval, the adjusting module 302 adjusts the size of the browser according to the specified size; when the target resolution is not in the preset resolution interval, the first determining module 303 determines the size adjustment information of the browser; the second determining module 304 determines a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displays the browser according to the first adjusted size. Therefore, the size adjustment information of the browser is determined through the resolution before and after adjustment, and the first adjusted size to be displayed by the browser after the resolution is changed is determined according to the original size of the browser and the size adjustment information, so that the display size of the browser can be adaptively adjusted along with the screen resolution exceeding the preset resolution interval, and the compatibility is improved.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Correspondingly, the embodiment of the present application further provides a Computer device, where the Computer device may be a terminal or a server, and the terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 4, fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer device 1000 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored on the memory 402 and executable on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will appreciate that the computer device configurations illustrated in the figures are not meant to be limiting of computer devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The processor 401 is a control center of the computer apparatus 1000, connects various parts of the entire computer apparatus 1000 using various interfaces and lines, performs various functions of the computer apparatus 1000 and processes data by running or loading software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby integrally monitoring the computer apparatus 1000.
In the embodiment of the present application, the processor 401 in the computer device 1000 loads instructions corresponding to processes of one or more application programs into the memory 402, and the processor 401 runs the application programs stored in the memory 402, so as to implement various functions as follows:
receiving a resolution adjustment instruction, and acquiring an adjusted target resolution; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 4, the computer device 1000 further includes: touch-sensitive display screen 403, radio frequency circuit 404, audio circuit 405, input unit 406 and power 407. The processor 401 is electrically connected to the touch display screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power source 407. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 4 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The touch display screen 403 may be used for displaying a graphical user interface and receiving operation instructions generated by a user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 401, and can receive and execute commands sent by the processor 401. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel may transmit the touch operation to the processor 401 to determine the type of the touch event, and then the processor 401 may provide a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 403 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display screen 403 may also be used as a part of the input unit 406 to implement an input function.
In this embodiment of the application, a game application is executed by the processor 401 to generate a graphical user interface on the touch display screen 403, where a virtual scene on the graphical user interface includes at least one function control or a wheel control. The touch display screen 403 is used for presenting a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface.
The rf circuit 404 may be used for transceiving rf signals to establish wireless communication with a network device or other computer device via wireless communication, and for transceiving signals with the network device or other computer device.
The audio circuit 405 may be used to provide an audio interface between a user and a computer device through speakers, microphones. The audio circuit 405 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, which is then processed by the audio data output processor 401, and then sent to, for example, another computer device via the radio frequency circuit 404, or output to the memory 402 for further processing. The audio circuit 405 may also include an earbud jack to provide communication of a peripheral headset with the computer device.
The input unit 406 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 407 is used to power the various components of the computer device 1000. Optionally, the power source 407 may be logically connected to the processor 401 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 407 may also include one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, or any other component.
Although not shown in fig. 4, the computer device 1000 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
As can be seen from the above, the computer device provided in this embodiment receives the resolution adjustment instruction, and obtains the adjusted target resolution; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size. Therefore, the size adjustment information of the browser is determined through the resolution before and after adjustment, and the first adjusted size to be displayed by the browser after the resolution is changed is determined according to the original size of the browser and the size adjustment information, so that the display size of the browser can be adaptively adjusted along with the screen resolution exceeding the preset resolution interval, and the compatibility is improved.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, where the computer programs can be loaded by a processor to execute the steps in any one of the browser resizing methods provided in the embodiments of the present application. For example, the computer program may perform the steps of:
receiving a resolution adjustment instruction, and acquiring an adjusted target resolution; when the target resolution is in a preset resolution interval, adjusting the size of the browser according to the specified size; when the target resolution is not in a preset resolution interval, determining size adjustment information of the browser; and determining a first adjusted size of the browser based on the original browser size of the browser and the size adjustment information, and displaying the browser according to the first adjusted size.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium can execute the steps in any of the methods for adjusting the size of a browser provided in the embodiments of the present application, beneficial effects that can be achieved by any of the methods for adjusting the size of a browser provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The foregoing describes in detail a method, an apparatus, a storage medium, and a computer device for adjusting a size of a browser provided in an embodiment of the present application, and a specific example is applied in the present application to explain principles and embodiments of the present application, and the description of the foregoing embodiments is only used to help understand a method and a core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:小说转码方法、装置、设备以及存储介质