public ExampleGraphView(EditorWindow editor, ref GraphAsset asset) { graphAsset = asset; editorWindow = editor; //AddElement(new ExampleNode()); //ノードの追加 //諸々の設定 this.StretchToParentSize(); contentDragger = new ContentDragger(); selectionDragger = new SelectionDragger(); SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); this.AddManipulator(new ContextualMenuManipulator(OnContextMenuPopulate)); this.AddManipulator(contentDragger); this.AddManipulator(selectionDragger); //this.AddManipulator(new RectangleSelector()); //右クリックでのメニューの表示 searchWindow = ScriptableObject.CreateInstance <SearchMenuWindow>(); searchWindow.Init(this, editor, ref graphAsset); nodeCreationRequest += context => { SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), searchWindow); }; }
public TestGraphView() { SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); contentDragger = new ContentDragger(); selectionDragger = new SelectionDragger(); rectangleSelector = new RectangleSelector(); freehandSelector = new FreehandSelector(); this.AddManipulator(contentDragger); this.AddManipulator(selectionDragger); this.AddManipulator(rectangleSelector); this.AddManipulator(freehandSelector); Insert(0, new GridBackground()); focusable = true; }
public void Initialize() { graphViewChanged += GraphChanged; var contentDragger = new ContentDragger(); this.AddManipulator(contentDragger); var selectionDragger = new SelectionDragger(); this.AddManipulator(selectionDragger); this.AddManipulator(new ClickSelector()); this.AddManipulator(new ContentZoomer()); this.AddManipulator(new RectangleSelector()); _mousePosProvider = new BTMousePosProvider(); this.AddManipulator(_mousePosProvider); SetupZoom(minScale, maxScale); serializeGraphElements += SerializeForCopy; unserializeAndPaste += UnserializeAndPaste; _isInitialized = true; }