@fmsim/machine 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agv-line.js +48 -0
- package/dist/agv-line.js.map +1 -0
- package/dist/agv.js +43 -0
- package/dist/agv.js.map +1 -0
- package/dist/buffer.js +40 -0
- package/dist/buffer.js.map +1 -0
- package/dist/conveyor-join.js +169 -0
- package/dist/conveyor-join.js.map +1 -0
- package/dist/conveyor.js +84 -0
- package/dist/conveyor.js.map +1 -0
- package/dist/crane.js +55 -0
- package/dist/crane.js.map +1 -0
- package/dist/data-subscription.js +126 -0
- package/dist/data-subscription.js.map +1 -0
- package/dist/editors/index.js +2 -0
- package/dist/editors/index.js.map +1 -0
- package/dist/equipment.js +18 -0
- package/dist/equipment.js.map +1 -0
- package/dist/features/client-api.js +45 -0
- package/dist/features/client-api.js.map +1 -0
- package/dist/features/conveyor-mixin.js +54 -0
- package/dist/features/conveyor-mixin.js.map +1 -0
- package/dist/features/mcs-event-handler-mixin.js +65 -0
- package/dist/features/mcs-event-handler-mixin.js.map +1 -0
- package/dist/features/mcs-status-default.js +67 -0
- package/dist/features/mcs-status-default.js.map +1 -0
- package/dist/features/mcs-status-mixin.js +39 -0
- package/dist/features/mcs-status-mixin.js.map +1 -0
- package/dist/features/mcs-transport-mixin.js +39 -0
- package/dist/features/mcs-transport-mixin.js.map +1 -0
- package/dist/features/mcs-zone-mixin.js +18 -0
- package/dist/features/mcs-zone-mixin.js.map +1 -0
- package/dist/groups/index.js +10 -0
- package/dist/groups/index.js.map +1 -0
- package/dist/groups/mcs-acs.js +24 -0
- package/dist/groups/mcs-acs.js.map +1 -0
- package/dist/groups/mcs-bcs.js +27 -0
- package/dist/groups/mcs-bcs.js.map +1 -0
- package/dist/groups/mcs-ccs.js +25 -0
- package/dist/groups/mcs-ccs.js.map +1 -0
- package/dist/groups/mcs-ecs.js +23 -0
- package/dist/groups/mcs-ecs.js.map +1 -0
- package/dist/groups/mcs-ocs.js +25 -0
- package/dist/groups/mcs-ocs.js.map +1 -0
- package/dist/groups/mcs-path.js +28 -0
- package/dist/groups/mcs-path.js.map +1 -0
- package/dist/groups/mcs-scs.js +26 -0
- package/dist/groups/mcs-scs.js.map +1 -0
- package/dist/groups/mcs-shape.js +26 -0
- package/dist/groups/mcs-shape.js.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/mcs-carrier-holder.js +107 -0
- package/dist/mcs-carrier-holder.js.map +1 -0
- package/dist/mcs-gauge-capacity-bar.js +170 -0
- package/dist/mcs-gauge-capacity-bar.js.map +1 -0
- package/dist/mcs-gauge-capacity-circle.js +91 -0
- package/dist/mcs-gauge-capacity-circle.js.map +1 -0
- package/dist/mcs-machine.js +84 -0
- package/dist/mcs-machine.js.map +1 -0
- package/dist/mcs-popup.js +82 -0
- package/dist/mcs-popup.js.map +1 -0
- package/dist/mcs-transport.js +18 -0
- package/dist/mcs-transport.js.map +1 -0
- package/dist/mcs-unit.js +78 -0
- package/dist/mcs-unit.js.map +1 -0
- package/dist/mcs-vehicle.js +69 -0
- package/dist/mcs-vehicle.js.map +1 -0
- package/dist/mcs-zone-unit.js +11 -0
- package/dist/mcs-zone-unit.js.map +1 -0
- package/dist/oht-line.js +32 -0
- package/dist/oht-line.js.map +1 -0
- package/dist/oht.js +42 -0
- package/dist/oht.js.map +1 -0
- package/dist/port.js +32 -0
- package/dist/port.js.map +1 -0
- package/dist/rtv-rail.js +36 -0
- package/dist/rtv-rail.js.map +1 -0
- package/dist/shelf.js +41 -0
- package/dist/shelf.js.map +1 -0
- package/dist/shuttle.js +49 -0
- package/dist/shuttle.js.map +1 -0
- package/dist/stocker-capacity-bar.js +171 -0
- package/dist/stocker-capacity-bar.js.map +1 -0
- package/dist/stocker.js +36 -0
- package/dist/stocker.js.map +1 -0
- package/dist/templates/agv-line-corner.js +34 -0
- package/dist/templates/agv-line-corner.js.map +1 -0
- package/dist/templates/agv-line-cross.js +34 -0
- package/dist/templates/agv-line-cross.js.map +1 -0
- package/dist/templates/agv-line-horizontal.js +34 -0
- package/dist/templates/agv-line-horizontal.js.map +1 -0
- package/dist/templates/agv-line-vertical.js +34 -0
- package/dist/templates/agv-line-vertical.js.map +1 -0
- package/dist/templates/agv-line.js +15 -0
- package/dist/templates/agv-line.js.map +1 -0
- package/dist/templates/agv.js +15 -0
- package/dist/templates/agv.js.map +1 -0
- package/dist/templates/buffer.js +15 -0
- package/dist/templates/buffer.js.map +1 -0
- package/dist/templates/conveyor-corner.js +33 -0
- package/dist/templates/conveyor-corner.js.map +1 -0
- package/dist/templates/conveyor-join.js +21 -0
- package/dist/templates/conveyor-join.js.map +1 -0
- package/dist/templates/conveyor-left.js +33 -0
- package/dist/templates/conveyor-left.js.map +1 -0
- package/dist/templates/conveyor-middle.js +33 -0
- package/dist/templates/conveyor-middle.js.map +1 -0
- package/dist/templates/conveyor-right.js +33 -0
- package/dist/templates/conveyor-right.js.map +1 -0
- package/dist/templates/conveyor.js +18 -0
- package/dist/templates/conveyor.js.map +1 -0
- package/dist/templates/crane.js +15 -0
- package/dist/templates/crane.js.map +1 -0
- package/dist/templates/data-subscription.js +16 -0
- package/dist/templates/data-subscription.js.map +1 -0
- package/dist/templates/equipment.js +15 -0
- package/dist/templates/equipment.js.map +1 -0
- package/dist/templates/index.js +35 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/mcs-gauge-capacity-bar.js +18 -0
- package/dist/templates/mcs-gauge-capacity-bar.js.map +1 -0
- package/dist/templates/mcs-gauge-capacity-circle.js +18 -0
- package/dist/templates/mcs-gauge-capacity-circle.js.map +1 -0
- package/dist/templates/oht-line-corner.js +34 -0
- package/dist/templates/oht-line-corner.js.map +1 -0
- package/dist/templates/oht-line-cross.js +34 -0
- package/dist/templates/oht-line-cross.js.map +1 -0
- package/dist/templates/oht-line-horizontal.js +34 -0
- package/dist/templates/oht-line-horizontal.js.map +1 -0
- package/dist/templates/oht-line-vertical.js +34 -0
- package/dist/templates/oht-line-vertical.js.map +1 -0
- package/dist/templates/oht-line.js +15 -0
- package/dist/templates/oht-line.js.map +1 -0
- package/dist/templates/oht.js +15 -0
- package/dist/templates/oht.js.map +1 -0
- package/dist/templates/port.js +15 -0
- package/dist/templates/port.js.map +1 -0
- package/dist/templates/rtv-corner.js +33 -0
- package/dist/templates/rtv-corner.js.map +1 -0
- package/dist/templates/rtv-left.js +33 -0
- package/dist/templates/rtv-left.js.map +1 -0
- package/dist/templates/rtv-middle.js +33 -0
- package/dist/templates/rtv-middle.js.map +1 -0
- package/dist/templates/rtv-rail.js +15 -0
- package/dist/templates/rtv-rail.js.map +1 -0
- package/dist/templates/rtv-right.js +33 -0
- package/dist/templates/rtv-right.js.map +1 -0
- package/dist/templates/rtv.js +15 -0
- package/dist/templates/rtv.js.map +1 -0
- package/dist/templates/shelf.js +15 -0
- package/dist/templates/shelf.js.map +1 -0
- package/dist/templates/shuttle.js +15 -0
- package/dist/templates/shuttle.js.map +1 -0
- package/dist/templates/stocker-capacity-bar.js +18 -0
- package/dist/templates/stocker-capacity-bar.js.map +1 -0
- package/dist/templates/stocker-capacity-circle.js +18 -0
- package/dist/templates/stocker-capacity-circle.js.map +1 -0
- package/dist/templates/stocker.js +16 -0
- package/dist/templates/stocker.js.map +1 -0
- package/dist/templates/zone-capacity-bar.js +19 -0
- package/dist/templates/zone-capacity-bar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/get-locale.js +19 -0
- package/dist/utils/get-locale.js.map +1 -0
- package/dist/utils/get-value-on-ranges.js +23 -0
- package/dist/utils/get-value-on-ranges.js.map +1 -0
- package/dist/utils/normalize-angle.js +11 -0
- package/dist/utils/normalize-angle.js.map +1 -0
- package/dist/utils/safe-round.js +9 -0
- package/dist/utils/safe-round.js.map +1 -0
- package/dist/zone-capacity-bar.js +162 -0
- package/dist/zone-capacity-bar.js.map +1 -0
- package/icons/agv-line.png +0 -0
- package/icons/agv.png +0 -0
- package/icons/buffer.png +0 -0
- package/icons/conveyor-corner.png +0 -0
- package/icons/conveyor-corner.svg +10 -0
- package/icons/conveyor-join.png +0 -0
- package/icons/conveyor-left.png +0 -0
- package/icons/conveyor-left.svg +6 -0
- package/icons/conveyor-middle.png +0 -0
- package/icons/conveyor-middle.svg +5 -0
- package/icons/conveyor-right.png +0 -0
- package/icons/conveyor-right.svg +6 -0
- package/icons/conveyor.png +0 -0
- package/icons/crane.png +0 -0
- package/icons/equipment.png +0 -0
- package/icons/icon-data-subscription.png +0 -0
- package/icons/oht-line.png +0 -0
- package/icons/oht.png +0 -0
- package/icons/pallet-empty.svg +3 -0
- package/icons/pallet.svg +11 -0
- package/icons/path-position.svg +5 -0
- package/icons/port.png +0 -0
- package/icons/process.png +0 -0
- package/icons/rtv-rail.png +0 -0
- package/icons/rtv.png +0 -0
- package/icons/shelf.png +0 -0
- package/icons/shuttle.png +0 -0
- package/icons/stocker-capacity-bar.png +0 -0
- package/icons/stocker-capacity-circle.png +0 -0
- package/icons/stocker.png +0 -0
- package/icons/symbol-data-subscription.png +0 -0
- package/icons/vehicle.png +0 -0
- package/icons/zone-capacity-bar.png +0 -0
- package/migration-samples/model.json +7964 -0
- package/package.json +59 -0
- package/src/agv-line.ts +59 -0
- package/src/agv.ts +56 -0
- package/src/buffer.ts +50 -0
- package/src/conveyor-join.ts +208 -0
- package/src/conveyor.ts +101 -0
- package/src/crane.ts +72 -0
- package/src/data-subscription.ts +150 -0
- package/src/editors/index.ts +0 -0
- package/src/equipment.ts +21 -0
- package/src/features/client-api.ts +52 -0
- package/src/features/conveyor-mixin.ts +75 -0
- package/src/features/mcs-status-default.ts +76 -0
- package/src/features/mcs-status-mixin.ts +53 -0
- package/src/features/mcs-zone-mixin.ts +23 -0
- package/src/groups/index.ts +10 -0
- package/src/groups/mcs-acs.ts +24 -0
- package/src/groups/mcs-bcs.ts +27 -0
- package/src/groups/mcs-ccs.ts +25 -0
- package/src/groups/mcs-ecs.ts +23 -0
- package/src/groups/mcs-ocs.ts +25 -0
- package/src/groups/mcs-path.ts +28 -0
- package/src/groups/mcs-scs.ts +26 -0
- package/src/groups/mcs-shape.ts +26 -0
- package/src/index.ts +29 -0
- package/src/mcs-carrier-holder.ts +141 -0
- package/src/mcs-gauge-capacity-circle.ts +113 -0
- package/src/mcs-machine.ts +101 -0
- package/src/mcs-popup.ts +99 -0
- package/src/mcs-transport.ts +20 -0
- package/src/mcs-unit.ts +91 -0
- package/src/mcs-vehicle.ts +79 -0
- package/src/oht-line.ts +43 -0
- package/src/oht.ts +55 -0
- package/src/port.ts +41 -0
- package/src/shelf.ts +53 -0
- package/src/shuttle.ts +65 -0
- package/src/stocker-capacity-bar.ts +220 -0
- package/src/stocker.ts +45 -0
- package/src/templates/agv-line.ts +15 -0
- package/src/templates/agv.ts +15 -0
- package/src/templates/buffer.ts +15 -0
- package/src/templates/conveyor.ts +18 -0
- package/src/templates/crane.ts +15 -0
- package/src/templates/data-subscription.js +16 -0
- package/src/templates/equipment.ts +15 -0
- package/src/templates/index.ts +43 -0
- package/src/templates/oht-line.ts +15 -0
- package/src/templates/oht.ts +15 -0
- package/src/templates/port.ts +15 -0
- package/src/templates/shelf.ts +15 -0
- package/src/templates/shuttle.ts +15 -0
- package/src/templates/stocker-capacity-bar.ts +18 -0
- package/src/templates/stocker-capacity-circle.ts +18 -0
- package/src/templates/stocker.ts +16 -0
- package/src/templates/zone-capacity-bar.ts +19 -0
- package/src/utils/get-locale.ts +22 -0
- package/src/utils/get-value-on-ranges.ts +25 -0
- package/src/utils/normalize-angle.ts +9 -0
- package/src/utils/safe-round.ts +8 -0
- package/src/zone-capacity-bar.ts +209 -0
- package/things-scene.config.js +7 -0
- package/translations/en.json +7 -0
- package/translations/ja.json +7 -0
- package/translations/ko.json +7 -0
- package/translations/ms.json +7 -0
- package/translations/zh.json +7 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const icon = `
|
|
2
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
3
|
+
viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
|
|
4
|
+
<style type="text/css">
|
|
5
|
+
.st0{fill:{{strokeColor}}}
|
|
6
|
+
</style>
|
|
7
|
+
<path class="st0" d="M6.8,4.67L6.25,5.2L4.85,6.59L4.33,7.15l0.4,0.65l2.07,3.47l0.28,0.5h2.91l3.96,3.93
|
|
8
|
+
c-3.54,3.56-8.05,8.08-8.2,8.24C4.2,25.48,4.2,28.02,5.78,29.5c1.55,1.53,4.07,1.57,5.54,0c0.01-0.01,0.02-0.02,0.03-0.03l6.1-6.13
|
|
9
|
+
l6.13,6.16l0.09,0.06c1.56,1.47,4.03,1.49,5.48-0.06v-0.03h0.03c1.52-1.55,1.53-4.08-0.03-5.54l-0.03-0.03l-5.17-5.14
|
|
10
|
+
c3.48-0.33,6.2-3.26,6.25-6.81h0.03c0-0.02,0-0.04,0-0.06c0-0.01,0-0.02,0-0.03c0.1-1.15-0.15-2.24-0.74-3.19l-0.68-1.05l-4.61,4.61
|
|
11
|
+
l-1.39-1.46l4.71-4.71l-1.36-0.56c-0.8-0.34-1.72-0.59-2.76-0.59c-3.81,0-6.93,3.13-6.93,6.93c0,0.41,0.09,0.77,0.15,1.15
|
|
12
|
+
c-0.43,0.43-0.76,0.79-1.27,1.3l-3.93-3.93V7.43l-0.5-0.28L7.45,5.07L6.8,4.67z M23.4,6.9c0.14,0,0.24,0.08,0.37,0.09l-3.75,3.75
|
|
13
|
+
l0.68,0.71l2.79,2.88l0.68,0.71l3.93-3.93c0.02,0.23,0.18,0.39,0.15,0.65v0.09c0,2.73-2.23,4.95-4.95,4.95
|
|
14
|
+
c-0.36,0-0.8-0.09-1.3-0.19l-0.53-0.09l-0.37,0.37L9.93,28.11H9.9v0.03c-0.7,0.77-1.93,0.79-2.76-0.03v-0.03H7.11
|
|
15
|
+
c-0.77-0.7-0.79-1.93,0.03-2.76c0.38-0.38,7.65-7.71,11.21-11.27l0.4-0.4l-0.15-0.56c-0.08-0.32-0.15-0.87-0.15-1.24
|
|
16
|
+
C18.44,9.13,20.67,6.9,23.4,6.9z M7.11,7.15l2.32,1.42v0.99L9.22,9.78H8.23L6.8,7.46L7.11,7.15z M21.6,19.19l6.16,6.13v0.03h0.03
|
|
17
|
+
c0.77,0.7,0.79,1.93-0.03,2.76h-0.03v0.03c-0.7,0.77-1.93,0.79-2.76-0.03l-6.13-6.16L21.6,19.19z"/>
|
|
18
|
+
</svg>
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const mcsShape = {
|
|
22
|
+
name: 'mcsShape',
|
|
23
|
+
description: 'a group of various mcs-shapes',
|
|
24
|
+
icon,
|
|
25
|
+
templates: []
|
|
26
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { default as MachineGroups } from './groups'
|
|
2
|
+
|
|
3
|
+
export { default as DataSubscription } from './data-subscription'
|
|
4
|
+
|
|
5
|
+
export { default as MCSMachine } from './mcs-machine'
|
|
6
|
+
export { default as MCSUnit } from './mcs-unit'
|
|
7
|
+
export { default as MCSCarrierHolder } from './mcs-carrier-holder'
|
|
8
|
+
export { default as MCSVehicle } from './mcs-vehicle'
|
|
9
|
+
export { default as MCSTransport } from './mcs-transport'
|
|
10
|
+
// export { default as MCSGauge } from './mcs-gauge-capacity-circle'
|
|
11
|
+
export { default as StockerCapacityBar } from './stocker-capacity-bar'
|
|
12
|
+
export { default as ZoneCapacityBar } from './zone-capacity-bar'
|
|
13
|
+
|
|
14
|
+
export { default as AGVLine } from './agv-line'
|
|
15
|
+
export { default as Buffer } from './buffer'
|
|
16
|
+
export { default as Conveyor } from './conveyor'
|
|
17
|
+
export { default as ConveyorJoin } from './conveyor-join'
|
|
18
|
+
export { default as Equipment } from './equipment'
|
|
19
|
+
export { default as OHTLine } from './oht-line'
|
|
20
|
+
export { default as Stocker } from './stocker'
|
|
21
|
+
|
|
22
|
+
export { default as AGV } from './agv'
|
|
23
|
+
export { default as OHT } from './oht'
|
|
24
|
+
// export { default as RTV } from './rtv'
|
|
25
|
+
export { default as Shuttle } from './shuttle'
|
|
26
|
+
|
|
27
|
+
export { default as Port } from './port'
|
|
28
|
+
export { default as Crane } from './crane'
|
|
29
|
+
export { default as Shelf } from './shelf'
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { BOUNDS, Component } from '@hatiolab/things-scene'
|
|
2
|
+
import { LEGEND_CARRIER, Legend } from './features/mcs-status-default'
|
|
3
|
+
import { MCSStatusMixin } from './features/mcs-status-mixin'
|
|
4
|
+
import MCSUnit from './mcs-unit'
|
|
5
|
+
import { themesColorMap } from './features/client-api'
|
|
6
|
+
|
|
7
|
+
export class Carrier extends MCSStatusMixin(Object) {
|
|
8
|
+
host: Component
|
|
9
|
+
|
|
10
|
+
id?: string
|
|
11
|
+
type: ('ALL' | 'BOBIN' | 'MAGAZINE' | 'PALLET' | 'REEL_TRAY' | 'PLATE')[] = []
|
|
12
|
+
emptyType?: 'Full' | 'Empty' | 'EmptyEmpty'
|
|
13
|
+
|
|
14
|
+
constructor(host: Component) {
|
|
15
|
+
super()
|
|
16
|
+
this.host = host
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
set data(data: any) {
|
|
20
|
+
const { CARRIERID, CARRIERTYPE = '', EMPTYTYPE } = data || {}
|
|
21
|
+
|
|
22
|
+
this.id = CARRIERID
|
|
23
|
+
this.type = CARRIERTYPE.split(';')
|
|
24
|
+
this.emptyType = EMPTYTYPE
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get status() {
|
|
28
|
+
return this.emptyType
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get legend(): Legend {
|
|
32
|
+
const { carrierLegendName } = this.host.state
|
|
33
|
+
|
|
34
|
+
if (carrierLegendName) {
|
|
35
|
+
return (this.host.root as any)?.style[carrierLegendName]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return LEGEND_CARRIER
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
calculateShrunkRectangle(originalRect: BOUNDS): BOUNDS {
|
|
42
|
+
const shrunkRect: BOUNDS = { ...originalRect }
|
|
43
|
+
|
|
44
|
+
shrunkRect.left += originalRect.width * 0.15
|
|
45
|
+
shrunkRect.width *= 0.7
|
|
46
|
+
|
|
47
|
+
shrunkRect.top += originalRect.height * 0.15
|
|
48
|
+
shrunkRect.height *= 0.7
|
|
49
|
+
|
|
50
|
+
return shrunkRect
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
render(ctx: CanvasRenderingContext2D) {
|
|
54
|
+
if (!this.id || !this.type) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { left, top, width, height } = this.calculateShrunkRectangle(this.host.bounds)
|
|
59
|
+
|
|
60
|
+
const radius = Math.round(Math.min(width, height) * 0.2)
|
|
61
|
+
|
|
62
|
+
// 시작점 설정
|
|
63
|
+
ctx.beginPath()
|
|
64
|
+
ctx.moveTo(left + radius, top)
|
|
65
|
+
|
|
66
|
+
// 상단 가로선 그리기
|
|
67
|
+
ctx.lineTo(left + width - radius, top)
|
|
68
|
+
ctx.arcTo(left + width, top, left + width, top + radius, radius)
|
|
69
|
+
|
|
70
|
+
// 우측 세로선 그리기
|
|
71
|
+
ctx.lineTo(left + width, top + height - radius)
|
|
72
|
+
ctx.arcTo(left + width, top + height, left + width - radius, top + height, radius)
|
|
73
|
+
|
|
74
|
+
// 하단 가로선 그리기
|
|
75
|
+
ctx.lineTo(left + radius, top + height)
|
|
76
|
+
ctx.arcTo(left, top + height, left, top + height - radius, radius)
|
|
77
|
+
|
|
78
|
+
// 좌측 세로선 그리기
|
|
79
|
+
ctx.lineTo(left, top + radius)
|
|
80
|
+
ctx.arcTo(left, top, left + radius, top, radius)
|
|
81
|
+
|
|
82
|
+
// 경로 닫기 및 그리기
|
|
83
|
+
ctx.closePath()
|
|
84
|
+
ctx.stroke()
|
|
85
|
+
|
|
86
|
+
ctx.lineWidth = radius > 10 ? 2 : 1
|
|
87
|
+
ctx.fillStyle = this.statusColor || 'transparent'
|
|
88
|
+
ctx.strokeStyle = this.auxColor || 'transparent'
|
|
89
|
+
|
|
90
|
+
ctx.fill()
|
|
91
|
+
ctx.stroke()
|
|
92
|
+
|
|
93
|
+
ctx.beginPath()
|
|
94
|
+
|
|
95
|
+
// 숫자 그리기
|
|
96
|
+
const count = 2 // this.type?.length
|
|
97
|
+
|
|
98
|
+
if (count > 1) {
|
|
99
|
+
const { x: cx, y: cy } = this.host.center
|
|
100
|
+
|
|
101
|
+
ctx.fillStyle = 'red'
|
|
102
|
+
ctx.font = `bold ${Math.round(radius * 4)}px Arial`
|
|
103
|
+
ctx.textAlign = 'center'
|
|
104
|
+
ctx.textBaseline = 'middle'
|
|
105
|
+
|
|
106
|
+
ctx.fillText(String(count), cx, cy)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default class MCSCarrierHolder extends MCSUnit {
|
|
112
|
+
static get properties(): any {
|
|
113
|
+
return [
|
|
114
|
+
...MCSUnit.properties,
|
|
115
|
+
{
|
|
116
|
+
type: 'select',
|
|
117
|
+
label: 'carrier-legend-name',
|
|
118
|
+
name: 'carrierLegendName',
|
|
119
|
+
property: {
|
|
120
|
+
options: themesColorMap
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
carrier: Carrier = new Carrier(this)
|
|
127
|
+
|
|
128
|
+
ready() {
|
|
129
|
+
this.carrier.data = this.data
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
postrender(ctx: CanvasRenderingContext2D) {
|
|
133
|
+
this.carrier.render(ctx)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
onchangeData(after: any, before: any) {
|
|
137
|
+
this.carrier.data = this.data
|
|
138
|
+
|
|
139
|
+
super.onchangeData(after, before)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Component, ComponentNature, Ellipse, Properties } from '@hatiolab/things-scene'
|
|
2
|
+
import { getVaueOnRanges } from './utils/get-value-on-ranges'
|
|
3
|
+
import { MCSStatusMixin } from './features/mcs-status-mixin'
|
|
4
|
+
import { LEGEND_CAPACITY, Legend } from './features/mcs-status-default'
|
|
5
|
+
|
|
6
|
+
const NATURE: ComponentNature = {
|
|
7
|
+
mutable: false,
|
|
8
|
+
resizable: true,
|
|
9
|
+
rotatable: true,
|
|
10
|
+
properties: [
|
|
11
|
+
{
|
|
12
|
+
type: 'number',
|
|
13
|
+
name: 'currentUsage',
|
|
14
|
+
label: 'current-usage'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'number',
|
|
18
|
+
name: 'highWatermark',
|
|
19
|
+
label: 'high-watermark'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'number',
|
|
23
|
+
name: 'maxCapacity',
|
|
24
|
+
label: 'max-capacity'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'hidden',
|
|
28
|
+
name: 'usage',
|
|
29
|
+
label: 'usage'
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
'value-property': 'usage'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default class MCSGaugeCapacityCircle extends MCSStatusMixin(Ellipse) {
|
|
36
|
+
static get nature() {
|
|
37
|
+
return NATURE
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getTheme() {
|
|
41
|
+
const { legendName } = this.state
|
|
42
|
+
|
|
43
|
+
if (legendName) {
|
|
44
|
+
return (this.root as any)?.style?.[legendName]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get legend(): Legend {
|
|
49
|
+
return this.getTheme() || this.getLegendFallback()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getLegendFallback() {
|
|
53
|
+
return LEGEND_CAPACITY
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get statusColor() {
|
|
57
|
+
return getVaueOnRanges(this.usage, this.legend)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
render(context: CanvasRenderingContext2D) {
|
|
61
|
+
var { cx, cy, rx, ry } = this.state
|
|
62
|
+
const radius = Math.min(rx, ry)
|
|
63
|
+
|
|
64
|
+
context.beginPath()
|
|
65
|
+
|
|
66
|
+
context.arc(cx, cy, radius, 0, Math.PI * 2)
|
|
67
|
+
context.fillStyle = 'gray'
|
|
68
|
+
context.fill()
|
|
69
|
+
this.drawStroke(context)
|
|
70
|
+
|
|
71
|
+
const startAngle = Math.PI * -0.5
|
|
72
|
+
const endAngle = startAngle + Math.PI * 2 * (this.value / 100)
|
|
73
|
+
|
|
74
|
+
context.beginPath()
|
|
75
|
+
|
|
76
|
+
context.moveTo(cx, cy)
|
|
77
|
+
context.arc(cx, cy, radius, startAngle, endAngle)
|
|
78
|
+
context.lineTo(cx, cy)
|
|
79
|
+
context.fillStyle = this.statusColor!
|
|
80
|
+
|
|
81
|
+
context.fill()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get usage() {
|
|
85
|
+
const { currentUsage = 0, maxCapacity = 100 } = this.state
|
|
86
|
+
return Math.round((currentUsage / maxCapacity) * 100)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
set usage(usage: number) {
|
|
90
|
+
// intentionally have done nothing
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onchangeData(after: Properties, before: Properties): void {
|
|
94
|
+
const {
|
|
95
|
+
CURRENTCAPACITY = 0,
|
|
96
|
+
MAXCAPACITY = 100,
|
|
97
|
+
HIGHWATERMARK = 100
|
|
98
|
+
} = typeof this.data == 'object' ? this.data : {}
|
|
99
|
+
|
|
100
|
+
const currentUsage = Number(CURRENTCAPACITY) || 0
|
|
101
|
+
const maxCapacity = Number(MAXCAPACITY) || 100
|
|
102
|
+
const highWatermark = Number(HIGHWATERMARK) || 100
|
|
103
|
+
|
|
104
|
+
this.setState({
|
|
105
|
+
currentUsage,
|
|
106
|
+
maxCapacity,
|
|
107
|
+
highWatermark,
|
|
108
|
+
usage: Math.round((currentUsage / maxCapacity) * 100)
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Component.register('MCSGaugeCapacityCircle', MCSGaugeCapacityCircle)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Component, ContainerAbstract } from '@hatiolab/things-scene'
|
|
2
|
+
import { MCSStatusMixin, MCSStatusMixinProperties } from './features/mcs-status-mixin'
|
|
3
|
+
|
|
4
|
+
import { safeRound } from './utils/safe-round'
|
|
5
|
+
import { LEGEND_MACHINE, Legend } from './features/mcs-status-default'
|
|
6
|
+
import { getLocaleLanguage } from './utils/get-locale'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* MCS Machine의 공통 속성을 정의한 최상위 오브젝트
|
|
10
|
+
* - Container
|
|
11
|
+
* -
|
|
12
|
+
*/
|
|
13
|
+
export default class MCSMachine extends MCSStatusMixin(ContainerAbstract) {
|
|
14
|
+
static get properties(): any {
|
|
15
|
+
return [
|
|
16
|
+
...MCSStatusMixinProperties,
|
|
17
|
+
{
|
|
18
|
+
type: 'number',
|
|
19
|
+
name: 'round',
|
|
20
|
+
label: 'round'
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
containable(component: Component) {
|
|
26
|
+
return ['rect', 'ellipse'].includes(component.state.type)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get reactionDecorators() {
|
|
30
|
+
return ['bouncing-arrow']
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getTheme() {
|
|
34
|
+
const { legendName } = this.state
|
|
35
|
+
|
|
36
|
+
if (legendName) {
|
|
37
|
+
return (this.root as any)?.style?.[legendName]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get hasTextProperty() {
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get status() {
|
|
46
|
+
return this.data?.STATUS
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get auxStatus() {
|
|
50
|
+
return this.data?.STATUS
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get legend(): Legend {
|
|
54
|
+
return this.getTheme() || this.getLegendFallback()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get auxLegend() {
|
|
58
|
+
return LEGEND_MACHINE
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get auxColor() {
|
|
62
|
+
return this.state.strokeStyle
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getLegendFallback() {
|
|
66
|
+
return LEGEND_MACHINE
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
render(ctx) {
|
|
70
|
+
var { round = 0, lineWidth } = this.state
|
|
71
|
+
var { left, top, width, height } = this.bounds
|
|
72
|
+
|
|
73
|
+
ctx.beginPath()
|
|
74
|
+
|
|
75
|
+
ctx.strokeStyle = this.auxColor
|
|
76
|
+
ctx.fillStyle = this.statusColor!
|
|
77
|
+
ctx.lineWidth = lineWidth || 1
|
|
78
|
+
ctx.lineCap = 'round'
|
|
79
|
+
ctx.setLineDash([])
|
|
80
|
+
|
|
81
|
+
round = safeRound(round, width, height)
|
|
82
|
+
|
|
83
|
+
ctx.roundRect(left, top, width, height, round)
|
|
84
|
+
|
|
85
|
+
ctx.fill()
|
|
86
|
+
ctx.stroke()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get text() {
|
|
90
|
+
if (this.data?.LOCALENAME) {
|
|
91
|
+
// TODO 왜 LOCALENAME 데이타는 문자열인가 ? 오브젝트로 보내달라.
|
|
92
|
+
return JSON.parse(this.data.LOCALENAME)[getLocaleLanguage()]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return super.text
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
set text(text) {
|
|
99
|
+
super.text = text
|
|
100
|
+
}
|
|
101
|
+
}
|
package/src/mcs-popup.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Component, ComponentNature, RectPath, Shape, error } from '@hatiolab/things-scene'
|
|
2
|
+
|
|
3
|
+
const NATURE: ComponentNature = {
|
|
4
|
+
mutable: false,
|
|
5
|
+
resizable: true,
|
|
6
|
+
rotatable: true,
|
|
7
|
+
properties: []
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function safeRound(round, width, height) {
|
|
11
|
+
var max = width > height ? (height / width) * 100 : 100
|
|
12
|
+
|
|
13
|
+
if (round >= max) round = max
|
|
14
|
+
else if (round <= 0) round = 0
|
|
15
|
+
|
|
16
|
+
return round
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default class MCSPopup extends RectPath(Shape) {
|
|
20
|
+
static get nature() {
|
|
21
|
+
return NATURE
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
dispose() {
|
|
25
|
+
super.dispose()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render(ctx) {
|
|
29
|
+
var { round = 0 } = this.model
|
|
30
|
+
|
|
31
|
+
var { left, top, width, height } = this.bounds
|
|
32
|
+
var { radius, extend } = this.model
|
|
33
|
+
|
|
34
|
+
drawPopup(ctx, left, top, width, height)
|
|
35
|
+
|
|
36
|
+
ctx.beginPath()
|
|
37
|
+
|
|
38
|
+
ctx.translate(left, top)
|
|
39
|
+
|
|
40
|
+
round = safeRound(round, width, height)
|
|
41
|
+
|
|
42
|
+
radius = radius ?? (round / 100) * (width / 2)
|
|
43
|
+
|
|
44
|
+
ctx.moveTo(radius, 0)
|
|
45
|
+
|
|
46
|
+
ctx.arcTo(width, 0, width, height, radius)
|
|
47
|
+
ctx.arcTo(width, height, 0, height, radius)
|
|
48
|
+
ctx.arcTo(0, height, 0, 0, radius)
|
|
49
|
+
ctx.arcTo(0, 0, width, 0, radius)
|
|
50
|
+
|
|
51
|
+
ctx.translate(-left, -top)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
Component.register('MCSPOPUP', MCSPopup)
|
|
56
|
+
|
|
57
|
+
export function drawPopup(ctx, left, top, width, height) {
|
|
58
|
+
drawPopupBottom(ctx, left, top, width, height)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function drawPopupBottom(ctx, left, top, width, height) {
|
|
62
|
+
/* popup1 전체 frame */
|
|
63
|
+
// const left = 10
|
|
64
|
+
// const top = 10
|
|
65
|
+
// const width = 180
|
|
66
|
+
// let height = 135
|
|
67
|
+
height -= height / 12.25 // 꼬리 영역까지 포함시키려 height를 일부러 크게 잡았으니, 실제로 그릴때는 popup의 몸통 height로 맞춰준다
|
|
68
|
+
let radius = 10
|
|
69
|
+
|
|
70
|
+
//시작
|
|
71
|
+
ctx.beginPath()
|
|
72
|
+
ctx.moveTo(left + radius, top)
|
|
73
|
+
ctx.strokeStyle = '#afafaf'
|
|
74
|
+
//우측 상단 모서리
|
|
75
|
+
ctx.lineTo(left + width - radius, top)
|
|
76
|
+
ctx.quadraticCurveTo(left + width, top, left + width, top + radius)
|
|
77
|
+
//우측 하단 모서리
|
|
78
|
+
ctx.lineTo(left + width, top + height - radius)
|
|
79
|
+
ctx.quadraticCurveTo(left + width, top + height, left + width - radius, top + height)
|
|
80
|
+
//화살표 꼬리 그리기
|
|
81
|
+
const arrowWidth = width / 8.95
|
|
82
|
+
const arrowHeight = height / 12.25
|
|
83
|
+
const arrowPx = left + width / 2 + arrowWidth / 2 // start point x
|
|
84
|
+
const arrowPy = top + height // start point y
|
|
85
|
+
ctx.lineTo(arrowPx, arrowPy)
|
|
86
|
+
ctx.lineTo(arrowPx - arrowWidth / 2, arrowPy + arrowHeight)
|
|
87
|
+
ctx.lineTo(arrowPx - arrowWidth, arrowPy)
|
|
88
|
+
//좌측 하단 모서리
|
|
89
|
+
ctx.lineTo(left + radius, top + height)
|
|
90
|
+
ctx.quadraticCurveTo(left, top + height, left, top + height - radius)
|
|
91
|
+
//좌측 상단 모서리
|
|
92
|
+
ctx.lineTo(left, top + radius)
|
|
93
|
+
ctx.quadraticCurveTo(left, top, left + radius, top)
|
|
94
|
+
ctx.stroke()
|
|
95
|
+
ctx.closePath()
|
|
96
|
+
//도형 색칠하기
|
|
97
|
+
ctx.fillStyle = 'rgba(0, 0, 0, 0.8)'
|
|
98
|
+
ctx.fill()
|
|
99
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Properties } from '@hatiolab/things-scene'
|
|
2
|
+
import { LEGEND_TRANSPORT, Legend } from './features/mcs-status-default'
|
|
3
|
+
import MCSMachine from './mcs-machine'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MCS용 Unit > Transport들의 공통 속성을 정의한 오브젝트
|
|
7
|
+
*/
|
|
8
|
+
export default class MCSTransport extends MCSMachine {
|
|
9
|
+
static get properties(): any {
|
|
10
|
+
return MCSMachine.properties
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get status() {
|
|
14
|
+
return this.data?.STATUS
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getLegendFallback() {
|
|
18
|
+
return LEGEND_TRANSPORT
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/mcs-unit.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Component, Properties } from '@hatiolab/things-scene'
|
|
2
|
+
import { MCSStatusMixin, MCSStatusMixinProperties } from './features/mcs-status-mixin'
|
|
3
|
+
import { LEGEND_UNIT, Legend } from './features/mcs-status-default'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MCS용 Unit들의 공통 속성을 정의한 오브젝트
|
|
7
|
+
*/
|
|
8
|
+
export default class MCSUnit extends MCSStatusMixin(Component) {
|
|
9
|
+
static get properties(): any {
|
|
10
|
+
return MCSStatusMixinProperties
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get reactionDecorators() {
|
|
14
|
+
return ['bouncing-arrow']
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getTheme() {
|
|
18
|
+
const { legendName } = this.state
|
|
19
|
+
|
|
20
|
+
if (legendName) {
|
|
21
|
+
return (this.root as any)?.style?.[legendName]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get status() {
|
|
26
|
+
return this.data?.STATUS
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get auxStatus() {
|
|
30
|
+
return this.data?.STATUS
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get legend(): Legend {
|
|
34
|
+
return this.getTheme() || this.getLegendFallback()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get auxLegend() {
|
|
38
|
+
return this.legend
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getLegendFallback() {
|
|
42
|
+
return LEGEND_UNIT
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
contains(x, y) {
|
|
46
|
+
var { left, top, width, height, lineWidth = 0 } = this.state
|
|
47
|
+
var extend = lineWidth / 2
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
x < Math.max(left + width, left) + extend &&
|
|
51
|
+
x > Math.min(left + width, left) - extend &&
|
|
52
|
+
y < Math.max(top + height, top) + extend &&
|
|
53
|
+
y > Math.min(top + height, top) - extend
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
set path(path) {
|
|
58
|
+
var left_top = path[0]
|
|
59
|
+
var right_bottom = path[2]
|
|
60
|
+
|
|
61
|
+
this.set({
|
|
62
|
+
left: left_top.x,
|
|
63
|
+
top: left_top.y,
|
|
64
|
+
width: right_bottom.x - left_top.x,
|
|
65
|
+
height: right_bottom.y - left_top.y
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get path() {
|
|
70
|
+
var { left = 0, top = 0, width = 0, height = 0 } = this.state
|
|
71
|
+
|
|
72
|
+
return [
|
|
73
|
+
{
|
|
74
|
+
x: left,
|
|
75
|
+
y: top
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
x: left + width,
|
|
79
|
+
y: top
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
x: left + width,
|
|
83
|
+
y: top + height
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
x: left,
|
|
87
|
+
y: top + height
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { LEGEND_VEHICLE, Legend } from './features/mcs-status-default'
|
|
2
|
+
import MCSCarrierHolder from './mcs-carrier-holder'
|
|
3
|
+
|
|
4
|
+
const DIRECTION_GAP = 3
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MCS용 Unit > Transport들의 공통 속성을 정의한 오브젝트
|
|
8
|
+
*/
|
|
9
|
+
export default class MCSVehicle extends MCSCarrierHolder {
|
|
10
|
+
static get properties(): any {
|
|
11
|
+
return [
|
|
12
|
+
...MCSCarrierHolder.properties,
|
|
13
|
+
{
|
|
14
|
+
type: 'select',
|
|
15
|
+
label: 'direction',
|
|
16
|
+
name: 'direction',
|
|
17
|
+
property: {
|
|
18
|
+
options: ['', 'up', 'down', 'left', 'right']
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getLegendFallback(): Legend {
|
|
25
|
+
return LEGEND_VEHICLE
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
renderDirection(ctx: CanvasRenderingContext2D) {
|
|
29
|
+
const { direction } = this.state
|
|
30
|
+
|
|
31
|
+
if (direction) {
|
|
32
|
+
const { left, top, width, height } = this.state
|
|
33
|
+
|
|
34
|
+
ctx.beginPath()
|
|
35
|
+
ctx.translate(left, top)
|
|
36
|
+
|
|
37
|
+
ctx.strokeStyle = 'black'
|
|
38
|
+
ctx.fillStyle = 'black'
|
|
39
|
+
ctx.lineJoin = 'round'
|
|
40
|
+
ctx.lineWidth = 1
|
|
41
|
+
ctx.setLineDash([])
|
|
42
|
+
|
|
43
|
+
switch (direction) {
|
|
44
|
+
case 'up':
|
|
45
|
+
ctx.moveTo((width * 1) / 3, -DIRECTION_GAP)
|
|
46
|
+
ctx.lineTo(width / 2, -height / 10 - DIRECTION_GAP)
|
|
47
|
+
ctx.lineTo((width * 2) / 3, -DIRECTION_GAP)
|
|
48
|
+
break
|
|
49
|
+
case 'down':
|
|
50
|
+
ctx.moveTo((width * 1) / 3, height + DIRECTION_GAP)
|
|
51
|
+
ctx.lineTo(width / 2, height + height / 10 + DIRECTION_GAP)
|
|
52
|
+
ctx.lineTo((width * 2) / 3, height + DIRECTION_GAP)
|
|
53
|
+
break
|
|
54
|
+
case 'left':
|
|
55
|
+
ctx.moveTo(-DIRECTION_GAP, (height * 1) / 3)
|
|
56
|
+
ctx.lineTo(-width / 10 - 2, height / 2)
|
|
57
|
+
ctx.lineTo(-DIRECTION_GAP, (height * 2) / 3)
|
|
58
|
+
break
|
|
59
|
+
case 'right':
|
|
60
|
+
default:
|
|
61
|
+
ctx.moveTo(DIRECTION_GAP + width, (height * 1) / 3)
|
|
62
|
+
ctx.lineTo(DIRECTION_GAP + width + width / 10, height / 2)
|
|
63
|
+
ctx.lineTo(DIRECTION_GAP + width, (height * 2) / 3)
|
|
64
|
+
break
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ctx.translate(-left, -top)
|
|
68
|
+
ctx.closePath()
|
|
69
|
+
|
|
70
|
+
ctx.fill()
|
|
71
|
+
ctx.stroke()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
postrender(ctx: CanvasRenderingContext2D): void {
|
|
76
|
+
super.postrender(ctx)
|
|
77
|
+
this.renderDirection(ctx)
|
|
78
|
+
}
|
|
79
|
+
}
|