Masters are collections of widgets that you can maintain in a central location and reuse throughout a project. Changes you make to a master are automatically pushed out to every individual instance of the master in the project.
母版是小部件的集合,你可以集中维护并在整个项目中重复使用。你对母版所作的更改将自动更新到项目中的每个母版实例。
Elements that are commonly created as masters include headers, footers, and navigation bars since they're generally the same on every page of a website or application.
通常创建为母版的元素包括页眉,页脚和导航栏,因为它们在网站或应用程序的每个页面上通常都相同。
Creating Masters创建母版
There are two workflows for creating a master:
有两种方式创建母版:
Create from Widgets从部件创建
You can create a master from widgets you've already added to the canvas by selecting them, right-clicking, and choosing Create Master in the context menu. The widgets will stay exactly where they are on the canvas, but they'll now be the first instance of a new master, listed in the Masters pane.
你可以从已添加到画布的部件中创建母版,方法是选择它们,右键单击,然后在上下文菜单中选择“创建母版”。 这些小部件将完全保留在画布上的位置,但现在它们将成为“新母版”的第一个实例,在“母版”窗格中列出。
Note注意
If you want to skip naming masters you create from existing widgets, you can check the Don't show checkbox in the Create Master dialog. You can later uncheck this selection on the Masters tab of the application preferences menu.如果要跳过从现部件创建的母版的命名,则可以在“创建母版”对话框中选中“不显示”复选框。 以后你可以在应用程序首选项菜单的“母版”选项卡上取消选中此选择。
Creating in the Masters Pane在母版窗格中创建
You can also create blank masters by clicking the Add Master icon at the top-right of the Masters pane.你也可以通过单击“母版”窗格右上方的“添加母版”图标来创建空白母版。 |
Editing Masters编辑母版
To edit a master and its contained widgets, double-click its name in the Masters pane or double-click any instance of it that you've added to the canvas. The master will open in a new tab on the canvas.要编辑母版及其包含的部件,请在“母版”窗格中双击其名称,或双击已添加到画布中的任何实例。 母版将在画布上的新选项卡中打开。
Page-Like Properties of Masters母版页面属性
In addition to their contained widgets, masters have page-like properties you can configure:
除了其包含的部件之外,母版还具有可以配置的类似页面的属性:
Canvas color画布颜色: You can change a master's canvas color to facilitate the design process. For example, you can set the canvas to a dark color when working with light text and widget fill colors.你可以更改母版的画布颜色,以简化设计过程。例如,在使用浅色文本和部件填充颜色时,可以将画布设置为深色。
This canvas color is only visible when you're editing the master itself; it does not appear on pages you add the master to.仅当你编辑母版本身时,此画布颜色才可见。它不会出现在你添加母版的页面上。
Page notes页面注释: At the top of the Notes pane, you can use the Page Overview field to enter notes about the master itself. You can learn more about working with notes in the Page and Widget Notes article.在“注释”窗格的顶部,可以使用“页面概述”字段输入有关母版本身的注释。 你可以在“页面和窗口部件注释”文章中了解有关使用注释的更多信息。
Page interactions页面交互: Interactions you create under page-level events inside a master will fire along with the page events of pages you add the master to. For example, if you create a Page Loaded interaction inside a master, that interaction will take place when a page containing the master loads in the web browser.你在母版中的页面级事件下创建的交互会与你添加母版的页面的页面事件一起触发。 例如,如果你在母版中创建“页面加载”交互,则当包含母版的页面加载到Web浏览器中时,将发生该交互。
Master views母版视图: Master views, similar to adaptive views, are alternate versions of a master that you can create for the different contexts where you expect to use the master. They allow you to create the master once and then rearrange, resize, and restyle its widgets for each of your contexts. To learn more, check out the Master Views article.与自适应视图相似,母版视图是可以为希望使用该母版视图的不同情景创建的备用版本。 它们使你可以一次创建母版,然后针对您的每个情景重新排列,调整其大小和样式。 要了解更多信息,请查看“母版视图”文章。
Adding Masters to the Canvas添加母版到画布
To add a master to a page or to another master, drag it from the Masters pane and drop it onto the canvas. Masters appear on the canvas masked by a red overlay. You can toggle the overlay at View → Masks.要将母版添加到页面或其他母版,请将其从“母版”窗格中拖放到画布上。 母版出现在画布上,并用红色遮罩覆盖。 你可以在视图→遮罩中切换覆盖。
Note注意
Masks are not applied in the web browser.遮罩不会在浏览器中展示。
You can also add a master to multiple pages at once or remove a master from multiple pages at once by right-clicking it in the Masters pane and selecting either Add to Pages or Remove from Pages.你还可以一次将母版添加到多个页面,也可以一次在多个页面中删除母版,方法是在“母版”窗格中右键单击它,然后选择“添加到页面”或“从页面中删除”。
Drop Behavior拖放行为
You can change how each instance of a master behaves when added to the canvas by changing its "drop behavior." To do this, right-click the master in the Masters pane and select from the following options under.你可以通过更改其“拖放行为”来更改每个母版实例添加到画布时的行为。 为此,请在“母版”窗格中右键单击母版,然后从“拖放行为”下的以下选项中进行选择:
Place Anywhere任意位置 (default默认): Allows you to place instances of the master at any coordinates you want on the canvas.允许你将母版实例放置在画布上所需的任何坐标处。
Lock to Master Location固定母版位置: Restricts all instances of the master to the exact coordinates of the widgets on the master's own canvas. Furthermore, only one instance of the master can be added to a page or another master since subsequent instances would overlap the first.将母版的所有实例限制为母版自己的画布上部件的确切坐标。 此外,母版只能将一个实例添加到页面或另一个母版中,因为后续实例将与第一个实例重叠。
Note注意
You can toggle this behavior on an instance-by-instance basis by right-clicking an instance of a master and selecting Lock to Master Location in the context menu.通过右键单击母版实例并在上下文菜单中选择“锁定到母版位置”,可以逐个将母版实例切换此行为。
Break Away脱离母版: When placed on the canvas, instances of the master immediately become regular widgets that are no longer linked to the source master.当拖放至画布上时,母版实例立即变为不再与源母版关联的常规窗口部件。
Note注意
You can also break away individual instances by right-clicking and selecting Break Away in the context menu.你还可以通过右键菜单单击并在上下文菜单中选择“脱离母版”来脱离单个实例。
Text and Image Overrides文字和图像替代
After adding an instance of a master to the canvas, you can use the Overrides section of the Style pane to change the text and images on widgets in the instance.将母版实例添加到画布后,可以使用“样式”窗格的“覆盖”部分来更改实例中小部件上的文本和图像。
Note注意
你必须先在母版窗口部件中输入一些默认文本,然后才能在页面级别覆盖这些文本。You must first enter some default text on a widget in a master before the text can be overridden at the page level.
Usage Report使用情况报告
You can quickly see which pages a master has been added to by right-clicking it in the Masters pane and selecting Usage Report.通过在“母版”窗格中右键单击母版并选择“使用情况报告”,可以快速查看将母版添加到哪些页面。 |
Interactions交互
As with all other aspects of a master, its interactions and the interactions of its contained widgets exist exclusively within the master and are consistent across all its instances in the project. If you need an interaction in a master to affect widgets outside the master, or if you want an interaction to work differently for each instance of the master, use a raised event.与母版的所有其他方面一样,它的交互以及它所包含部件的交互仅存在于母版中,并且在项目中的所有实例之间都是一致的。 如果您需要在母版中进行交互以影响母版外部的窗口小部件,或者你希望对母版的每个实例进行不同的交互,请使用引发事件。