Skip to content

Instantly share code, notes, and snippets.

View fskpf's full-sized avatar

Fabian Schwarzkopf fskpf

View GitHub Profile
@fskpf
fskpf / new 1.js
Created July 20, 2023 12:05
Gist from API Documentation Editor
class MyCEIM extends CreateEdgeInputMode {
private readonly TARGET_NODE_HALO_SIZE = 30
constructor() {
super()
// use the default priority for CEIM in GEIM
this.priority = 45
// allow gesture ending within a certain area of a node
@fskpf
fskpf / new 1.js
Created March 14, 2023 11:12
Gist from API Documentation Editor
import {
CreateEdgeInputMode,
DefaultPortCandidate,
FreeNodePortLocationModel,
GraphComponent,
IBend,
IEdge,
IGraph,
IHitTestable,
MouseEventRecognizers,
@fskpf
fskpf / new 1.js
Created March 14, 2023 11:04
Gist from API Documentation Editor
import {
CreateEdgeInputMode,
DefaultPortCandidate,
FreeNodePortLocationModel,
GraphComponent,
IBend,
IEdge,
IGraph,
IHitTestable,
MouseEventRecognizers,
@fskpf
fskpf / new 1.js
Created March 9, 2023 09:46
Gist from API Documentation Editor
class SelectedRootNodeHitTestable extends BaseClass(IHitTestable) {
constructor(
private readonly originalHitTestable: IHitTestable,
private readonly inputMode: GraphEditorInputMode
) {
super()
}
isHit(context: IInputModeContext, location: Point): boolean {
// get the current hit tester from the input mode context
const inputModeContext = this.inputMode.inputModeContext!
@fskpf
fskpf / new 1.js
Created April 19, 2022 14:49
Gist from API Documentation Editor
import type { INode, IRenderContext } from 'yfiles'
import {
GraphComponent,
InteriorLabelModel,
MarkupLabelStyle,
NodeStyleBase,
SimpleLabel,
SimpleNode,
SvgVisual,
Visual
@fskpf
fskpf / new 1.js
Created October 21, 2021 15:47
Gist from API Documentation Editor
/****************************************************************************
** @license
** This demo file is part of yFiles for HTML 2.3.
** Copyright (c) 2000-2020 by yWorks GmbH, Vor dem Kreuzberg 28,
** 72070 Tuebingen, Germany. All rights reserved.
**
** yFiles demo files exhibit yFiles for HTML functionalities. Any redistribution
** of demo files in source code or binary form, with or without
** modification, is not permitted.
**
@fskpf
fskpf / new 1.js
Created June 8, 2021 16:16
Gist from API Documentation Editor
class GMM extends GraphModelManager {
private readonly annotationGroup: ICanvasObjectGroup
constructor(canvas: CanvasComponent) {
super(canvas)
this.annotationGroup = this.contentGroup.addGroup()
}
protected getNodeCanvasObjectGroup(node: INode): ICanvasObjectGroup {
if (node.tag) {
@fskpf
fskpf / new 1.js
Created June 7, 2021 14:20
Gist from API Documentation Editor
function createDuplicationInputMode(graphComponent: GraphComponent): MoveInputMode {
graphComponent.autoDrag = false
const mim = new MoveInputMode()
mim.priority = 35 // place it before the MoveViewportInputMode due to CTRL+DRAG in case of GEIM usage
mim.hitTestable = IHitTestable.create((ctx, location) => {
const geim = ctx.canvasComponent!.inputMode as GraphEditorInputMode
const firstNodeHit = geim.hitTester
@fskpf
fskpf / new 1.js
Created June 7, 2021 11:49
Gist from API Documentation Editor
class MyWebGLVisual extends WebGLVisual {
constructor(overviewVisualCreator) {
super()
this.overviewVisualCreator = overviewVisualCreator
}
render(ctx, gl) {
this.overviewVisualCreator.update(ctx, gl)
}
}
@fskpf
fskpf / new 1.js
Created May 25, 2021 07:15
Gist from API Documentation Editor
class MyWebGLVisual extends WebGLVisual {
constructor(overviewVisualCreator) {
super()
this.overviewVisualCreator = overviewVisualCreator
}
render(ctx, gl) {
this.overviewVisualCreator.update(ctx, gl)
}
}