You need to use EasyEDA editor to create some projects before publishing
Changing font size via the API does not work
829 1
homernl82 6 years ago
**BUG** Concise problem statement: When running a javascript to change the fontsize on my PCB, the change does not take affect. When afterwards I change some text, the font size gets updated though. Also the height attribute shows the correct font size when I click on a text label in the editor. So for some reason the displayed text is not updated, while all attributes are changed correctly. Steps to reproduce bug: Run the following script while editing a PCB: var json = api('getSource', {type: "json"}) for (var part in json.FOOTPRINT) { for (var text in json.FOOTPRINT[part].TEXT) { json.FOOTPRINT[part].TEXT[text].fontSize=10.0; json.FOOTPRINT[part].TEXT[text].strokeWidth=0.6; } } api('applySource', {source: json, createNew: false}); Results: Attributes fontSize (height) and strokeWidth (Line Width) change, but fonts on the PCB are not updated. Expected results: Font size and stroke width on the PCB should change. Browser: Firefox Quantum 57.0 and Chromium 62.0.3202.94
Comments
eric 6 years ago
You should empty the pathStr variable. var json = api('getSource', {type: "json"}); for (var part in json.FOOTPRINT) { for (var text in json.FOOTPRINT[part].TEXT) { json.FOOTPRINT[part].TEXT[text].fontSize=10.0; json.FOOTPRINT[part].TEXT[text].strokeWidth=0.6; json.FOOTPRINT[part].TEXT[text].pathStr=''; //Empty the pathStr variable to tell the api to regenerate it. } } api('applySource', {source: json, createNew: false});
Reply
Login or Register to add a comment
goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus-@1x -mockplus-

Cookie Notice

Our website uses essential cookies to help us ensure that it is working as expected, and uses optional analytics cookies to offer you a better browsing experience. To find out more, read our Cookie Notice