Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Draw straight line will can not be copied (#734) #851

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/image-editor/createConfigVariable.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-sync */
const fs = require('fs');
const path = require('path');
const config = require(path.resolve(__dirname, 'tuidoc.config.json'));
Expand Down
1 change: 1 addition & 0 deletions apps/image-editor/src/js/component/cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class Cropper extends Component {
* @returns {{left: number, top: number, width: number, height: number}}
* @private
*/
// eslint-disable-next-line complexity
_calcRectDimensionFromPoint(x, y, presetRatio = null) {
const canvas = this.getCanvas();
const canvasWidth = canvas.getWidth();
Expand Down
1 change: 1 addition & 0 deletions apps/image-editor/src/js/extension/cropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ const Cropzone = fabric.util.createClass(
* @returns {{width: number, height: number}}
* @private
*/
// eslint-disable-next-line complexity
adjustRatioCropzoneSize({ width, height, leftMaker, topMaker, maxWidth, maxHeight, scaleTo }) {
width = maxWidth ? clamp(width, 1, maxWidth) : width;
height = maxHeight ? clamp(height, 1, maxHeight) : height;
Expand Down
17 changes: 9 additions & 8 deletions apps/image-editor/src/js/graphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -1481,15 +1481,16 @@ class Graphics {
* @private
*/
_copyFabricObject(targetObject) {
return new Promise((resolve) => {
targetObject.clone((cloned) => {
const shapeComp = this.getComponent(components.SHAPE);
if (isShape(cloned)) {
shapeComp.processForCopiedObject(cloned, targetObject);
}
// delete __fe_id so that new created object had not conflict and create new __fe_id for that
if (targetObject.__fe_id) delete targetObject.__fe_id;

resolve(cloned);
});
return new Promise((resolve) => {
const cloned = fabric.util.object.clone(targetObject);
const shapeComp = this.getComponent(components.SHAPE);
if (isShape(cloned)) {
shapeComp.processForCopiedObject(cloned, targetObject);
}
resolve(cloned);
});
}

Expand Down