Skip to content

Commit

Permalink
更新导出图片
Browse files Browse the repository at this point in the history
  • Loading branch information
more-strive committed Dec 3, 2023
1 parent d9b3542 commit d0a8ec3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/extension/object/CropImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { croppingControlSet, flipXCropControls, flipXYCropControls, flipYCropCon
import { Image, Point, Path, Object as FabricObject, config, util, classRegistry, TPointerEventInfo, TPointerEvent, ImageProps, TClassProperties, ImageSource } from 'fabric'




export class CropImage extends Image {
public isCropping?: false
public cropKey?: ClipPathType
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/useHandleCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import { RightStates, ElementNames } from '@/types/elements'
import { nanoid } from 'nanoid'
import { QRCodeElement, PolygonElement, QRCodeOption, CanvasElement } from '@/types/canvas'
import { getImageSize } from '@/utils/image'
import { classRegistry } from 'fabric'
import JsBarcode from 'jsbarcode'
import { Object as FabricObject, Textbox, Path } from "fabric"
import { Object as FabricObject, Textbox, Path, classRegistry, Image } from "fabric"
import { CropImage } from '@/extension/object/CropImage'
import useCenter from '@/views/Canvas/useCenter'
import useCanvas from '@/views/Canvas/useCanvas'
import useCanvasZindex from './useCanvasZindex'



export default () => {

const mainStore = useMainStore()
Expand Down Expand Up @@ -163,7 +162,7 @@ export default () => {
else if (height > currentTemplateHeight.value) {
imageScale = currentTemplateHeight.value / height
}
const CropImage = classRegistry.getClass('CropImage')
// const CropImage = classRegistry.getClass('CropImage') as CropImage
const imageElement = await CropImage.fromURL(url, {
id: nanoid(10),
angle: 0,
Expand All @@ -178,7 +177,8 @@ export default () => {
originY: 'center',
borderColor: '#ff8d23',
type: 'CropImage',
name: ElementNames.IMAGE
name: ElementNames.IMAGE,
crossOrigin: 'anonymous'
})
renderCanvas(imageElement)
})
Expand Down

0 comments on commit d0a8ec3

Please sign in to comment.