特殊形状更改宽高重新计算内部内容
This commit is contained in:
@@ -3,6 +3,7 @@ import { fabric } from 'fabric-with-all'
|
||||
import { createId } from '../../tools/tools'
|
||||
import { exportObjectsToImage, exportObjectToThumbnail } from '../tools/exportMethod'
|
||||
import { OperationType } from '../tools/layerHelper'
|
||||
import { getArrowPath, getLinePath, cloneObjects, getStarArr } from '../tools/canvasMethod'
|
||||
|
||||
export const FillSourceToBase64 = (source) => {
|
||||
if (source?.toDataURL) {
|
||||
@@ -215,6 +216,21 @@ export class ObjectManager {
|
||||
async updateProperty(id: string, options: any, isRecord: boolean) {
|
||||
const object = this.canvasManager.getObjectById(id)
|
||||
if (!object) return null
|
||||
const type = object.type
|
||||
const isWidth = object.hasOwnProperty('width')
|
||||
const isHeight = object.hasOwnProperty('height')
|
||||
if (isWidth || isHeight) {
|
||||
let width = options.width
|
||||
let height = options.height
|
||||
if (type === "polygon") {
|
||||
if (object.points.length === 10) {// 五角星
|
||||
options.points = getStarArr(width, height)
|
||||
}
|
||||
} else if (type === "ellipse") {// 椭圆
|
||||
options.rx = width / 2
|
||||
options.ry = height / 2
|
||||
}
|
||||
}
|
||||
object.set(options);
|
||||
this.canvasManager.renderAll()
|
||||
if (isRecord) {
|
||||
|
||||
Reference in New Issue
Block a user