File tree Expand file tree Collapse file tree 2 files changed +25
-20
lines changed Expand file tree Collapse file tree 2 files changed +25
-20
lines changed Original file line number Diff line number Diff line change 3030
3131<script >
3232import { keepScanning } from ' ../misc/scanner.js'
33+ import { thinSquare } from ' ../misc/track-func.js'
3334import Camera from ' ../misc/camera.js'
3435import CommonAPI from ' ../mixins/CommonAPI.vue'
3536import isEqual from ' lodash/isEqual'
@@ -93,26 +94,7 @@ export default {
9394
9495 trackRepaintFunction () {
9596 if (this .track === true ) {
96- return function (location , ctx ) {
97- const {
98- topLeftCorner ,
99- topRightCorner ,
100- bottomLeftCorner ,
101- bottomRightCorner ,
102- } = location
103-
104- ctx .strokeStyle = ' red'
105-
106- ctx .beginPath ()
107- ctx .moveTo (topLeftCorner .x , topLeftCorner .y )
108- ctx .lineTo (bottomLeftCorner .x , bottomLeftCorner .y )
109- ctx .lineTo (bottomRightCorner .x , bottomRightCorner .y )
110- ctx .lineTo (topRightCorner .x , topRightCorner .y )
111- ctx .lineTo (topLeftCorner .x , topLeftCorner .y )
112- ctx .closePath ()
113-
114- ctx .stroke ()
115- }
97+ return thinSquare ({ color: ' red' })
11698 } else if (this .track === false ) {
11799 return null
118100 } else {
Original file line number Diff line number Diff line change 1+
2+ export function thinSquare ( { color } ) {
3+ return function ( location , ctx ) {
4+ const {
5+ topLeftCorner,
6+ topRightCorner,
7+ bottomLeftCorner,
8+ bottomRightCorner,
9+ } = location
10+
11+ ctx . strokeStyle = 'red'
12+
13+ ctx . beginPath ( )
14+ ctx . moveTo ( topLeftCorner . x , topLeftCorner . y )
15+ ctx . lineTo ( bottomLeftCorner . x , bottomLeftCorner . y )
16+ ctx . lineTo ( bottomRightCorner . x , bottomRightCorner . y )
17+ ctx . lineTo ( topRightCorner . x , topRightCorner . y )
18+ ctx . lineTo ( topLeftCorner . x , topLeftCorner . y )
19+ ctx . closePath ( )
20+
21+ ctx . stroke ( )
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments