简体   繁体   English

Morphic中的Morph和可可中的NSView有什么区别?

[英]What is the difference between a Morph in Morphic and a NSView in Cocoa?

我想知道使Morphic特别的事物。

Morphic is much more than NSView or any other graphics class that simply allow the re-implementation of a limited set of features. Morphic远远超过了NSView或任何其他仅允许重新实现一组有限功能的图形类。 Morphic is an extremely malleable UI construction kit. Morphic是一个非常具有延展性的UI构造工具包。 Some design ideas behind Morphic makes this intention clear: Morphic背后的一些设计思想清楚地表明了这一意图:

  • A comprehensive hierarchy of 2D coordinate systems is included. 包括2D坐标系的全面层次结构。 They are not restricted to Cartesian or linear. 它们不限于笛卡尔或线性。 Useful nonlinear coordinate systems include polar, logarithmic,hyperbolic and geographic (map like) projections. 有用的非线性坐标系包括极坐标,对数坐标,双曲线坐标和地理(类似地图的)投影。
  • Separation of the handling of coordinate systems from the morphs themselves. 将坐标系统的处理与变形本身分开。 A morph should only need to select its preferred coordinate system, instead of needing to convert every point it draws to World coordinates by itself. 变形只需要选择其首选的坐标系,而不需要将其绘制的每个点本身转换为世界坐标。 Its #drawOn: method and the location of its sub-morphs are expressed in its own coordinate system. 它的#drawOn:方法及其子变形的位置在其自己的坐标系中表示。
  • Complete independency of Display properties such as size or resolution. 显示属性(例如大小或分辨率)的完全独立性。 There is no concept of pixel. 没有像素的概念。 The GUI is thought at a higher level. GUI被认为是更高级别的。 All the GUI is independent of pixel resolution. 所有GUI均独立于像素分辨率。 All the rendering is anti aliased. 所有渲染都是抗锯齿的。
  • Separating the coordinate system eases the moving, zooming and rotation of morphs. 分离坐标系可以简化变形的移动,缩放和旋转。
  • All coordinates are Float numbers. 所有坐标均为浮点数。 This is good for allowing completely arbitrary scales without significant rounding errors. 这对于允许完全任意的缩放比例而没有明显的舍入误差是有益的。
  • The Morph hierarchy is not a hierarchy of shapes. 变形层次不是形状的层次。 Morphs don't have a concept of a border or color. 变形没有边界或颜色的概念。 There is no general concept of submorph aligning. 没有子变形对齐的一般概念。 A particular morph may implement these in any way that makes sense for itself. 特定的变体可以任何对自己有意义的方式实现这些功能。
  • Morphic event handling is flexible and allows you to send events to arbitrary objects. 形态事件处理非常灵活,可以将事件发送到任意对象。 That object need not subclass Morph. 该对象不需要子类Morph。

Warning: Smalltalk's live dynamic environment is a red pill . 警告:Smalltalk的动态环境是一个红色药丸 Static, frozen languages will never be the same for you ;-) 静态的冻结语言对您而言永远不会相同;-)

In a nutshell: Morphic is a virtual world where you can directly explore live objects (just like the real world). 简而言之:Morphic是一个虚拟世界 ,您可以在其中直接探索活动对象 (就像现实世界一样)。 Did you ever look at a UI and... 您是否曾经看过UI并...

  • wonder "wow, that's really cool! How did they do that?" 想知道“哇,那真的很酷!他们是怎么做到的?”
  • kvetch "I wish they had done X instead!" kvetch“我希望他们改成X!”

While these thoughts would lead to pain and frustration in any other environment, not so in Morphic. 尽管这些想法会在其他任何环境中导致痛苦和沮丧,但在Morphic中却不会。

If you want to blow your mind, become a god in a Morphic world: 如果您想打定主意,请在变身世界中成为神:

  1. Launch a Pharo image, and click on the background (which is actually the "World") to bring up the world menu: 启动Pharo图像,然后单击背景(实际上是“世界”)以调出世界菜单:

    替代文字

  2. Bring up the "halos" on one of the menu options (shift-alt-click on my Mac): 在菜单选项之一上调出“晕轮”(在Mac上按住Shift键并单击鼠标): 替代文字

  3. Drag the "Pick Up" halo (top-middle) and drop it somewhere in the world: 拖动“拾取”光晕(中上)并将其拖放到世界上的某个位置: 替代文字

  4. Enjoy your menu item which is now available wherever you want it: 享受需要的地方现在是可用的菜单项: 替代文字

