JSFL setCustomStroke 不适用于 stroke.style = "noStroke"

发布于 2024-10-15 09:02:57 字数 670 浏览 6 评论 0 原文

所以我在搞JSFL,我想将storke设置为None。应该这样做:

var stroke = fl.getDocumentDOM().getCustomStroke("toolbar");
stroke.style = "noStroke";
fl.getDocumentDOM().setCustomStroke(stroke);

但这不起作用。

用填充工作做相应的事情! (我在填充方面没有任何问题!)

如果我在工具栏中手动将鹳鸟设置为“无”(使用颜色选择器),然后执行此操作:

var stroke = fl.getDocumentDOM().getCustomStroke("toolbar");
stroke.style = "solid";
stroke.color = "#0066ff";
fl.getDocumentDOM().setCustomStroke(stroke);

我得到一个带有 aRGB 值的实心鹳鸟:00 00 00 00(0 Alpha、0 红色、0 绿色、0 蓝色)。 (使用颜色工具栏通常是不可能的)

如果我再次执行该命令,我会得到正确的描边颜色! (如果我有任何正常的纯色,它也有效。如果笔划是渐变或位图,则不会发生任何情况)。

正如我所提到的,设置填充内容完全没有问题。只有笔画。

So I was messing around with JSFL, and I wanted to set the storke to None. That should be done like this:

var stroke = fl.getDocumentDOM().getCustomStroke("toolbar");
stroke.style = "noStroke";
fl.getDocumentDOM().setCustomStroke(stroke);

But that does NOT work.

Doing the corresponding thing with fills work! (I've had NO trouble with fills at all!)

If I manually set the storke to "None" in the toolbar (using the color-picker), and then execute this:

var stroke = fl.getDocumentDOM().getCustomStroke("toolbar");
stroke.style = "solid";
stroke.color = "#0066ff";
fl.getDocumentDOM().setCustomStroke(stroke);

I get a solid storke with aRGB value: 00 00 00 00 (0 alpha, 0 red, 0 green, 0 blue). (Which normally is impossible using the color-toolbar)

If I execute that command once more, I get the right stroke color! (It also works if I have any normal solid color. If the stroke is a gradient or bitmap, nothing happens).

As I mentioned, there have been NO problems at all with setting things for fills. ONLY strokes.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

唱一曲作罢 2024-10-22 09:02:57

我也遇到过这个错误,它不允许您设置“noStroke”。不过,我已经找到了解决方法。交换描边和填充,然后将填充设置为“noFill”并交换回来。就像这样:

var dom = fl.getDocumentDOM();
dom.swapStrokeAndFill();
var tempFill = dom.getCustomFill("toolbar");
tempFill.style = "noFill";
dom.setCustomFill(tempFill);
dom.swapStrokeAndFill();

I've also encountered this bug that doesn't allow you to set "noStroke." I have found a workaround, though. Swap the stroke and fill, then set the fill to "noFill" and swap back. Like so:

var dom = fl.getDocumentDOM();
dom.swapStrokeAndFill();
var tempFill = dom.getCustomFill("toolbar");
tempFill.style = "noFill";
dom.setCustomFill(tempFill);
dom.swapStrokeAndFill();
一束光,穿透我孤独的魂 2024-10-22 09:02:57

实际上,您可以将该值设置为“null”,它将把颜色设置为无颜色。

Actually you can set the value to "null" and it will set the color to no color.

听,心雨的声音 2024-10-22 09:02:57

似乎 setCustomStroke(myStroke) 仅当 myStroke.style="solid" 并且没有其他属性时才将描边设置为 none。您不必使用 getCustomStroke 获取 myStroke。它可以是只有一个属性 style 设置为 solid 的通用对象。

var mystroke=new Object();
mystroke.style="solid";
fl.getDocumentDOM().setCustomStroke(mystroke);

It seems that setCustomStroke(mystroke) sets stroke to none only when mystroke.style="solid" and there are no other properties. You don't have to get mystroke using getCustomStroke. It can be generic object with only one attribute style set to solid.

var mystroke=new Object();
mystroke.style="solid";
fl.getDocumentDOM().setCustomStroke(mystroke);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文