{"id":3392,"date":"2024-11-10T17:32:21","date_gmt":"2024-11-10T09:32:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3392\/"},"modified":"2024-11-10T17:32:21","modified_gmt":"2024-11-10T09:32:21","slug":"zrender-%e7%bb%98%e5%88%b6-path-%e6%97%b6%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac%e8%8c%83%e5%9b%b4%e8%bf%87%e5%a4%a7%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3392\/","title":{"rendered":"zrender \u7ed8\u5236 Path \u65f6\u5982\u4f55\u89e3\u51b3\u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u8fc7\u5927\u7684\u95ee\u9898\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173103632978063.jpg\" class=\"aligncenter\" title=\"zrender \u7ed8\u5236 Path \u65f6\u5982\u4f55\u89e3\u51b3\u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u8fc7\u5927\u7684\u95ee\u9898\uff1f\u63d2\u56fe\" alt=\"zrender \u7ed8\u5236 Path \u65f6\u5982\u4f55\u89e3\u51b3\u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u8fc7\u5927\u7684\u95ee\u9898\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>zrender \u7ed8\u5236 path \u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u8fc7\u5927<\/strong><\/p>\n<p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>\u7ed8\u5236\u4e00\u4e2a\u7231\u5fc3 path \u65f6\uff0c\u76d1\u542c\u8303\u56f4\u8d85\u51fa\u56fe\u5f62\u533a\u57df\uff0c\u5bfc\u81f4\u4e0d\u5728\u56fe\u5f62\u5185\u90e8\u70b9\u51fb\u4e5f\u4f1a\u89e6\u53d1\u4e8b\u4ef6\u3002\u5df2\u77e5\u95ee\u9898\u539f\u56e0\u662f\u751f\u6210\u7684\u9ed8\u8ba4 rect \u8fc7\u5927\uff0c\u4f46 Github \u4e0a\u7ed9\u51fa\u7684\u89e3\u51b3\u65b9\u6848\u5e76\u672a\u89e3\u51b3\u6b64\u95ee\u9898\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u4fee\u6539\u4ee3\u7801\uff0c\u5c06\u4e8b\u4ef6\u7c7b\u578b\u66f4\u6539\u4e3a\u62d6\u52a8\uff0c\u5e76\u79fb\u9664 cursor \u6837\u5f0f\uff1a<\/p>\n<pre>var path = new zrender.path.createFromString(`M 10,30 A 20, 20 0, 0, 1 50, 30 A 20, 20 0, 0, 1 90, 30Q 90, 60 50, 90Q 10, 60 10, 30 z`,\n{\n    draggable: true,  \/\/ \u4fee\u6539\u4e8b\u4ef6\u7c7b\u578b\u4e3a\u62d6\u52a8\n    style: {\n        fill: 'red',\n        stroke: 'blue'\n    },\n    ondrag: function () {\n        console.log('click');\n    }\n}\n)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4fee\u6539\u4e8b\u4ef6\u7c7b\u578b\u548c\u79fb\u9664 cursor \u6837\u5f0f\uff0c\u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u5c06\u5c40\u9650\u5728 path \u5f62\u72b6\u533a\u57df\u5185\uff0c\u89e3\u51b3\u8d85\u51fa\u76d1\u542c\u7684\u95ee\u9898\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fzrender \u7ed8\u5236 Path \u65f6\u5982\u4f55\u89e3\u51b3\u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u8fc7\u5927\u7684\u95ee\u9898\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>zrender \u7ed8\u5236 path \u4e8b\u4ef6\u76d1\u542c\u8303\u56f4\u8fc7\u5927 \u95ee\u9898\u63cf\u8ff0\uff1a \u7ed8\u5236\u4e00\u4e2a\u7231\u5fc3 path \u65f6\uff0c\u76d1\u542c\u8303\u56f4\u8d85\u51fa\u56fe\u5f62\u533a\u57df\uff0c\u5bfc\u81f4\u4e0d\u5728\u56fe\u5f62\u5185\u90e8\u70b9\u51fb\u4e5f\u4f1a\u89e6\u53d1\u4e8b\u4ef6\u3002\u5df2\u77e5\u95ee\u9898\u539f\u56e0\u662f\u751f\u6210\u7684\u9ed8\u8ba4 rect \u8fc7\u5927\uff0c\u4f46 Github \u4e0a\u7ed9\u51fa\u7684\u89e3\u51b3\u65b9\u6848\u5e76\u672a\u89e3\u51b3\u6b64\u95ee\u9898\u3002 \u89e3\u51b3\u65b9\u6cd5\uff1a \u4fee\u6539\u4ee3\u7801\uff0c\u5c06\u4e8b\u4ef6\u7c7b\u578b\u66f4\u6539\u4e3a\u62d6\u52a8\uff0c\u5e76\u79fb\u9664 cursor \u6837\u5f0f\uff1a var path = new zrender.path.createFromString(`M 10,30 A 20, 20 0, 0, 1 50, 30 A 20, 20 0, 0, 1 90, 30Q 90, 60 50, 90Q 10, 60 10, 30 z`, { draggable: true, \/\/ \u4fee\u6539\u4e8b\u4ef6\u7c7b\u578b\u4e3a\u62d6\u52a8 style: { fill: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3392","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=3392"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3392\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}