This commit is contained in:
joylink_cuiweidong 2021-01-13 18:33:21 +08:00
commit 3be5df98e8

View File

@ -7,6 +7,7 @@ import Text from 'zrender/src/graphic/Text';
import Polygon from 'zrender/src/graphic/shape/Polygon';
const defaultStyle = {
distance: 12,
block:{
stroke: '#fff', mapStyle: {
FB: { fill: '#fff', stroke: '#000' },
@ -40,14 +41,13 @@ export default class Responder extends Group {
create() {
const model = this.model;
const responderStyle = this.style.Responder || defaultStyle;
const distance = 12;
const offsetX = distance * Math.sin(model.rotate);
const offsetY = distance * Math.cos(model.rotate);
const distanceX = responderStyle.distance * Math.sin(model.rotate);
const distanceY = responderStyle.distance * Math.cos(model.rotate);
const blockWidth = responderStyle.block.width || 5;
const blockHeight = responderStyle.block.height || 12;
const blockStyle = responderStyle.block.mapStyle[model.type] || { fill: '#fff'};
const blockX = model.position.x - blockWidth / 2 - offsetX;
const blockY = model.position.y - blockHeight / 2 - offsetY;
const blockX = model.position.x - blockWidth / 2 - distanceX;
const blockY = model.position.y - blockHeight / 2 - distanceY;
const textX = blockX + model.textOffset.x;
const textY = blockY + model.textOffset.y;
const textName = `${model.type}-${model.name}`;
@ -103,7 +103,6 @@ export default class Responder extends Group {
this.text = new Text({
zlevel: this.zlevel,
z: this.z + 1,
origin,
style: {
x: textX,
y: textY,