Skip to content

Commit b09f005

Browse files
spincycle01ChristianEdwardPadilla
authored andcommitted
currently working on preventing image tiling
1 parent 6d9aafd commit b09f005

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
@@ -71,70 +71,6 @@ class MainContainer extends Component {
7171

7272
constructor(props) {
7373
super(props);
74-
75-
// IPC.on('new-file', (event, file) => {
76-
// const image = new window.Image();
77-
// image.src = file;
78-
// this.props.changeImagePath(file);
79-
// image.onload = () => {
80-
// this.setState({ image });
81-
// };
82-
// this.draggableItems = [];
83-
// });
84-
85-
// IPC.on('app_dir_selected', (event, path) => {
86-
// const { components } = this.props;
87-
// const { genOption } = this.state;
88-
// this.props.createApp({
89-
// path,
90-
// components,
91-
// genOption,
92-
// });
93-
// });
94-
// }
95-
96-
// closeModal = () => this.setState({ modal: null });
97-
98-
// chooseAppDir = () => IPC.send('choose_app_dir');
99-
100-
// chooseGenOptions = (genOption) => {
101-
// // set option
102-
// this.setState({ genOption });
103-
// // closeModal
104-
// this.closeModal();
105-
// // Choose app dir
106-
// this.chooseAppDir();
107-
// };
108-
109-
// showGenerateAppModal = () => {
110-
// console.log('clicked on export button');
111-
// const { closeModal, chooseGenOptions } = this;
112-
// const { genOptions } = this.state;
113-
// const children = (
114-
// <List className="export-preference">
115-
// {genOptions.map((option, i) => (
116-
// <ListItem
117-
// key={i}
118-
// button
119-
// onClick={() => chooseGenOptions(i)}
120-
// style={{
121-
// border: '1px solid #3f51b5',
122-
// marginBottom: '2%',
123-
// marginTop: '5%',
124-
// }}
125-
// >
126-
// <ListItemText primary={option} style={{ textAlign: 'center' }} />
127-
// </ListItem>
128-
// ))}
129-
// </List>
130-
// );
131-
// this.setState({
132-
// modal: createModal({
133-
// closeModal,
134-
// children,
135-
// message: 'Choose export preference:',
136-
// }),
137-
// });
13874
}
13975

14076
render() {

0 commit comments

Comments
 (0)