Skip to content

Commit

Permalink
Remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
balbatross committed Oct 11, 2023
1 parent e18dcc6 commit c9123d8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,23 @@ export const SchematicEditor = () => {
})
}

const nodeMap = (item: any) => {
return {
id: item.id,
type: item.type,
position: item.position,
data: item.data
}
}



const onUpdatePage = (page: any) => {

let input : any = {};

if(page.nodes){
input.nodes = page.nodes?.filter((a) => a.id != 'page' && a.id != 'canvas');
input.nodes = page.nodes?.filter((a) => a.id != 'page' && a.id != 'canvas')?.map(nodeMap);
}

if(page.edges){
Expand Down
5 changes: 1 addition & 4 deletions packages/core-ui/command-remote-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Loader = async (base_url: string, start: string) => {

let requirementFetch: any[] = [];
const _initialRequire = (name: string) => {
console.log({name, baseRequirements})

if (!(name in baseRequirements)) {

requirementFetch.push((async () => {
Expand Down Expand Up @@ -53,8 +53,6 @@ const Loader = async (base_url: string, start: string) => {

func(_requires, module, exports);

console.log({module})

return module.exports;
}

Expand Down Expand Up @@ -93,7 +91,6 @@ const useRemoteComponents = (cache?: RemoteComponentCache) => {

return Object.keys(data).map((x) => ({ name: x, component: data[x] }))
} catch (e) {
console.log(e);

// console.log({ e, base_url, url })
lock.current[id] = undefined;
Expand Down
18 changes: 15 additions & 3 deletions packages/core-ui/editor-canvas/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {MouseEvent, useEffect, useState} from 'react';
import { Box } from '@mui/material';
import { ReactFlow, MiniMap, Controls, Background, Node, Edge, NodeTypes, EdgeTypes, useOnSelectionChange, useNodesState, useEdgesState, CoordinateExtent, ConnectionMode, useViewport, useReactFlow } from 'reactflow';
import { ReactFlow, MiniMap, Controls, Background, Node, Edge, NodeTypes, EdgeTypes, useOnSelectionChange, useNodesState, useEdgesState, CoordinateExtent, ConnectionMode, useViewport, useReactFlow, SelectionMode, useStore, Rect, Transform, getNodePositionWithOrigin, useStoreApi } from 'reactflow';
import { isEqual } from 'lodash';

export interface EditorCanvasSelection {
Expand Down Expand Up @@ -32,6 +32,16 @@ export interface EditorCanvasProps {

export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {

const storeApi = useStoreApi();
// const { selectActive, nodeOrigin, nodeInternals, selectRect } = useStore((state) => ({
// selectRect: state.userSelectionRect,
// selectActive: state.userSelectionActive,
// nodeInternals: state.nodeInternals,
// nodeOrigin: state.nodeOrigin
// }))

// console.log(selectActive, selectRect)

const [ nodes, setNodes, onNodesChange ] = useNodesState(props.nodes || [])
const [ edges, setEdges, onEdgesChange ] = useEdgesState(props.edges || [])

Expand All @@ -43,8 +53,6 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {

const { project } = useReactFlow();

const { x, y, zoom } = useViewport()

const onSelectionStart = (e: MouseEvent) => {
let bounds = props.wrapper?.getBoundingClientRect();

Expand All @@ -67,6 +75,7 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {
})
}


let zoneOrientationX = (zone?.start?.x || 0) < (zone.end?.x || 0)
let zoneOrientationY = (zone?.start?.y || 0) < (zone.end?.y || 0)

Expand Down Expand Up @@ -96,6 +105,8 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {

useOnSelectionChange({
onChange: (params) => {
console.log("Selection change", params);

setSelection(params);
props.onSelect?.(params)
}
Expand Down Expand Up @@ -296,6 +307,7 @@ export const EditorCanvas : React.FC<EditorCanvasProps> = (props) => {
// onSelectionDrag={()}
onNodeDoubleClick={(ev, node) => props.onNodeDoubleClick?.(node)}
connectionMode={ConnectionMode.Loose}
selectionMode={SelectionMode.Full}
>
<Background />
<Controls />
Expand Down

0 comments on commit c9123d8

Please sign in to comment.