当前位置:网站首页>Wechat applet uses wxml2canvas plug-in to generate some problem records of pictures
Wechat applet uses wxml2canvas plug-in to generate some problem records of pictures
2022-04-23 07:22:00 【qq_ fifteen million one hundred and ninety-seven thousand four 】
Text cannot be bold
css Style add font-weight:bold, But the font of the generated image is not bold . Check the plug-in source code , Find out bold Replaced with 700( If the word weight is not set, it is 400)
terms of settlement : Here is the source code _drawText The red box position of the method , Direct will 700 Replace with bold, The plug-in can draw the BOLD effect normally .
The drawing results are disordered ( Part of the content is not drawn )
reason 1: Network picture
First , Domain name of network picture , Must be set in the applet "downloadFile Legitimate domain name " Inside , Otherwise, you can't draw a picture , And cause the image All elements after the element are not drawn ( The plug-in does not report an error )
secondly , Network pictures need to be downloaded to the cache in advance , Otherwise, it's impossible to draw the picture , And it also causes the following elements not to draw .
terms of settlement : Use wx.downloadFile Download all pictures in advance , And replace src Cache pictures for src
Last , Recommended at all image Add... To the tag data-delay="1" attribute ,
The advantage of this is , Delay the picture until all text elements are drawn , Even if a picture is drawn incorrectly , It will not cause the following text content to be unable to be drawn , Reduce risk .( Put the background map in local resources , Don't delay, Otherwise, the text content will be overwritten )
reason 2: The drawing order is out of order .
The default drawing page of the plug-in has no scroll bar , And only draw the current screen content . If you draw long content , And when the page scrolls , The drawing results will be confused .
After detecting the source code, I found , When sorting inside the plug-in , Using elements top Value as array subscript , Because after the scroll bar , The element at the top of the page top It's a negative number , Negative array subscripts when sorting , Was wrongly ranked at the end , This leads to elements that should have been drawn first , Finally draw , And there is an error coverage problem .
terms of settlement : In source _sortListByTop In the way , Add the code in the red box , First, traverse the minimum of all elements top value , If it's negative , The reverse is true , And add to top in , This ensures that the array subscript is at least 0, There will be no wrong sort problem .
PS: If top The value has a decimal number , At this time, there will also be problems when the plug-in is used as an array subscript , Please make sure top The value is integer. .
Last , Effect of finished drawing ( There are only methods to draw rounded corner pictures in the plug-in , There is no way to draw rounded rectangles , Too lazy to mend ~)
版权声明
本文为[qq_ fifteen million one hundred and ninety-seven thousand four ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230609264816.html
边栏推荐
- Raspberry Pie: two color LED lamp experiment
- 常见的正则表达式
- Compression and acceleration technology of deep learning model (I): parameter pruning
- 如何对多维矩阵进行标准化(基于numpy)
- Android interview Online Economic encyclopedia [constantly updating...]
- 第4章 Pytorch数据处理工具箱
- Migrating your native/mobile application to Unified Plan/WebRTC 1.0 API
- [2021 book recommendation] red hat rhcsa 8 cert Guide: ex200
- Chapter 2 pytoch foundation 1
- [2021 book recommendation] artistic intelligence for IOT Cookbook
猜你喜欢
[2021 book recommendation] effortless app development with Oracle visual builder
[Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation
【点云系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation
[recommendation for new books in 2021] professional azure SQL managed database administration
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
【点云系列】Multi-view Neural Human Rendering (NHR)
【点云系列】FoldingNet:Point Cloud Auto encoder via Deep Grid Deformation
【指标】Precision、Recall
【点云系列】Neural Opacity Point Cloud(NOPC)
第2章 Pytorch基础1
随机推荐
【动态规划】杨辉三角
Component based learning (3) path and group annotations in arouter
5种方法获取Torch网络模型参数量计算量等信息
Mysql database installation and configuration details
MySQL数据库安装与配置详解
【点云系列】点云隐式表达相关论文概要
C# EF mysql更新datetime字段报错Modifying a column with the ‘Identity‘ pattern is not supported
Pymysql connection database
Some common data type conversion methods in pytorch are similar to list and NP Conversion method of ndarray
Exploration of SendMessage principle of advanced handler
PyTorch训练一个网络的基本流程5步法
【点云系列】 A Rotation-Invariant Framework for Deep Point Cloud Analysis
1.1 PyTorch和神经网络
Machine learning II: logistic regression classification based on Iris data set
[2021 book recommendation] learn winui 3.0
Gephi教程【1】安装
Chapter 2 pytoch foundation 2
【动态规划】最长递增子序列
Pytoch model saving and loading (example)
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion