e334901490
# Conflicts: # src/jmap/shape/Signal/index.js
31 lines
648 B
JavaScript
31 lines
648 B
JavaScript
import Path from 'zrender/src/graphic/Path';
|
|
|
|
export default Path.extend({
|
|
type: 'SigPost',
|
|
|
|
shape: {
|
|
x: 0, // 灯柱高柱中心x
|
|
y: 0, // 灯柱高柱中心y
|
|
h: 10, // 灯柱高柱长度
|
|
w: 5, // 灯珠矮柱宽度
|
|
isDwarf: false, // 是否是矮柱
|
|
forward: true // 灯柱朝向
|
|
},
|
|
|
|
style: {
|
|
stroke: '#000',
|
|
lineWidth: 1
|
|
},
|
|
|
|
buildPath: function (ctx, shape) {
|
|
const w = shape.forward ? -shape.w : shape.w;
|
|
const r = shape.h / 2;
|
|
ctx.moveTo(shape.x, shape.y - r);
|
|
ctx.lineTo(shape.x, shape.y + r);
|
|
if (shape.isDwarf) {
|
|
ctx.moveTo(shape.x, shape.y);
|
|
ctx.lineTo(shape.x + w, shape.y);
|
|
}
|
|
}
|
|
});
|