正文
Creating and Using Masters
创建和使用母版
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.
通常创建为母版的元素包括页眉、页脚和导航栏,因为它们通常在网站或应用程序的每个页面上都是相同的。
1、Creating Masters
创建母版
There are two workflows for creating a master:
创建母版有两种方式:
1.1、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.
您可以通过选择已经添加到画布中的小部件,右键单击,并在上下文菜单中选择** create master
,从而创建一个master。这些小部件将保持它们在画布上的位置,但是它们现在将是新主控件的第一个实例,列在
Masters**窗格中。
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.
如果您想跳过从现有小部件创建的主控件的命名,您可以在** create Master
对话框中选中
Don't show
复选框。稍后,您可以在应用程序首选项菜单的
Masters**选项卡上取消选中该选项。
1.2、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.
您还可以通过单击** masters
窗格右上角的
Add Master**图标来创建空白的Master。
2、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.
要编辑主控件及其包含的小部件,请在
Masters
窗格中双击它的名称,或者双击已添加到画布中的任何实例。master将在画布上打开一个新选项卡。
2.1、Page-Like Properties of Masters
母版的类页面属性
In addition to their contained widgets, masters have page-like properties you can configure:
除了所包含的小部件外,master还具有类似页面的属性,您可以对其进行配置:
-
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.
这个画布颜色只有在你编辑master本身时才可见;它不会出现在您添加主服务器的页面上。
-
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 notes:
在** notes
窗格的顶部,您可以使用
Page Overview**字段来输入关于主程序本身的notes。您可以在页面和Widget notes文章中了解有关使用notes的更多信息。
-
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.
母版视图:
母版视图与自适应视图类似,是一个母版视图的替代版本,您可以为希望使用该母版视图的不同上下文创建它。它们允许您创建一次主控件,然后针对每个上下文重新排列、调整其大小和样式。
3、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
.
若要将一个母版添加到页面或另一个母版,请从
Masters
窗格中拖动它并将其拖放到画布上。大师级人物出现在画布上,用红色覆盖。你可以在
视图→蒙版
上切换覆盖。
Note
提示
Masks are not applied in the web browser.
蒙板在web浏览器中不应用。
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
.
您还可以一次向多个页面添加一个master,或者在
Masters
窗格中右键单击它,并选择** add to pages
或
remove from pages **,从而一次从多个页面删除一个master。
3.1、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
Drop Behavior
:
您可以通过更改其“drop行为”来更改添加到画布时主实例的行为方式。为此,在
Masters
窗格中右键单击master,并在
Drop Behavior
下面的选项中进行选择:
-
Place Anywhere
(default): Allows you to place instances of the master at any coordinates you want on the canvas.
Place Anywhere
(默认):允许您将主实例放置在画布上您想要的任何坐标上。
-
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