Compare commits
2 Commits
f3638d918d
...
4e92d717d5
Author | SHA1 | Date | |
---|---|---|---|
4e92d717d5 | |||
8c25b953b5 |
@ -19,7 +19,10 @@ def delete(user, id):
|
|||||||
|
|
||||||
def get(user, id):
|
def get(user, id):
|
||||||
db = database.get_db()
|
db = database.get_db()
|
||||||
return db.objects.find_one(ObjectId(id))
|
obj = db.objects.find_one(ObjectId(id))
|
||||||
|
if not obj:
|
||||||
|
raise util.errors.NotFound('Object not found')
|
||||||
|
return obj
|
||||||
|
|
||||||
def copy_to_project(user, id, project_id):
|
def copy_to_project(user, id, project_id):
|
||||||
db = database.get_db()
|
db = database.get_db()
|
||||||
|
@ -227,7 +227,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
return aDate < bDate;
|
return aDate < bDate;
|
||||||
});
|
});
|
||||||
const user = state.users.users.filter(u => state.auth.currentUserId === u._id)[0];
|
const user = state.users.users.filter(u => state.auth.currentUserId === u._id)[0];
|
||||||
const myProjects = state.projects.projects.filter(p => p.owner && p.owner.username === user.username);
|
const myProjects = state.projects.projects.filter(p => p.owner?.username === user?.username);
|
||||||
return { user, myProjects, project, objects, fullProjectPath: `${username}/${projectPath}`, object, comments };
|
return { user, myProjects, project, objects, fullProjectPath: `${username}/${projectPath}`, object, comments };
|
||||||
};
|
};
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
@ -59,6 +59,7 @@ class DraftPreview extends Component {
|
|||||||
const weftColourwayCanvas = document.querySelector(`.preview-${id} .weft-colourway`);
|
const weftColourwayCanvas = document.querySelector(`.preview-${id} .weft-colourway`);
|
||||||
const drawdownCanvas = document.querySelector(`.preview-${id} .drawdown`);
|
const drawdownCanvas = document.querySelector(`.preview-${id} .drawdown`);
|
||||||
const tieupsCanvas = document.querySelector(`.preview-${id} .tieups`);
|
const tieupsCanvas = document.querySelector(`.preview-${id} .tieups`);
|
||||||
|
if (warpCanvas) {
|
||||||
ctx.drawImage(warpColourwayCanvas, canvas.width - warpCanvas.width - weft.treadles * baseSize - 20, 0);
|
ctx.drawImage(warpColourwayCanvas, canvas.width - warpCanvas.width - weft.treadles * baseSize - 20, 0);
|
||||||
ctx.drawImage(warpCanvas, canvas.width - warpCanvas.width - weft.treadles * baseSize - 20, 10);
|
ctx.drawImage(warpCanvas, canvas.width - warpCanvas.width - weft.treadles * baseSize - 20, 10);
|
||||||
ctx.drawImage(weftCanvas, canvas.width - 10 - weft.treadles * baseSize, warp.shafts * baseSize + 20);
|
ctx.drawImage(weftCanvas, canvas.width - 10 - weft.treadles * baseSize, warp.shafts * baseSize + 20);
|
||||||
@ -67,6 +68,7 @@ class DraftPreview extends Component {
|
|||||||
ctx.drawImage(drawdownCanvas, canvas.width - drawdownCanvas.width - weft.treadles * baseSize - 20, warp.shafts * baseSize + 20);
|
ctx.drawImage(drawdownCanvas, canvas.width - drawdownCanvas.width - weft.treadles * baseSize - 20, warp.shafts * baseSize + 20);
|
||||||
|
|
||||||
this.props.onImageLoaded(canvas.toDataURL());
|
this.props.onImageLoaded(canvas.toDataURL());
|
||||||
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,10 @@ class Tieups extends Component {
|
|||||||
const tieups = Object.assign([], this.props.tieups);
|
const tieups = Object.assign([], this.props.tieups);
|
||||||
|
|
||||||
if (tieup >= tieups.length) this.fillUpTo(tieups, tieup);
|
if (tieup >= tieups.length) this.fillUpTo(tieups, tieup);
|
||||||
if (tieups[tieup] && tieups[tieup].indexOf(shaft) === -1) tieups[tieup].push(shaft);
|
if (tieups[tieup] !== undefined) {
|
||||||
|
if (tieups[tieup].indexOf(shaft) === -1) tieups[tieup].push(shaft);
|
||||||
else tieups[tieup].splice(tieups[tieup].indexOf(shaft));
|
else tieups[tieup].splice(tieups[tieup].indexOf(shaft));
|
||||||
|
}
|
||||||
this.props.updatePattern({ tieups });
|
this.props.updatePattern({ tieups });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user