A method for implementing canvas editing
By overlaying input boxes on the canvas for text editing and storing data separately, the problem of duplicate data storage in online education systems is solved, enabling diversified editing and paginated storage, thus improving system stability and user experience.
Patent Information
- Application Number
- CN202111352631.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-11-16
AI Technical Summary
In existing online education systems, the same SVG file is used to store data from homework writing, answering, and grading, resulting in duplicate data storage, wasting storage resources and affecting system performance. At the same time, the canvas editing function restricts user access.
Text editing is performed by overlaying input boxes on the canvas, and data from each stage is stored separately. Relationships are established through a database, supporting diverse editing methods such as text and images. Data is stored separately on the server side.
It reduces storage space requirements, improves system data storage stability, supports diverse editing functions, saves operating costs, and meets diverse user needs.
Smart Images

Figure CN113919285B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of WEB applications, and in particular to a method for implementing canvas editing. Background Art
[0002] When designing an online education digital system, you will usually encounter scenarios such as writing, answering, and correcting homework. At this time, canvas is usually used to implement this function. From writing homework to students answering and then to teachers correcting homework, the same svg file is always used for data storage. Under this practice, when each link is completed, the generated svg file will repeatedly store the data generated in the previous link (for example: after the student answers the homework assigned by the teacher, the generated svg file will contain the data of the teacher's homework and the data of the student's answer.) This will lead to a waste of storage resources. As the user base continues to increase, it will also have a negative impact on the performance of the system. At the same time, using only canvas to implement it will also limit the use of users. The canvas only supports the function of brush graffiti, and does not support editing methods such as text and uploading pictures. Summary of the invention
[0003] The present invention aims at the technical problems existing in the prior art and provides a method for implementing canvas editing. The technical solution optimizes the basic functions of the canvas and provides new editing methods such as text and pictures in addition to the original brush function of the canvas. Compared with the original implementation scheme, the technical solution solves the problem of duplicate data storage by storing the data of each link separately, reducing the demand for storage space. It provides a guarantee for the stability of the system in terms of data storage.
[0004] The technical solution of the present invention to solve the above technical problem is as follows: a method for implementing canvas editing, comprising:
[0005] Create a canvas and overlay an input box on the canvas. Edit text in the input box to complete the editing and packaging of loaded data. Read the edited and packaged loaded data in the input box and then load the data in the input box onto the canvas. The image is directly loaded onto the canvas to edit the canvas.
[0006] The canvas is placed at the top layer of the layer, and the association relationship between the data generated by each link of the same task is established through the database business table, and the data of each link of the same task is stored separately. After each link reads the data generated by the previous link, it is converted into a dot matrix and loaded on the canvas. The destination of the data storage is the server side.
[0007] Based on the above technical solution, the present invention can also make the following improvements.
[0008] Optionally, the image editing includes taking a photo of the image and uploading a local image.
[0009] Optionally, when uploading an image, if the image format is heic format, the image file is transcoded into base64 encoding through JS on the browser side and then uploaded.
[0010] Optionally, the image file is transcoded into base64 encoding by JS on the browser side, decoded on the server side, and then stored on the server side.
[0011] Optionally, a fabric plug-in is introduced to replace the enlarged display area of the fabric plug-in with a canvas to implement paging, paging storage and editing functions through the canvas.
[0012] Optionally, a switching icon is loaded on the canvas, and the original canvas and the created canvas are switched by the switching icon. The original canvas retains the canvas's own functions, and the created canvas implements canvas text and image editing by calling the encapsulated editor and the encapsulated loaded data.
[0013] The present invention provides a method for implementing canvas editing. This technical solution optimizes the basic functions of the canvas. In terms of editing methods, in addition to the original brush function of the canvas, new editing methods such as text and pictures are also provided. Users only need to click the icon on the screen to simply switch the editing mode. When reading data, text and pictures can be loaded onto the canvas by simply calling the encapsulated method for loading data. Compared with the original implementation scheme, this technical solution solves the problem of duplicate data storage by storing the data of each link separately, reducing the demand for storage space. On the one hand, it can help users save some operating expenses. On the other hand, while the user's technology continues to improve, it also provides a guarantee for the stability of the system in data storage. The canvas is also integrated with another component to realize the function of paging storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A schematic flow chart of a method for implementing canvas editing according to the present invention. DETAILED DESCRIPTION
[0015] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0016] In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the internal connection between two components. It can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.
[0017] Figure 1 A schematic diagram of a method for implementing canvas editing provided by the present invention is shown in FIG. Figure 1 As shown, a method for implementing canvas editing disclosed in this embodiment includes the following steps:
[0018] Create a canvas and overlay an input box on the canvas. Edit text in the input box to complete the editing and packaging of loaded data. Read the edited and packaged loaded data in the input box and then load the data in the input box onto the canvas. The image is directly loaded onto the canvas to edit the canvas.
[0019] The canvas is placed at the top layer of the layer, and the association relationship between the data generated by each link of the same task is established through the database business table, and the data of each link of the same task is stored separately. After each link reads the data generated by the previous link, it is converted into a dot matrix form and loaded on the canvas, and displayed in the lower layer of the canvas. The destination of data storage is the server side.
[0020] It is understandable that the native canvas component does not originally support components other than the brush. Under this technical solution, when the text editing mode is selected, an input box is overlaid on the canvas for text editing. After the editing is completed, the data in the input box is read and loaded onto the canvas. The canvas supports the text editing function. After selecting a local image, the image data is read and then directly loaded onto the canvas.
[0021] As an example, take the scenarios of homework writing, answering, and correcting as examples. In these links, the data generated by each link is stored separately. Each link will read the data generated by the previous link and display it under the canvas, where the canvas is at the top of the layer. The relationship between the four parts is established through the database business table. For example: The data generated by the homework writing link is stored on the server with the file name [homework writing.svg]. In the homework answering link, the image content of [homework writing.svg] will be displayed under the canvas layer, and then the answer content will be stored separately as [homework answer.svg] file, and the following links are similar.
[0022] More specifically, the canvas function has been optimized. It supports multiple editing methods such as brushes, text, pictures, and photos to meet the frequently changing usage needs of users. At the same time, we store the data of homework writing, homework answers, homework grading, and homework annotations in four parts. This solves the problem of duplicate data storage. In each link, only the data generated by the current link and the data generated by the previous link will be converted into a dot matrix and loaded onto the canvas. (For example: in the homework answering stage, you can only see the homework content assigned by the teacher and the answers previously saved by the user.)
[0023] It is understandable that users only need to click on the icon on the screen to simply switch the editing mode. When reading data, you only need to call the encapsulated method of loading data to load text and pictures onto the canvas. Compared with the original implementation scheme, this technical scheme solves the problem of duplicate data storage by storing the data of each link separately, reducing the demand for storage space. On the one hand, it can help users save some operating expenses. On the other hand, as user technology continues to improve, it also provides a guarantee for the stability of the system in data storage. The canvas is also integrated with another component to realize the function of paging storage.
[0024] In a possible embodiment, the image editing includes taking a picture of the image and uploading the local image.
[0025] It can be understood that in this embodiment, in addition to local uploading of images, photo uploading is also added to provide real-time images for editing and packaging.
[0026] In a possible implementation manner, when uploading an image, if the image is an image with unknown features, in this embodiment, the image with unknown features refers to an image in the heic format, then the image file is transcoded into base64 encoding through JS on the browser side and then uploaded.
[0027] It is understandable that due to the different firewall security policies of various cloud service providers, special attention should be paid to the function of uploading pictures when adopting this technical solution. During the implementation process, it was found that the firewall of a certain cloud service provider would intercept certain pictures with unknown characteristics when using the picture upload function. At this time, it is necessary to bypass the firewall by converting the encoding and other methods. Because the file size of the picture will increase significantly after transcoding, if the picture upload function is used frequently and the picture clarity is very high, it will cause the picture to be uploaded and read slowly. In this scenario, it is necessary to continue to optimize the picture reading problem on the basis of this technical solution.
[0028] Specifically, taking a picture file in heic format as an example, during the implementation of the above technical solution, the picture file in heic format (no obvious features were found) could not be uploaded. After investigation, it was found that it was blocked by the firewall of the cloud service provider. After determining that there is no security problem with files in heic format, it was decided to use the conversion encoding method to bypass this problem. The specific solution is: transcode the file into base64 encoding through js on the browser side, decode it on the server side, and then save it on the server side.
[0029] In a possible implementation manner, a fabric plug-in is introduced, and the display area enlarged by the fabric plug-in is replaced with a canvas, so as to implement paging, paging storage and editing functions through the canvas.
[0030] It is understandable that in this embodiment, since the native canvas itself does not have a paging function (only supports a single page), due to business needs, the job needs to support a multi-page function. We found a fabric plug-in that can achieve a PPT-like effect. Multiple pages of thumbnails can be displayed on the left. After selecting the thumbnail on the left, the content of the thumbnail will be displayed in the area on the right (enlarged display). In the fabric plug-in, the right area does not support editing. So we integrated the two components and replaced the enlarged display area on the right with the canvas to meet our paging business needs. It provides both an editing area and paging functions.
[0031] In a possible implementation manner, a switching icon is loaded on the canvas, and the original canvas and the created canvas are switched by the switching icon. The original canvas retains the canvas's own functions, and the created canvas implements canvas text and image editing by calling the packaged editor and the packaged loaded data.
[0032] It can be understood that switching is achieved by switching icons to satisfy the user's need to switch between the original canvas and the newly created canvas and use canvases with different functions for creation and editing.
[0033] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0034] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0035] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0036] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0037] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0038] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0039] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for implementing canvas editing, It is characterized in that It includes: Create a canvas and overlay an input box on the canvas. Edit text in the input box to complete the editing and packaging of loaded data. Read the edited and packaged loaded data in the input box and then load the data in the input box onto the canvas. The image is directly loaded onto the canvas to edit the canvas. The drawing is placed on the top layer of the layer, and the association relationship between the data generated by each link of the same task is established through the database business table, and the data of each link of the same task is stored separately. After each link reads the data generated by the previous link, it is converted into a dot matrix and loaded on the canvas, and the destination of data storage is the server end; When uploading an image, if the image format is heic, the image file is transcoded into base64 encoding through JS on the browser side and then uploaded; After the image file is transcoded into base64 encoding through JS on the browser side, it is decoded on the server side and then stored on the server side.
2. A method for implementing canvas editing according to claim 1, It is characterized in that The image editing includes taking pictures of images and uploading local images.
3. A method for implementing canvas editing according to claim 1, It is characterized in that Introduce the fabric plug-in and replace the enlarged display area of the fabric plug-in with a canvas to implement paging, paging storage and editing functions through the canvas.
4. A method for implementing canvas editing according to claim 1, It is characterized in that The canvas is loaded with a switching icon, through which the original canvas and the created canvas are switched. The original canvas retains the canvas's own functions, and the created canvas implements canvas text and image editing by calling the encapsulated editing and the encapsulated loading data.
Citation Information
Patent Citations
Method, client and server for online collaborative drawing
CN102646235A
Electronic drawing board system, data processing method and device based on multi-user collaborative operation
CN103279279A
A multi-functional whiteboard drawing tool of a HuiShi cloud classroom teaching system
CN109460221A
Method and device for zooming and rotating target layer
CN112925593A
