mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 08:21:49 +03:00
1a8b82e237
* `Enter` key accepts the edit in Numeric and Text input * Newly added node are selected * Placement of new nodes takes opened visualizations into account. [Screencast from 2024-02-02 13-02-26.webm](https://github.com/enso-org/enso/assets/3919101/0f328824-1cbc-4b07-988e-dbf17b94dc2f)
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import type { GraphSelection } from '@/providers/graphSelection'
|
|
import type { GraphNavigator } from '../src/providers/graphNavigator'
|
|
import { Rect } from '../src/util/data/rect'
|
|
import { Vec2 } from '../src/util/data/vec2'
|
|
|
|
export const graphNavigator: GraphNavigator = {
|
|
events: {} as any,
|
|
clientToScenePos: () => Vec2.Zero,
|
|
clientToSceneRect: () => Rect.Zero,
|
|
panAndZoomTo: () => {},
|
|
transform: '',
|
|
prescaledTransform: '',
|
|
translate: Vec2.Zero,
|
|
scale: 1,
|
|
sceneMousePos: Vec2.Zero,
|
|
viewBox: '',
|
|
viewport: Rect.Zero,
|
|
}
|
|
|
|
export function graphNavigatorWith(modifications?: Partial<GraphNavigator>): GraphNavigator {
|
|
return Object.assign({}, graphNavigator, modifications)
|
|
}
|
|
|
|
export const graphSelection: GraphSelection = {
|
|
events: {} as any,
|
|
anchor: undefined,
|
|
deselectAll: () => {},
|
|
handleSelectionOf: () => {},
|
|
setSelection: () => {},
|
|
hoveredNode: undefined,
|
|
hoveredPort: undefined,
|
|
isSelected: () => false,
|
|
mouseHandler: () => false,
|
|
selectAll: () => {},
|
|
selected: new Set(),
|
|
}
|
|
|
|
export function graphSelectionWith(modifications?: Partial<GraphSelection>): GraphSelection {
|
|
return Object.assign({}, graphSelection, modifications)
|
|
}
|
|
|
|
export const all = {
|
|
'graph navigator': graphNavigator,
|
|
'graph selection': graphSelection,
|
|
}
|
|
|
|
export function allWith(
|
|
modifications: Partial<{ [K in keyof typeof all]: Partial<(typeof all)[K]> }>,
|
|
): typeof all {
|
|
return {
|
|
'graph navigator': graphNavigatorWith(modifications['graph navigator']),
|
|
'graph selection': graphSelectionWith(modifications['graph selection']),
|
|
}
|
|
}
|