设计通用工具管理器
我想处理 UI 组件(按钮、文本字段、swfs、自定义对象等)上的多个操作,
例如缩放、倾斜、颜色、旋转等,并保存它们。早些时候,这些操作是
使用单个工具和单个 mxml 文件完成的,但现在该工具被分成不同的工具。
想知道如何设计/使用 Toolmanager 类之类的东西来处理操作等?
另外,棘手的部分是某些对象可以为它们定义更多操作。 就像“object1”有 3 个可以对其执行的操作,“object2”有 5 个对其定义的操作。
我们使用 MVC 设计模式,但没有这样的框架。
可使用哪些不同的设计模式来实现此目的?
编辑:
更准确地说,我想以 AS3 OO 方式实现它。 该应用程序类似于绘图应用程序,支持添加各种图像、文本、音频、swfs等。添加的一个用户可以对对象执行各种操作..比如 添加颜色、缩放、倾斜、旋转等以及自定义效果,然后将绘图导出为 PNG。同样,一些适用于文本的效果不适用于图像 反之亦然。有些影响可能是常见的。
有什么想法吗?
I want to handle multiple operations on a UI Component (button ,textfield, swfs,custom objects etc)
in like scaling,skewing ,color,rotations etc etc and save them too. Earlier the actions were done
using a single tool and single mxml file but now the tool is separated into different tools.
Was wondering how i can design / use something like Toolmanager class to handle actions etc?
Also the tricky part is that some objects can have more operations defined for them .
Like 'object1' has 3 operations that can be performed on it and 'object2' has 5 operations defined on it.
We are using MVC design pattern but no frameworks as such.
What are the different design patterns that can be used to do this?
Edit:
To be more precise i want implement this in AS3 OO way.
The application is similar to drawing application which supports addition of various images,text,audio,swfs etc. One added user can perform various operations of the objects..like
adding color,scaling skewing,rotation etc etc and custom effects and after that export the drawing as PNG.Likewise some effects that are applicable to text are not applicable to images
and vice versa. and some effects can be common.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以有一个工具栏、工具(从公共基础继承)和某种属性面板,这些对象可以从管理器类访问,该管理器类将它们包装在一起并使所有类都可以访问一些变量。
也许您需要管理器类中的选择数组或向量以及选择工具来操作此集合
(例如(在管理器中))
以及有关编辑库扩展及其可用工具的集合。
每次选择工具更新选择集合(可能从选择工具的 onMouseUp 方法调用管理器上的方法)时,您可以更新工具栏以显示当前选择
(在管理器中)
的适当工具,并且在选择已被操作之后(在经理也)
工具的祖先应该看起来像这样:
等等:)
有点直截了当。
检查 Photoshop 插件教程,或谷歌搜索“扩展{这里的任何 adobe 东西,例如 flash 或其他东西}
那是 javascript,但这个概念也可以应用在这里
Probably you could have a toolbar, tools(inheriting from a common base), and some kind of property panel, these objects are accessible from a manager class which wrappes them together and makes some variables accessible for all classes.
Probably you want a selection array or vector in the manager class and a select tool to manipulate this collection
like (in the manager)
and a collection about the editbase extensions and the tools avaiable for them.
every time the selection tool updates the selection collection (probably calling a method on manager from the select tool's onMouseUp method) you can update the toolbar to display the apropriate tools for the current selection
(in manager)
and after the selection has benn manipulated (in manager also)
the ancestor for the tools should look something like this:
and so and so on :)
kinda straight forward.
check photoshop plugin tutorials, or google around "extending {any adobe stuff here, like flash or something}
thats javascript but the concept can be applied here as well
也许您可以通过在 MVC 实现中创建一些额外的类来使用策略设计模式
http://en.wikipedia。 org/wiki/Strategy_pattern
算法,检查此工具中的图像:
再见! :)
maybe you could use the Strategy Design Pattern by creating some extra classes in your MVC implementation
http://en.wikipedia.org/wiki/Strategy_pattern
algo, check this tool for images:
http://www.senocular.com/demo/TransformToolAS3/TransformTool.html
bye! :)