Seriously, click it and watch the Browser open!! 认真地,单击它并观看浏览器打开!

Ever have an option you always use that a vendor has buried three-menu-levels deep? 曾经有你总是使用一个厂商都埋三菜单层次深的选项? Could this be useful?! 这有用吗? This is a glimpse of the power of a live direct GUI environment like Morphic. 这是对实时直接GUI环境(如Morphic)的强大功能的一瞥​​。

If you're intrigued, read John Maloney & Randall Smith's paper Directness and Liveness in the Morphic User Interface Construction Environment 如果您感兴趣,请阅读John Maloney和Randall Smith的论文《形态用户界面构建环境中的直接性和生动性》。

The title do not map your question, so I answer your question and not the title. 标题不代表您的问题,所以我回答您的问题,而不是标题。
I have read about Morphic the last two days and conclude with what I think makes morphic special. 最近两天,我已经阅读了有关Morphic的内容,并以我认为使morphic特殊的内容作为结论。

Morphic is perfect for live coding . Morphic非常适合实时编码 That is a direct mapping such that when code is changed the output on the screen change. 这是一种直接映射,因此当更改代码时,屏幕上的输出也会更改。 And/or if morphs on screen is changed (draged) the values in the code is changed. 和/或如果更改了屏幕上的变形,则代码中的值也会更改。 That is cool in art performance! 艺术表演太酷了!

But Morphic aims for higher abstractions than that. 但是Morphic的目标是实现更高的抽象度。 The properties of the morphs is abstracted away from the code. 从代码中抽象出了morph的属性。 Do the SoC to a file or fetch a server-side database. SoC写入文件或获取服务器端数据库。

I suppose WebStorage and JavaScript file is a good option to store the liveness state of the Morph properties changed interactively. 我想WebStorage和JavaScript文件是存储交互更改的Morph属性的活动状态的好选择。 You see - programming is done through each Morph. 您会看到-编程是通过每个Morph完成的。 Then the code need only to handle events from click and drag. 然后,该代码仅需要处理单击和拖动中的事件。

The aim for research has even abstracted the code away. 研究的目的甚至将代码抽象掉了。 Coding can be done through the Morph to define what happen with click or drag. 可以通过“变形”进行编码,以定义单击或拖动时发生的情况。 Morphs can be puzzle pieces as in Scratch . 变形可以像Scratch一样是拼图。

A program has to be backed up into a file somewhere. 必须将程序备份到某个位置的文件中。 I don't consider to do coding on a cloud as safe. 我不认为在云上进行编码是安全的。 So a JS-file is the only alternative (if not setting up a server is an option), because datafiles is not allowed locally, not even in same folder as the web app. 因此,JS文件是唯一的选择(如果不设置服务器,则是一个选择),因为数据文件不允许在本地使用,甚至不能与Web应用程序位于同一文件夹中。 The Same Origin policy means same server - not same folder. “相同来源”策略表示相同的服务器-不是相同的文件夹。

When the app starts the Javascript file (or Web Storage in first place) will set up the world of morphs. 当应用启动时,JavaScript文件(或首先放在Web存储中)将建立变形世界。 User interacts with that world. 用户与那个世界互动。 The new state can be stored in WebStorage and bacuped by a download. 新状态可以存储在WebStorage中并通过下载进行处理。

You can use Lively Kernel as the language in the file or store the morph data in an object or whatever you find simplest to generate as a file to download. 您可以将Lively Kernel用作文件中的语言,或者将变形数据存储在对象中,或者将您发现最简单的任何形式生成为要下载的文件。

So what is special with this? 那么这有什么特别的呢? I am not repeat the accepted answer, but this is my conclusion: 我不会重复已接受的答案,但这是我的结论:

  • Everything you see on the Morphic screen is a morph . 您在“ 变形”屏幕上看到的一切都是变形
  • The tree of morphs is called a world . 变形树被称为世界
  • The coordinate, dimension and properties of each morph is abstracted away from the code into the tree. 每个变体的坐标,尺寸和属性都从代码中抽象到树中。
  • The research aims for abstract away the code too. 该研究的目的也是将代码抽象出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM