В моем предыдущем проекте я использовал версию ткани 1.7.9. Сейчас я обновляю свой проект последней версией ткани, т.е. 2.7.0. Моя проблема в моем предыдущем проекте, я включил файл fabric.curvedText.js и работал нормально. я попытался использовать ту же библиотеку в моей текущей версии (так как я не смог найти другую библиотеку для конкретной версии фабрики), он говорит неопределенное свойство "backgroundColor" неопределенного в объекте DelegatedProperties. может кто-нибудь помочь мне с этим
Я получаю сообщение об ошибке по двум причинам: 1. DelegatedProperties и 2. CreateAccessors. поэтому я попытался добавить эти две вещи из моего предыдущего файла библиотеки ткани. Он успешно добавляет изогнутый текст, но когда я пытаюсь выделить его, поведение очень странное, текст и обработчики находятся в разных позициях.
следующий код, который я добавил в файл Fabric 2.7.0:
delegatedProperties: {
fill: true,
stroke: true,
strokeWidth: true,
fontFamily: true,
fontWeight: true,
fontSize: true,
fontStyle: true,
lineHeight: true,
textDecoration: true,
textAlign: true,
backgroundColor: true
},
и функция createAccessors в fabric.util =
createAccessors: function(klass) {
var proto = klass.prototype, i, propName,
capitalizedPropName, setterName, getterName;
for (i = proto.stateProperties.length; i--; ) {
propName = proto.stateProperties[i];
capitalizedPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
setterName = 'set' + capitalizedPropName;
getterName = 'get' + capitalizedPropName;
// using `new Function` for better introspection
if (!proto[getterName]) {
proto[getterName] = (function(property) {
return new Function('return this.get("' + property + '")');
})(propName);
}
if (!proto[setterName]) {
proto[setterName] = (function(property) {
return new Function('value', 'return this.set("' + property + '", value)');
})(propName);
}
}
},
и вот как я добавляю ткань curvedText:
let curvedTextObj = new fabric.CurvedText("Hello World", {
left: 100,
top: 100,
textAlign: 'center',
radius: 150,
fontSize: 20,
spacing: 20
};
this.canvas.add(curvedTextObj);
this.canvas.renderAll();
at first Hello World is addedd successfully with proper position in canvas. but as soon as i select the same handlers and text object is displayed at opposite/different positions in canvas. can anyone please help me out with this problem.