model.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package model
  2. type State struct {
  3. FontSize float64 `json:"fontSize"`
  4. DragStrokeStyle string `json:"dragStrokeStyle"`
  5. ShowGrid bool `json:"showGrid"`
  6. StrokeStyle string `json:"strokeStyle"`
  7. BackgroundColor string `json:"backgroundColor"`
  8. GridConfig GridConfig `json:"gridConfig"`
  9. ScrollY float64 `json:"scrollY"`
  10. FillStyle string `json:"fillStyle"`
  11. Readonly bool `json:"readonly"`
  12. Scale float64 `json:"scale"`
  13. ScrollStep float64 `json:"scrollStep"`
  14. FontFamily string `json:"fontFamily"`
  15. ScrollX float64 `json:"scrollX"`
  16. }
  17. type GridConfig struct {
  18. Size float64 `json:"size"`
  19. StrokeStyle string `json:"strokeStyle"`
  20. LineWidth float64 `json:"lineWidth"`
  21. }
  22. type Element struct {
  23. GroupId string `json:"groupId"`
  24. Type string `json:"type"`
  25. Width float64 `json:"width"`
  26. Height float64 `json:"height"`
  27. X float64 `json:"x"`
  28. Y float64 `json:"y"`
  29. Rotate float64 `json:"rotate"`
  30. Style ElementStyle `json:"style"`
  31. }
  32. type ElementStyle struct {
  33. StrokeStyle string `json:"strokeStyle"`
  34. FillStyle string `json:"fillStyle"`
  35. LineWidth float64 `json:"lineWidth"`
  36. LineDash float64 `json:"lineDash"`
  37. GlobalAlpha float64 `json:"globalAlpha"`
  38. }
  39. type Data struct {
  40. State State `json:"state"`
  41. Elements []Element `json:"elements"`
  42. }
  43. type Root struct {
  44. Type bool `json:"type"`
  45. Data Data `json:"data"`
  46. }