The property works great, but due to the way I was creating the text layer the name was still changing before I could set the nameIsFixed
. Found out the order of the text properties are important when passing in a variable for the text string. Initially I had:
var contrastText = new Text({
parent: contrastArtboard,
frame: new Rectangle(40,108, 560,1029),
fixedWidth:true,
name: 'contrast_report_text',
text: contrastReportCardText,
setNameIsFixed: true,
style: {
fontFamily: 'Roboto',
lineHeight: 21,
fontSize: 12,
textColor:doc.swatches[bodyTextPrimary].referencingColor,
fills:[],
borders:[]
}
})
contrastText.sketchObject.nameIsFixed = true
The layer name was still getting changed. Which was odd because it didn't have this issue with my other simplified example that had a static text string. The simple fix was to move the name
property below the text
:
var contrastText = new Text({
parent: contrastArtboard,
frame: new Rectangle(40,108, 560,1029),
fixedWidth:true,
text: contrastReportCardText,
name: 'contrast_report_text',
setNameIsFixed: true,
style: {
fontFamily: 'Roboto',
lineHeight: 21,
fontSize: 12,
textColor:doc.swatches[bodyTextPrimary].referencingColor,
fills:[],
borders:[]
}
})
contrastText.sketchObject.nameIsFixed = true
Thank you!