当前位置:网站首页>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
边栏推荐
- 如何对多维矩阵进行标准化(基于numpy)
- Chapter 2 pytoch foundation 2
- 【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
- How to standardize multidimensional matrix (based on numpy)
- Gephi tutorial [1] installation
- What did you do during the internship
- How keras saves and loads the keras model
- PyTorch最佳实践和代码编写风格指南
- PyTorch 10. 学习率
- [2021 book recommendation] kubernetes in production best practices
猜你喜欢

Easyui combobox 判断输入项是否存在于下拉列表中

第1章 NumPy基础

Mysql database installation and configuration details

Component based learning (3) path and group annotations in arouter

1.1 PyTorch和神经网络
![[2021 book recommendation] practical node red programming](/img/f4/e397c01f1551cd6c59ea4f54c197e6.png)
[2021 book recommendation] practical node red programming

Chapter 4 pytoch data processing toolbox

【点云系列】 A Rotation-Invariant Framework for Deep Point Cloud Analysis

C# EF mysql更新datetime字段报错Modifying a column with the ‘Identity‘ pattern is not supported
![[Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation](/img/1d/92aa044130d8bd86b9ea6c57dc8305.png)
[Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation
随机推荐
Mysql database installation and configuration details
ThreadLocal, just look at me!
PyTorch 18. torch.backends.cudnn
Infrared sensor control switch
Cancel remote dependency and use local dependency
【点云系列】Fully-Convolutional geometric features
The Cora dataset was trained and tested using the official torch GCN
树莓派:双色LED灯实验
Machine learning II: logistic regression classification based on Iris data set
【动态规划】不同的二叉搜索树
Some common data type conversion methods in pytorch are similar to list and NP Conversion method of ndarray
torch. mm() torch. sparse. mm() torch. bmm() torch. Mul () torch The difference between matmul()
第2章 Pytorch基础1
第5 章 机器学习基础
面试总结之特征工程
最简单完整的libwebsockets的例子
Pytoch model saving and loading (example)
【动态规划】三角形最小路径和
【点云系列】 场景识别类导读
What did you do during the internship