前端转vue
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getShapeStyleUtil.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. export const getShapeStyleFuction = (style, properties) => {
  2. if (properties.fill) {
  3. style.fill = properties.fill
  4. }
  5. // if (properties.gradientColor && style.fill !== properties.gradientColor) {
  6. // style.fillGradient = properties.gradientColor
  7. // }
  8. if (properties.stroke) {
  9. style.stroke = properties.stroke
  10. }
  11. if (properties.strokeWidth) {
  12. style.strokeWidth = properties.strokeWidth
  13. }
  14. // if (properties.borderStyle) {
  15. // if (properties.borderStyle === 'solid') {
  16. // style.strokeDashArray = '0'
  17. // // nodeResize里的bug导致的,array小写了
  18. // style.strokeDasharray = '0'
  19. // }
  20. // if (properties.borderStyle === 'dashed') {
  21. // style.strokeDashArray = '3 3'
  22. // style.strokeDasharray = '3 3'
  23. // }
  24. // if (properties.borderStyle === 'dotted') {
  25. // style.strokeDashArray = '1 1'
  26. // style.strokeDasharray = '1 1'
  27. // }
  28. // if (properties.borderStyle === 'hidden') {
  29. // style.stroke = style.fill
  30. // }
  31. // }
  32. return style
  33. }
  34. export const getTextStyleFunction = (style = {}, properties) => {
  35. if (properties.fontColor) {
  36. style.color = properties.fontColor
  37. }
  38. if (properties.fontSize) {
  39. style.fontSize = properties.fontSize
  40. }
  41. if (properties.fontFamily) {
  42. style.fontFamily = properties.fontFamily
  43. }
  44. if (properties.lineHeight) {
  45. style.lineHeight = properties.lineHeight
  46. }
  47. if (properties.textAlign) {
  48. style.textAlign = properties.textAlign
  49. }
  50. if (properties.fontWeight) {
  51. style.fontWeight = properties.fontWeight
  52. }
  53. if (properties.textDecoration) {
  54. style.textDecoration = properties.textDecoration
  55. }
  56. if (properties.fontStyle) {
  57. style.fontStyle = properties.fontStyle
  58. }
  59. return style
  60. }