Skip to content

Commit 5ffb035

Browse files
image src scaling properly, but image urls not saving into local forage well, so sanitized the string
2 parents 7672f6d + 6ee24f3 commit 5ffb035

File tree

3 files changed

+13
-67
lines changed

3 files changed

+13
-67
lines changed

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const createWindow = () => {
6666
width,
6767
height,
6868
webPreferences: {
69-
zoomFactor: 0.8,
69+
zoomFactor: 0.9,
7070
'node-Integration': false,
7171
},
7272
show: false,

src/components/GrandchildRectangle.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { Rect, Group } from 'react-konva';
33
// import findComponentById from '../utils/findComponentById.ts';
44

55
class GrandchildRectangle extends Component {
6+
state = {
7+
imageHeight: 0,
8+
imageWidth: 0,
9+
};
10+
611
getComponentColor(componentId) {
712
// const color = findComponentById(componentId, this.props.components).color;
813
const color = this.props.components.find(comp => comp.id === componentId).color;
@@ -14,11 +19,12 @@ class GrandchildRectangle extends Component {
1419
}
1520

1621
setImage = imageSource => {
17-
//console.log("IMAGE SOURCE", imageSource);
22+
// console.log("IMAGE SOURCE", imageSource);
1823
if (!imageSource) return;
1924
const image = new window.Image();
2025
image.src = imageSource;
2126
if (!image.height) return null;
27+
this.setState({ imageHeight: image.height, imageWidth: image.width });
2228
return image;
2329
};
2430

@@ -57,11 +63,15 @@ class GrandchildRectangle extends Component {
5763
height={height}
5864
stroke={childType === 'COMP' ? this.getComponentColor(childComponentId) : '#000000'}
5965
fillPatternImage={imageSource ? this.setImage(imageSource) : null}
66+
fillPatternScaleX={0.1}
67+
fillPatternScaleY={0.1}
6068
// fill={color}
6169
// opacity={0.8}
62-
strokeWidth={4}
70+
strokeWidth={10}
6371
strokeScaleEnabled={false}
6472
draggable={false}
73+
// centerScaling={true}
74+
// enabledAnchors={['top-left', 'top-right', 'bottom-left', 'bottom-right']}
6575
/>
6676
{childType === 'COMP' &&
6777
components

src/containers/MainContainer.tsx

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -93,70 +93,6 @@ class MainContainer extends Component {
9393

9494
constructor(props) {
9595
super(props);
96-
97-
// IPC.on('new-file', (event, file) => {
98-
// const image = new window.Image();
99-
// image.src = file;
100-
// this.props.changeImagePath(file);
101-
// image.onload = () => {
102-
// this.setState({ image });
103-
// };
104-
// this.draggableItems = [];
105-
// });
106-
107-
// IPC.on('app_dir_selected', (event, path) => {
108-
// const { components } = this.props;
109-
// const { genOption } = this.state;
110-
// this.props.createApp({
111-
// path,
112-
// components,
113-
// genOption,
114-
// });
115-
// });
116-
// }
117-
118-
// closeModal = () => this.setState({ modal: null });
119-
120-
// chooseAppDir = () => IPC.send('choose_app_dir');
121-
122-
// chooseGenOptions = (genOption) => {
123-
// // set option
124-
// this.setState({ genOption });
125-
// // closeModal
126-
// this.closeModal();
127-
// // Choose app dir
128-
// this.chooseAppDir();
129-
// };
130-
131-
// showGenerateAppModal = () => {
132-
// console.log('clicked on export button');
133-
// const { closeModal, chooseGenOptions } = this;
134-
// const { genOptions } = this.state;
135-
// const children = (
136-
// <List className="export-preference">
137-
// {genOptions.map((option, i) => (
138-
// <ListItem
139-
// key={i}
140-
// button
141-
// onClick={() => chooseGenOptions(i)}
142-
// style={{
143-
// border: '1px solid #3f51b5',
144-
// marginBottom: '2%',
145-
// marginTop: '5%',
146-
// }}
147-
// >
148-
// <ListItemText primary={option} style={{ textAlign: 'center' }} />
149-
// </ListItem>
150-
// ))}
151-
// </List>
152-
// );
153-
// this.setState({
154-
// modal: createModal({
155-
// closeModal,
156-
// children,
157-
// message: 'Choose export preference:',
158-
// }),
159-
// });
16096
}
16197

16298
render() {

0 commit comments

Comments
 (0)