我在Go contextMenu
diagram
的以下定义
SeatingMapGraphicsRef.contextMenu =
$(go.Adornment, "Vertical",
// no binding, always visible button:
$("ContextMenuButton",
$(go.TextBlock, "Hold Seats"),
{ click: function(e, obj) {
holdSeatsInDragSelect();
} }),
$("ContextMenuButton",
$(go.TextBlock, "Select Seats"),
{ click: function(e, obj) {
} }),
$("ContextMenuButton",
$(go.TextBlock, "Lock Seats"),
{ click: function(e, obj) {
} }),
$("ContextMenuButton",
$(go.TextBlock, "Cancel"),
{ click: function(e, obj) {
var diagram = e.diagram;
diagram.hideContextMenu();
} })
);
但是当我写这篇文章时,我收到以下错误:
Error: Diagram.contextMenu value is not an instance of Adornment
情况究竟如何?
以下是我对SeatingMapGraphicsRef
function generateMap() {
SeatingMapGraphicsRef =
GO(go.Diagram, "mapBodyDiv", // the DIV HTML element
{
initialContentAlignment: go.Spot.Center,
initialAutoScale:go.Diagram.Uniform,
"toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom
});
最后,这是ContextMenus上的参考页面,我在diagram
级别上从中获取了contextMenu定义。
答案 0 :(得分:3)
因为你开始使用:
var GO = go.GraphObject.make;
而不是(样本中常见的):
var $ = go.GraphObject.make;
大概是因为你也在使用jQuery。
如果您在装饰品定义中将所有$
更改为GO
,则可能会有效