Skip to content

Commit

Permalink
Merge pull request #457 from TheTechCompany/staging
Browse files Browse the repository at this point in the history
Electrical editor surface
  • Loading branch information
balbatross authored Oct 11, 2023
2 parents 5bd3b49 + 5c1ee45 commit 80d2d7f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
41 changes: 40 additions & 1 deletion packages/core-ui/editor-canvas/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {

const [ selection, setSelection ] = useState<EditorCanvasSelection>({});

const [ lastDrag, setLastDrag ] = useState<{x: number, y: number}>()

const [ selectionZone, setSelectionZone ] = useState<{start?: {x: number, y: number}} | null>(null);

const { project } = useReactFlow();
Expand Down Expand Up @@ -99,6 +101,39 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {
}
})

const onSelectionDragStart = (e: MouseEvent) => {
console.log("Start Drag")
setLastDrag(project({
x: e.clientX,
y: e.clientY
}))
}

const onSelectionDrag = (e: MouseEvent) => {
console.log("Drag")

if(!lastDrag) return;

let currentPoint = project({
x: e.clientX,
y: e.clientY
})

let delta = {
x: currentPoint.x - lastDrag?.x,
y: currentPoint.y - lastDrag?.y
}

moveSelection(delta.x, delta.y)

setLastDrag(currentPoint)
}

const onSelectionDragStop = (e: MouseEvent) => {
console.log("Stop drag")
setLastDrag(undefined)
}

useEffect(() => {
setNodes(
(props.nodes || []).map((e) => ({
Expand Down Expand Up @@ -247,11 +282,15 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {
}}
nodesFocusable={false}
edgesFocusable={false}
nodesDraggable={false}
disableKeyboardA11y
// nodesDraggable={false}
fitView={props.fitView}
minZoom={0.8}
translateExtent={props.translateExtent}
nodeExtent={props.nodeExtent}
onSelectionDragStart={onSelectionDragStart}
onSelectionDrag={onSelectionDrag}
onSelectionDragStop={onSelectionDragStop}
onSelectionStart={onSelectionStart}
onSelectionEnd={onSelectionEnd}
// onSelectionDrag={()}
Expand Down
3 changes: 0 additions & 3 deletions packages/editors/electrical/src/components/surface/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ export const ElectricalSurface : React.FC<ElectricalSurfaceProps> = (props) => {
}, [])

const onNodesChange = useCallback((nodes: Node[]) => {
console.log(props.page)
props.onUpdate?.({
...props.page,
nodes
Expand All @@ -154,7 +153,6 @@ export const ElectricalSurface : React.FC<ElectricalSurfaceProps> = (props) => {
const height = 1080 * ratio;

const page = props.page;
console.log("Page", props.page)

return (
<EditorCanvas
Expand Down Expand Up @@ -312,7 +310,6 @@ export const ElectricalSurface : React.FC<ElectricalSurfaceProps> = (props) => {
clipboard={props.clipboard}
page={{nodes: props.page?.nodes, edges: props.page?.edges}}
onUpdate={(page) => {
console.log("onUpdate")
props.onUpdate?.({
id: props.page?.id,
...page
Expand Down
8 changes: 7 additions & 1 deletion packages/infrastructure/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ const main = (async () => {

// const hexhiveZone = await aws.route53.getZone({name: "hexhive.io"})

const provider = new Provider('eks', { kubeconfig });
const provider = new Provider('eks', {
kubeconfig
}, {
aliases: [
'urn:pulumi:hivecommand-prod::hivecommand-app::pulumi:providers:kubernetes::eks::505a5ec8-50f9-449d-8610-623756cc905e' //2022-2023
]
});

const namespace = new k8s.core.v1.Namespace(`hivecommand-sync-${suffix}`, {
metadata: {
Expand Down

0 comments on commit 80d2d7f

Please sign in to comment.