Flex Child Canvas 插入 Canvas 和调整大小问题
我有一个带有滚动策略的画布 A, A 有一个唯一的子画布 B,它没有滚动。
A是B的容器,B是一个类似白板的工具。
如果我不设置 B 的宽度和高度,他将相应地调整大小以适应 A 的大小,直到 A 具有滚动条的某个点,这是良好的行为。
然而,由于每当我动态添加或移动元素时,B 画布似乎都会动态调整大小,因此速度会慢一些。
我可以通过将 B 的宽度和高度百分比设置为 100% 来解决这个问题,当我执行 B 时,
var bmd:BitmapData = new BitmapData(
B.width, B.height, false, 0xffffff
);
bmd.draw(B);
实际上 A 视图(带滚动条)。
如果我删除百分比高度和宽度,它将是预期的整个画布。
完美的是保持百分比高度和宽度,同时子宽度小于父 A 宽度。 当 B 宽度变得大于 A 时,百分比宽度应该停止。
我应该在 B 的哪个函数中处理这样的代码? 是 updatelist() 吗?
谢谢 !
I have a Canvas A with scrollpolicy on,
A has one unique Child canvas B which has no scrolling.
A is the container of B which is a whiteboard like tool.
If i dont set width and height of B, he will resize accordingly to A size, up to a certain point where A has scrollbars which is the good Behavior.
However since B canvas seems to be resized on the fly whenever I dynamically add or move an element it gets a little bit slower.
I can solve it by setting a percent width and height of 100% to B, when i do a
var bmd:BitmapData = new BitmapData(
B.width, B.height, false, 0xffffff
);
bmd.draw(B);
B would be actually A view (with scrollbars).
If i remove percent height and width it will be the whole canvas as expected.
What would be perfect is keeping the percent height and width while child width is smaller than parent A width. When B width become larger then A the percent width should stop.
In which function of B should i handle such code ? is it updatelist() ?
THanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到过同样的问题;
我解决了它监听一个事件(创建完成后创建或其他事件(调整大小...)),并根据测量宽度设置我的组件宽度
myContainer.width = myContainer.measuredWidth
这对我有用,希望它可以帮助你:)
I had the same issue;
i solved it listening an event (creationComplete after creation or other event (resizing...)), and setting my component width according to the measuredWidth
myContainer.width = myContainer.measuredWidth
This worked for me, hope it can help you :)
如果您只使用像素值并减去滚动条的宽度,可能会更容易。
It might be easier if you just used pixel values and subtracted the width of the scrollbar.