ibp盘
This commit is contained in:
parent
7757094ce3
commit
bc9180d814
18
src/ibp/shape/circularLamp.js
Normal file
18
src/ibp/shape/circularLamp.js
Normal file
@ -0,0 +1,18 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Arc from 'zrender/src/graphic/shape/Arc';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
|
||||
export default class CircularLamp extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = model.z;
|
||||
this.create();
|
||||
}
|
||||
|
||||
create() {
|
||||
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Arc from 'zrender/src/graphic/shape/Arc';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import { createBoundingRect } from '../../utils/parser';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
|
||||
export default class Control extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = model.z;
|
||||
this.style = model.style;
|
||||
this.textStyle = model.text;
|
||||
this.arcStyle = model.arc;
|
||||
this.create();
|
||||
}
|
||||
|
||||
create() {
|
||||
this.control = new Arc({
|
||||
_subType: 'Control',
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: this.arcStyle.shape,
|
||||
style: {
|
||||
lineWidth: this.arcStyle.lineWidth,
|
||||
fill: this.arcStyle.fill
|
||||
},
|
||||
onmouseover: this.arcStyle.mouseover,
|
||||
onmouseout: this.arcStyle.mouseout
|
||||
});
|
||||
|
||||
this.text = new Text({
|
||||
_subType: 'Text',
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
position: this.textStyle.position,
|
||||
style: {
|
||||
x: this.textStyle.x,
|
||||
y: this.textStyle.y,
|
||||
fontWeight: this.textStyle.fontWeight,
|
||||
fontSize: this.textStyle.fontSize,
|
||||
fontFamily: this.textStyle.fontFamily,
|
||||
text: this.textStyle.text,
|
||||
textFill: this.textStyle.textFill,
|
||||
textAlign: this.textStyle.textAlign,
|
||||
textVerticalAlign: this.textStyle.textVerticalAlign
|
||||
},
|
||||
onmouseover: this.textStyle.mouseover,
|
||||
onmouseout: this.textStyle.mouseout
|
||||
});
|
||||
const arcRect = this.getArcBoundingRect();
|
||||
const textRect = this.getTextBoundingRect();
|
||||
this.arcBorder = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
silent: true,
|
||||
shape: arcRect,
|
||||
style: {
|
||||
lineDash: this.style.arcBorderStyle.lineDash,
|
||||
stroke: this.style.arcBorderStyle.stroke,
|
||||
fill: this.style.arcBorderStyle.fill
|
||||
}
|
||||
});
|
||||
this.textBorder = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z-1,
|
||||
silent: true,
|
||||
shape: textRect,
|
||||
style: {
|
||||
lineDash: this.style.textBorderStyle.lineDash,
|
||||
stroke: this.style.textBorderStyle.stroke,
|
||||
fill: this.style.textBorderStyle.fill
|
||||
}
|
||||
});
|
||||
this.add(this.control);
|
||||
this.add(this.text);
|
||||
this.add(this.textBorder);
|
||||
this.add(this.arcBorder);
|
||||
this.textBorder.hide();
|
||||
this.arcBorder.hide();
|
||||
}
|
||||
setTextBorder(flag) {
|
||||
flag?this.textBorder.show():this.textBorder.hide();
|
||||
}
|
||||
setArcBorder(flag) {
|
||||
flag?this.arcBorder.show():this.arcBorder.hide();
|
||||
}
|
||||
getTextBoundingRect() {
|
||||
return createBoundingRect(this.text);
|
||||
}
|
||||
getArcBoundingRect() {
|
||||
return createBoundingRect(this.control);
|
||||
}
|
||||
setControlColor(color) {
|
||||
if (color) {
|
||||
this.control.setStyle('fill', color);
|
||||
}
|
||||
}
|
||||
setTextColor(color) {
|
||||
if (color) {
|
||||
this.text.setStyle('textFill', color);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ import Text from 'zrender/src/graphic/Text';
|
||||
/** 名称元素*/
|
||||
export default function ETextName(model) {
|
||||
const TextName = new Text({
|
||||
_subType: 'Text',
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
silent: model.silent || false,
|
||||
@ -24,48 +23,3 @@ export default function ETextName(model) {
|
||||
});
|
||||
return TextName;
|
||||
}
|
||||
// export default class ETextName extends Group {
|
||||
// constructor(model) {
|
||||
// super();
|
||||
// this.model = model;
|
||||
// this.zlevel = model.zlevel;
|
||||
// this.z = model.z;
|
||||
// this.create();
|
||||
// }
|
||||
|
||||
// create() {
|
||||
// this.TextName = new Text({
|
||||
// _subType: this.model._subType,
|
||||
// zlevel: this.zlevel,
|
||||
// z: this.z,
|
||||
// silent: this.model.silent || false,
|
||||
// style: {
|
||||
// x: this.model.x,
|
||||
// y: this.model.y,
|
||||
// text: this.model.text,
|
||||
// textFont: this.model.textFont,
|
||||
// textFill: this.model.textFill,
|
||||
// textAlign: this.model.textAlign,
|
||||
// textPosition: this.model.textPosition || 'inside',
|
||||
// textVerticalAlign: this.model.textVerticalAlign || null
|
||||
// }
|
||||
// });
|
||||
// this.add(this.TextName);
|
||||
// }
|
||||
|
||||
// setStyle(model) {
|
||||
// this.TextName.setStyle(model);
|
||||
// }
|
||||
|
||||
// setColor(color) {
|
||||
// this.TextName.setStyle('textFill', color);
|
||||
// }
|
||||
|
||||
// hide() {
|
||||
// this.TextName.hide();
|
||||
// }
|
||||
|
||||
// show() {
|
||||
// this.TextName.show();
|
||||
// }
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user