Draw.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. import { floorplanService } from '../Service/FloorplanService.js'
  2. import { stateService } from '../Service/StateService.js'
  3. import { coordinate } from '../Coordinate.js'
  4. import Style from '../Style.js'
  5. import VectorType from '../enum/VectorType.js'
  6. import SelectState from '../enum/SelectState.js'
  7. import { mathUtil } from '../MathUtil.js'
  8. import ElementEvents from '../enum/ElementEvents.js'
  9. import Constant from '../Constant.js'
  10. import { signService } from '../Service/SignService.js'
  11. export default class Draw {
  12. constructor() {
  13. this.context = null
  14. }
  15. initContext(canvas) {
  16. if (canvas) {
  17. this.context = canvas.getContext('2d')
  18. } else {
  19. this.context = null
  20. }
  21. }
  22. clear() {
  23. this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height)
  24. }
  25. drawBackGround(color) {
  26. this.context.save()
  27. this.context.fillStyle = color
  28. this.context.fillRect(0, 0, this.context.canvas.width, this.context.canvas.height)
  29. this.context.restore()
  30. }
  31. // setSVGAttr(svgId,width,height){
  32. // }
  33. drawWall(vector) {
  34. let start = floorplanService.getPoint(vector.start)
  35. let end = floorplanService.getPoint(vector.end)
  36. let points = []
  37. points.push(start)
  38. points.push(end)
  39. points = points.sort(sortNumber.bind(this))
  40. function sortNumber(a, b) {
  41. return mathUtil.getDistance(start, a) - mathUtil.getDistance(start, b)
  42. }
  43. this.context.save()
  44. this.context.beginPath()
  45. this.context.lineCap = 'round' //线段端点的样式
  46. //this.context.lineJoin= 'miter';
  47. this.context.strokeStyle = Style.Wall.strokeStyle
  48. this.context.lineWidth = Style.Wall.lineWidth * coordinate.ratio
  49. this.context.strokeStyle = Style.Wall.strokeStyle
  50. const selectItem = stateService.getSelectItem()
  51. const draggingItem = stateService.getDraggingItem()
  52. const focusItem = stateService.getFocusItem()
  53. if (selectItem && selectItem.type == VectorType.Wall) {
  54. if (vector.vectorId == selectItem.vectorId) {
  55. this.context.strokeStyle = Style.Select.Wall.strokeStyle
  56. }
  57. } else if (draggingItem && draggingItem.type == VectorType.Wall) {
  58. if (vector.vectorId == draggingItem.vectorId) {
  59. this.context.strokeStyle = Style.Select.Wall.strokeStyle
  60. }
  61. }
  62. if (focusItem && focusItem.type == VectorType.Wall) {
  63. if (vector.vectorId == focusItem.vectorId) {
  64. this.context.strokeStyle = Style.Focus.Wall.strokeStyle
  65. }
  66. }
  67. for (let i = 0; i < points.length - 1; i += 2) {
  68. let point1 = coordinate.getScreenXY(points[i])
  69. let point2 = coordinate.getScreenXY(points[i + 1])
  70. this.context.moveTo(point1.x, point1.y)
  71. this.context.lineTo(point2.x, point2.y)
  72. }
  73. this.context.stroke()
  74. this.context.restore()
  75. }
  76. drawSpecialPoint() {
  77. const selectItem = stateService.getSelectItem()
  78. const draggingItem = stateService.getDraggingItem()
  79. const focusItem = stateService.getFocusItem()
  80. let point = null
  81. this.context.save()
  82. if (selectItem) {
  83. point = floorplanService.getPoint(selectItem.vectorId)
  84. this.context.lineWidth = Style.Select.Point.lineWidth * coordinate.ratio
  85. this.context.strokeStyle = Style.Select.Point.strokeStyle
  86. this.context.fillStyle = Style.Select.Point.fillStyle
  87. }
  88. if (draggingItem) {
  89. point = floorplanService.getPoint(draggingItem.vectorId)
  90. this.context.lineWidth = Style.Select.Point.lineWidth * coordinate.ratio
  91. this.context.strokeStyle = Style.Select.Point.strokeStyle
  92. this.context.fillStyle = Style.Select.Point.fillStyle
  93. }
  94. if (focusItem) {
  95. point = floorplanService.getPoint(focusItem.vectorId)
  96. this.context.lineWidth = Style.Focus.Point.lineWidth * coordinate.ratio
  97. this.context.strokeStyle = Style.Focus.Point.strokeStyle
  98. this.context.fillStyle = Style.Focus.Point.fillStyle
  99. }
  100. if (point == null) {
  101. this.context.restore()
  102. return
  103. }
  104. const pt = coordinate.getScreenXY({ x: point.x, y: point.y })
  105. let radius = Style.Point.radius
  106. this.context.beginPath()
  107. this.context.arc(pt.x, pt.y, radius * coordinate.ratio, 0, Math.PI * 2, true)
  108. this.context.stroke()
  109. this.context.fill()
  110. this.context.restore()
  111. }
  112. drawPoint(vector) {
  113. const pt = coordinate.getScreenXY({ x: vector.x, y: vector.y })
  114. const selectItem = stateService.getSelectItem()
  115. const draggingItem = stateService.getDraggingItem()
  116. const focusItem = stateService.getFocusItem()
  117. // this.context.save()
  118. // this.context.lineWidth = Style.Point.lineWidth * coordinate.ratio
  119. // this.context.strokeStyle = Style.Point.strokeStyle
  120. // this.context.fillStyle = Style.Point.fillStyle
  121. let radius = Style.Point.radius
  122. if (
  123. (draggingItem && draggingItem.type == VectorType.WallCorner && vector.vectorId == draggingItem.vectorId) ||
  124. (selectItem && selectItem.type == VectorType.WallCorner && vector.vectorId == selectItem.vectorId)
  125. ) {
  126. this.context.save()
  127. this.context.lineWidth = Style.Select.Point.lineWidth * coordinate.ratio
  128. this.context.strokeStyle = Style.Select.Point.strokeStyle
  129. this.context.fillStyle = Style.Select.Point.fillStyle
  130. radius = Style.Select.Point.radius
  131. } else if (focusItem && focusItem.type == VectorType.WallCorner && vector.vectorId == focusItem.vectorId) {
  132. this.context.save()
  133. this.context.lineWidth = Style.Focus.Point.lineWidth * coordinate.ratio
  134. this.context.strokeStyle = Style.Focus.Point.strokeStyle
  135. this.context.fillStyle = Style.Focus.Point.fillStyle
  136. radius = Style.Focus.Point.radius
  137. } else {
  138. return
  139. }
  140. this.context.beginPath()
  141. this.context.arc(pt.x, pt.y, radius * coordinate.ratio, 0, Math.PI * 2, true)
  142. this.context.stroke()
  143. this.context.fill()
  144. this.context.restore()
  145. // this.drawText({ x: vector.x, y: vector.y }, vector.vectorId)
  146. }
  147. // 文字
  148. drawText(position, txt, screenCoord, angle) {
  149. this.context.save()
  150. this.setCanvasStyle(Style.Font)
  151. if (coordinate.ratio == Constant.ratio) {
  152. this.context.font = '36px Microsoft YaHei'
  153. } else {
  154. this.context.font = '12px Microsoft YaHei'
  155. }
  156. let pt = { x: position.x, y: position.y }
  157. if (!screenCoord) {
  158. pt = coordinate.getScreenXY({ x: position.x, y: position.y })
  159. }
  160. if (angle) {
  161. this.context.translate(pt.x, pt.y)
  162. this.context.rotate(angle)
  163. //this.context.strokeText(txt, 0, 0)
  164. this.context.fillText(txt, 0, 0)
  165. } else {
  166. //this.context.strokeText(txt, pt.x, pt.y)
  167. this.context.fillText(txt, pt.x, pt.y)
  168. }
  169. this.context.restore()
  170. }
  171. drawTag(geometry, styleType, hide) {
  172. this.context.save()
  173. this.context.lineWidth = Style.Tag.lineWidth * coordinate.ratio
  174. this.context.strokeStyle = Style.Tag.strokeStyle
  175. this.context.fillStyle = Style.Tag.fillStyle
  176. if (styleType) {
  177. if (styleType == 'style-1') {
  178. this.context.lineWidth = Style.DownLoad.style1.Tag.lineWidth * coordinate.ratio
  179. this.context.strokeStyle = Style.DownLoad.style1.Tag.strokeStyle
  180. this.context.fillStyle = Style.DownLoad.style1.Tag.fillStyle
  181. } else if (styleType == 'style-2') {
  182. this.context.lineWidth = Style.DownLoad.style2.Tag.lineWidth * coordinate.ratio
  183. this.context.strokeStyle = Style.DownLoad.style2.Tag.strokeStyle
  184. this.context.fillStyle = Style.DownLoad.style2.Tag.fillStyle
  185. } else if (styleType == 'style-3') {
  186. this.context.lineWidth = Style.DownLoad.style3.Tag.lineWidth * coordinate.ratio
  187. this.context.strokeStyle = Style.DownLoad.style3.Tag.strokeStyle
  188. this.context.fillStyle = Style.DownLoad.style3.Tag.fillStyle
  189. } else if (styleType == 'style-4') {
  190. this.context.lineWidth = Style.DownLoad.style4.Tag.lineWidth * coordinate.ratio
  191. this.context.strokeStyle = Style.DownLoad.style4.Tag.strokeStyle
  192. this.context.fillStyle = Style.DownLoad.style4.Tag.fillStyle
  193. }
  194. } else {
  195. const selectItem = stateService.getSelectItem()
  196. const draggingItem = stateService.getDraggingItem()
  197. const focusItem = stateService.getFocusItem()
  198. if (selectItem && selectItem.type == VectorType.Tag) {
  199. if (geometry.vectorId == selectItem.vectorId) {
  200. this.context.strokeStyle = Style.Select.Tag.strokeStyle
  201. this.context.fillStyle = Style.Select.Tag.fillStyle
  202. }
  203. } else if (draggingItem && draggingItem.type == VectorType.Tag) {
  204. if (geometry.vectorId == draggingItem.vectorId) {
  205. this.context.strokeStyle = Style.Select.Tag.strokeStyle
  206. this.context.fillStyle = Style.Select.Tag.fillStyle
  207. }
  208. }
  209. if (focusItem && focusItem.type == VectorType.Tag) {
  210. if (geometry.vectorId == focusItem.vectorId) {
  211. this.context.strokeStyle = Style.Focus.Tag.strokeStyle
  212. this.context.fillStyle = Style.Focus.Tag.fillStyle
  213. }
  214. }
  215. }
  216. //正在添加
  217. if (geometry.adding) {
  218. let points2d = geometry.points2d
  219. let points = []
  220. for (let i = 0; i < points2d.length; ++i) {
  221. points[i] = coordinate.getScreenXY({ x: points2d[i].x, y: points2d[i].y })
  222. }
  223. this.context.strokeStyle = Style.Tag.strokeStyle_adding
  224. this.context.fillStyle = Style.Tag.fillStyle_adding
  225. this.context.beginPath()
  226. this.context.moveTo(points[0].x, points[0].y)
  227. this.context.lineTo(points[1].x, points[1].y)
  228. this.context.lineTo(points[2].x, points[2].y)
  229. this.context.lineTo(points[3].x, points[3].y)
  230. this.context.closePath()
  231. this.context.stroke()
  232. for (let i = 4; i < points.length - 1; i += 2) {
  233. this.context.moveTo(points[i].x, points[i].y)
  234. this.context.lineTo(points[i + 1].x, points[i + 1].y)
  235. }
  236. this.context.stroke()
  237. } else {
  238. const fontSize = coordinate.ratio == Constant.ratio ? 36 : 12
  239. this.context.font = `400 ${fontSize}px Microsoft YaHei`
  240. //根据文字的长度,更新标注范围
  241. let title = geometry.title
  242. if (!hide && (title == null || title.trim() == '')) {
  243. console.log(floorplanService.$app.config)
  244. // title = '请输入名称'
  245. title = floorplanService.$app.config.i18n('cad.input')
  246. }
  247. geometry.des += ''
  248. if (geometry.des != '') {
  249. geometry.sideWidth = Math.max(this.context.measureText(title).width, this.context.measureText(parseFloat(geometry.des.replace(',', '')).toFixed(2)).width)
  250. geometry.setPoints2d()
  251. }
  252. let points2d = geometry.points2d
  253. let points = []
  254. for (let i = 0; i < points2d.length; ++i) {
  255. points[i] = coordinate.getScreenXY({ x: points2d[i].x, y: points2d[i].y })
  256. }
  257. let pt = { x: geometry.center.x, y: geometry.center.y }
  258. pt = coordinate.getScreenXY({ x: geometry.center.x, y: geometry.center.y })
  259. const fontWidth1 = this.context.measureText(title).width
  260. const line1 = mathUtil.createLine1({ x: (points[0].x + points[3].x) / 2, y: (points[0].y + points[3].y) / 2 }, { x: (points[2].x + points[1].x) / 2, y: (points[2].y + points[1].y) / 2 })
  261. let fontWidth2 = this.context.measureText(geometry.des + 'm²').width
  262. if (geometry.des != '' && geometry.unit == 'ft') {
  263. fontWidth2 = this.context.measureText(parseFloat(geometry.des.replace(',', '')).toFixed(2) + 'ft²').width
  264. }
  265. const line2 = mathUtil.createLine1(points[2], points[3])
  266. const fontStart1 = mathUtil.getDisPointsLine(line1, pt, fontWidth1 / 2, fontWidth1 / 2)
  267. const fontStart2 = mathUtil.getDisPointsLine(line2, { x: (points[2].x + points[3].x) / 2, y: (points[2].y + points[3].y) / 2 }, fontWidth2 / 2, fontWidth2 / 2)
  268. if (fontStart1.newpoint1.x < fontStart1.newpoint2.x) {
  269. this.context.fillText(title, fontStart1.newpoint1.x, fontStart1.newpoint1.y)
  270. } else {
  271. this.context.fillText(title, fontStart1.newpoint2.x, fontStart1.newpoint2.y)
  272. }
  273. }
  274. this.context.restore()
  275. }
  276. // drawFurniture2(geometry) {
  277. // // //this.app.store.getAppImage(`images/cad/signs/${this.uiControl.selectUI}.svg`).then(img => {})
  278. // // var img = new Image()
  279. // // // img.src = 'chart.svg';
  280. // // // if(geometry.geoType == ''){
  281. // // // img.src = '';
  282. // // // }
  283. // // document.body.appendChild(img)
  284. // // img.onload = function () {
  285. // // var width = img.clientWidth * 1.5
  286. // // var height = img.clientHeight * 1.5
  287. // // var x = 2
  288. // // var y = 2
  289. // // this.context.drawImage(img, x, y, width, height)
  290. // // }
  291. // this.context.save()
  292. // let imgWidth = geometry.sideLength * coordinate.res*50
  293. // let imgHeight = geometry.sideLength * coordinate.res*50
  294. // const pt = coordinate.getScreenXY({
  295. // x: geometry.center.x - geometry.sideLength *50/ 2,
  296. // y: geometry.center.y + geometry.sideLength *50/ 2,
  297. // })
  298. // // signService.getSign(geometry.geoType).then(img => {
  299. // // this.context.drawImage(img, pt.x, pt.y, imgWidth, imgHeight)
  300. // // })
  301. // let img = signService.getSign(geometry.geoType)
  302. // this.context.drawImage(img, pt.x, pt.y, imgWidth, imgHeight)
  303. // this.context.restore()
  304. // }
  305. drawCircle(element) {
  306. let radius = null
  307. const twoPi = Math.PI * 2
  308. const pt = coordinate.getScreenXY(element)
  309. this.context.save()
  310. if (element.name == ElementEvents.StartAddWall) {
  311. radius = Style.Element.StartAddWall.radius * coordinate.ratio
  312. this.context.strokeStyle = Style.Element.StartAddWall.strokeStyle
  313. this.context.fillStyle = Style.Element.StartAddWall.fillStyle
  314. }
  315. this.context.beginPath()
  316. this.context.arc(pt.x, pt.y, radius, 0, twoPi, true)
  317. this.context.stroke()
  318. this.context.fill()
  319. this.context.restore()
  320. }
  321. drawLine(element) {
  322. let start = coordinate.getScreenXY(element.start)
  323. let end = coordinate.getScreenXY(element.end)
  324. this.context.save()
  325. if (element.name == ElementEvents.VCheckLinesX) {
  326. this.context.lineWidth = Style.Element.VCheckLinesX.lineWidth * coordinate.ratio
  327. this.context.strokeStyle = Style.Element.VCheckLinesX.strokeStyle
  328. this.context.setLineDash([3, 2, 2])
  329. start.y = 0
  330. end.y = this.context.canvas.clientHeight
  331. } else if (element.name == ElementEvents.VCheckLinesY) {
  332. this.context.lineWidth = Style.Element.VCheckLinesY.lineWidth * coordinate.ratio
  333. this.context.strokeStyle = Style.Element.VCheckLinesY.strokeStyle
  334. this.context.setLineDash([3, 2, 2])
  335. start.x = 0
  336. end.x = this.context.canvas.clientWidth
  337. } else if (element.name == ElementEvents.NewWall) {
  338. this.context.lineWidth = Style.Element.NewWall.lineWidth * coordinate.ratio
  339. this.context.strokeStyle = Style.Element.NewWall.strokeStyle
  340. if (element.state == 'error') {
  341. this.context.strokeStyle = Style.Element.NewWall.errorStrokeStyle
  342. }
  343. } else if (element.name == ElementEvents.CheckLinesX) {
  344. this.context.lineWidth = Style.Element.CheckLinesX.lineWidth * coordinate.ratio
  345. this.context.strokeStyle = Style.Element.CheckLinesX.strokeStyle
  346. this.context.setLineDash([3, 2, 2])
  347. } else if (element.name == ElementEvents.CheckLinesY) {
  348. this.context.lineWidth = Style.Element.CheckLinesY.lineWidth * coordinate.ratio
  349. this.context.strokeStyle = Style.Element.CheckLinesY.strokeStyle
  350. this.context.setLineDash([3, 2, 2])
  351. }
  352. this.context.beginPath()
  353. this.context.moveTo(start.x, start.y)
  354. this.context.lineTo(end.x, end.y)
  355. this.context.stroke()
  356. this.context.restore()
  357. this.context.save()
  358. this.context.lineWidth = Style.Point.lineWidth * coordinate.ratio
  359. this.context.strokeStyle = Style.Point.strokeStyle
  360. this.context.fillStyle = Style.Point.fillStyle
  361. let radius = Style.Point.radius
  362. this.context.beginPath()
  363. this.context.arc(start.x, start.y, radius * coordinate.ratio, 0, Math.PI * 2, true)
  364. this.context.stroke()
  365. this.context.fill()
  366. this.context.restore()
  367. }
  368. setCanvasStyle(style) {
  369. for (const key in style) {
  370. if (key != 'isFill' && key != 'isStroke') {
  371. this.context[key] = style[key]
  372. }
  373. }
  374. }
  375. /*************************************************************************************家具**********************************************************************************************/
  376. drawSign(geometry) {
  377. // if (geometry.geoType == VectorType.Cigaret) {
  378. // this.drawCigaret(geometry)
  379. // } else if (geometry.geoType == VectorType.FirePoint) {
  380. // this.drawFirePoint(geometry)
  381. // } else if (geometry.geoType == VectorType.SingleSofa) {
  382. // this.drawSingleSofa(geometry)
  383. // } else if (geometry.geoType == VectorType.TeaTable) {
  384. // this.drawTeaTable(geometry)
  385. // } else if (geometry.geoType == VectorType.Carpet) {
  386. // this.drawCarpet(geometry)
  387. // } else if (geometry.geoType == VectorType.Plant) {
  388. // this.drawPlant(geometry)
  389. // } else if (geometry.geoType == VectorType.DiningTable) {
  390. // this.drawDiningTable(geometry)
  391. // } else if (geometry.geoType == VectorType.DoubleBed) {
  392. // this.drawDoubleBed(geometry)
  393. // } else if (geometry.geoType == VectorType.SingleBed) {
  394. // this.drawSingleBed(geometry)
  395. // } else if (geometry.geoType == VectorType.Wardrobe) {
  396. // this.drawWardrobe(geometry)
  397. // } else if (geometry.geoType == VectorType.Dresser) {
  398. // this.drawDresser(geometry)
  399. // } else if (geometry.geoType == VectorType.BedsideCupboard) {
  400. // this.drawBedsideCupboard(geometry)
  401. // } else if (geometry.geoType == VectorType.Pillow) {
  402. // this.drawPillow(geometry)
  403. // } else if (geometry.geoType == VectorType.GasStove) {
  404. // this.drawGasStove(geometry)
  405. // } else if (geometry.geoType == VectorType.Cupboard) {
  406. // this.drawCupboard(geometry)
  407. // } else if (geometry.geoType == VectorType.Bathtub) {
  408. // this.drawBathtub(geometry)
  409. // } else if (geometry.geoType == VectorType.Closestool) {
  410. // this.drawClosestool(geometry)
  411. // } else if (geometry.geoType == VectorType.Washstand) {
  412. // this.drawWashstand(geometry)
  413. // } else if (geometry.geoType == VectorType.Desk) {
  414. // this.drawDesk(geometry)
  415. // } else if (geometry.geoType == VectorType.BalconyChair) {
  416. // this.drawBalconyChair(geometry)
  417. // } else if (geometry.geoType == VectorType.Elevator) {
  418. // this.drawElevator(geometry)
  419. // }
  420. }
  421. /*
  422. drawTV(geometry) {
  423. const selectItem = stateService.getSelectItem()
  424. const draggingItem = stateService.getDraggingItem()
  425. const focusItem = stateService.getFocusItem()
  426. this.context.save()
  427. this.context.strokeStyle = Style.Furniture.strokeStyle
  428. this.context.fillStyle = Style.Furniture.fillStyle
  429. if (selectItem && selectItem.type == VectorType.TV) {
  430. if (geometry.vectorId == selectItem.vectorId) {
  431. this.context.strokeStyle = Style.Select.Furniture.strokeStyle
  432. this.context.fillStyle = Style.Select.Furniture.fillStyle
  433. }
  434. } else if (draggingItem && draggingItem.type == VectorType.TV) {
  435. if (geometry.vectorId == draggingItem.vectorId) {
  436. this.context.strokeStyle = Style.Select.Furniture.strokeStyle
  437. this.context.fillStyle = Style.Select.Furniture.fillStyle
  438. }
  439. }
  440. if (focusItem && focusItem.type == VectorType.TV) {
  441. if (geometry.vectorId == focusItem.vectorId) {
  442. this.context.strokeStyle = Style.Focus.Furniture.strokeStyle
  443. this.context.fillStyle = Style.Focus.Furniture.fillStyle
  444. }
  445. }
  446. const center = coordinate.getScreenXY({
  447. x: geometry.center.x,
  448. y: geometry.center.y,
  449. })
  450. const pt = coordinate.getScreenXY({
  451. x: geometry.center.x - (geometry.getLen() * geometry.scale) / 2,
  452. y: geometry.center.y + (geometry.getLen() * geometry.scale) / 2,
  453. })
  454. this.context.translate(center.x, center.y)
  455. this.context.rotate((geometry.angle / 180) * Math.PI)
  456. this.context.translate(pt.x - center.x, pt.y - center.y)
  457. this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32, (geometry.getLen() * geometry.scale * coordinate.res) / 32)
  458. this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32)
  459. this.context.miterLimit = 4
  460. this.context.font = "15px ''"
  461. this.context.beginPath()
  462. this.context.moveTo(0.5, 12.5)
  463. this.context.lineTo(31.5, 12.5)
  464. this.context.lineTo(31.5, 20.5)
  465. this.context.lineTo(0.5, 20.5)
  466. this.context.lineTo(0.5, 12.5)
  467. this.context.closePath()
  468. this.context.fill()
  469. this.context.stroke()
  470. this.context.beginPath()
  471. this.context.moveTo(7.5, 16.5)
  472. this.context.lineTo(24.5, 16.5)
  473. this.context.lineTo(24.5, 18.5)
  474. this.context.lineTo(7.5, 18.5)
  475. this.context.lineTo(7.5, 16.5)
  476. this.context.closePath()
  477. this.context.fill()
  478. this.context.stroke()
  479. this.context.beginPath()
  480. this.context.moveTo(22, 16.5)
  481. this.context.lineTo(21, 14.5)
  482. this.context.lineTo(11, 14.5)
  483. this.context.lineTo(10, 16.5)
  484. this.context.fill()
  485. this.context.stroke()
  486. this.context.restore()
  487. }
  488. */
  489. /***************************************************************************************************************************************************************************************/
  490. }
  491. const draw = new Draw()
  492. export { draw }