@@ -46,9 +46,10 @@ interface StateInt {
46
46
modal : any ;
47
47
}
48
48
49
- const IPC = require ( 'electron' ) . ipcRenderer ;
49
+ // const IPC = require('electron').ipcRenderer; **Variable declared but never used**
50
50
51
51
const mapDispatchToProps = ( dispatch : any ) => ( {
52
+ //this passes the coordinate info from any component bound to the Konva Transformer to the store
52
53
handleTransformation : (
53
54
componentId : number ,
54
55
childId : number ,
@@ -67,19 +68,25 @@ const mapDispatchToProps = (dispatch: any) => ({
67
68
height
68
69
} )
69
70
) ,
70
- changeImagePath : ( imageSource : string ) =>
71
- dispatch ( actions . changeImagePath ( imageSource ) ) ,
71
+ //this doesn't do anything here
72
+ // changeImagePath: (imageSource: string) =>
73
+ // dispatch(actions.changeImagePath(imageSource)),
72
74
75
+
76
+ //this function changes the focus of the child within the focused component, thereby binding it to the transformer as a node
73
77
changeFocusChild : ( { childId } : { childId : number } ) =>
74
78
dispatch ( changeFocusChild ( { childId } ) ) ,
79
+
80
+ //the difference between this dispatch function and the one above, is that this once alters the focused child status within the array of components,
81
+ //vs the one above changes the focusChild property in the state
75
82
changeComponentFocusChild : ( {
76
83
componentId,
77
84
childId
78
85
} : {
79
86
componentId : number ;
80
87
childId : number ;
81
88
} ) => dispatch ( changeComponentFocusChild ( { componentId, childId } ) ) ,
82
- deleteChild : ( { } ) => dispatch ( deleteChild ( { } ) ) // if u send no prms, function will delete focus child.
89
+ deleteChild : ( { } ) => dispatch ( deleteChild ( { } ) ) // if u send no prms, function will delete focus child. <-- This comment was already here, unsure what exactly it means.
83
90
} ) ;
84
91
85
92
const mapStateToProps = ( store : any ) => ( {
@@ -89,18 +96,20 @@ const mapStateToProps = (store: any) => ({
89
96
} ) ;
90
97
91
98
class MainContainer extends Component < PropsInt , StateInt > {
92
- state = {
93
- draggable : false ,
94
- toggleClass : true ,
95
- scaleX : 1 ,
96
- scaleY : 1 ,
97
- x : 0 ,
98
- y : 0 ,
99
- modal : ''
100
- } ;
99
+ //Again, state should not be created outside of the single source of truth
100
+ //Actually upon further examination, it looks like this state isn't manipulated at all.
101
+ // state = {
102
+ // draggable: false,
103
+ // toggleClass: true,
104
+ // scaleX: 1,
105
+ // scaleY: 1,
106
+ // x: 0,
107
+ // y: 0,
108
+ // modal: ''
109
+ // };
101
110
102
111
render ( ) {
103
- const { draggable, scaleX , scaleY , modal, toggleClass } = this . state ;
112
+ // const { draggable, modal } = this.state; //this is being destructured but never read.
104
113
const {
105
114
components,
106
115
handleTransformation,
@@ -113,18 +122,19 @@ class MainContainer extends Component<PropsInt, StateInt> {
113
122
image
114
123
} = this . props ;
115
124
116
- const { main } : { main : HTMLDivElement } = this ;
125
+ // const { main }: { main: HTMLDivElement } = this; **I don't think this has any function**
117
126
118
127
return (
119
128
< MuiThemeProvider theme = { theme } >
120
129
< div className = 'main-container' >
121
- { modal }
122
- < div className = 'main' ref = { main } >
130
+ { /* {modal} */ }
131
+ < div className = 'main' //ref={main} **no function, commenting out**
132
+ >
123
133
< KonvaStage
124
134
image = { image }
125
135
scaleX = { 1 }
126
136
scaleY = { 1 }
127
- draggable = { draggable }
137
+ // draggable={draggable} this is also from this local state but never read past this container
128
138
components = { components }
129
139
handleTransform = { handleTransformation }
130
140
focusComponent = { focusComponent }
0 commit comments