优化代码 没有参数e 报错的问题

This commit is contained in:
lVAL 2021-02-22 18:13:55 +08:00
parent e5cba385b1
commit 20ba9fbc15
9 changed files with 52 additions and 18 deletions

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
// this.device.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); // this.device.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
@ -38,7 +40,8 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target) { if (e &&
e.target) {
this.text.hide(); this.text.hide();
} else { } else {
// this.device.setControlColor(this.device.style.LcControl.lamp.controlColor); // this.device.setControlColor(this.device.style.LcControl.lamp.controlColor);

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
@ -40,7 +42,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
// this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); // this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
@ -40,7 +42,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
// this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); // this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
// this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); // this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
@ -38,7 +40,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
// this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); // this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
@ -40,7 +42,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);

View File

@ -29,7 +29,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor); this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor);
@ -41,7 +43,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor); this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor);

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
this.device.control.setControlColor(this.device.deviceStyle.mouseOverStyle.arcColor); this.device.control.setControlColor(this.device.deviceStyle.mouseOverStyle.arcColor);
@ -40,7 +42,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
this.device.control.setControlColor(this.device.deviceStyle.lamp.controlColor); this.device.control.setControlColor(this.device.deviceStyle.lamp.controlColor);

View File

@ -28,7 +28,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
// this.device.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); // this.device.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
@ -38,7 +40,8 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target) { if (e &&
e.target) {
this.text.hide(); this.text.hide();
} else { } else {
// this.device.setControlColor(this.device.style.LcControl.lamp.controlColor); // this.device.setControlColor(this.device.style.LcControl.lamp.controlColor);

View File

@ -29,7 +29,9 @@ export default class EMouse extends Group {
this.text.hide(); this.text.hide();
} }
mouseover(e) { mouseover(e) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.show(); this.text.show();
} else { } else {
this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor); this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor);
@ -41,7 +43,9 @@ export default class EMouse extends Group {
mouseout(e) { mouseout(e) {
if (!this.device.__down) { if (!this.device.__down) {
if (e.target && e.target._subType == 'Text') { if (e &&
e.target &&
e.target._subType == 'Text') {
this.text.hide(); this.text.hide();
} else { } else {
this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor); this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor);