ibp调整页面

This commit is contained in:
fan 2019-09-06 18:17:54 +08:00
parent 6b96fc928d
commit 760aa02496
3 changed files with 12 additions and 8 deletions

View File

@ -152,14 +152,13 @@ class IbpPan {
updateIbpData(elem); updateIbpData(elem);
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem); const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem)); const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
delete this.mapDevice[code]; delete this.ibpDevice[code];
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
if (!elem._dispose) { if (!elem._dispose) {
this.ibpDevice[code] = nDevice; this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice); this.$painter.add(nDevice);
} }
}); });
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); } if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
} }

View File

@ -28,7 +28,6 @@ class MouseController extends Eventful {
this.$zr = ibp.getZr(); this.$zr = ibp.getZr();
this.isAllowDragging=ibp.isAllowDragging||false; this.isAllowDragging=ibp.isAllowDragging||false;
this.events = ibp.getEvents(); this.events = ibp.getEvents();
this._draggingTarget=null;
this._dragging = false; this._dragging = false;
this.initHandler(this.$zr); this.initHandler(this.$zr);
} }
@ -94,7 +93,7 @@ class MouseController extends Eventful {
} }
const em = new EventModel(e); const em = new EventModel(e);
this.eventTarget = em.eventTarget; this.eventTarget = em.eventTarget;
if (this.eventTarget._type === deviceType.Background) { if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('pointer'); this.eventTarget.setCursor('pointer');
} }
this._offsetX=e.offsetX; this._offsetX=e.offsetX;
@ -121,7 +120,7 @@ class MouseController extends Eventful {
this._x = e.offsetX; this._x = e.offsetX;
this._y = e.offsetY; this._y = e.offsetY;
if (this._dragging) { if (this._dragging) {
if (this.eventTarget._type === deviceType.Background || !this.isAllowDragging) { if ((this.eventTarget && this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) {
this._preventDefaultMouseMove && eventTool.stop(e.event); this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
return true; return true;
@ -135,12 +134,12 @@ class MouseController extends Eventful {
} }
mouseup(e) { mouseup(e) {
if (!eventTool.notLeftMouse(e)&&this.isAllowDragging) { if (!eventTool.notLeftMouse(e)&&this.isAllowDragging && this.eventTarget) {
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY); this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this.eventTarget.dirty(); this.eventTarget.dirty();
this.eventTarget = ''; this.eventTarget = '';
} }
if (this.eventTarget._type === deviceType.Background) { if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('default'); this.eventTarget.setCursor('default');
} }
this._dragging = false; this._dragging = false;

View File

@ -41,7 +41,13 @@
}, },
watch: { watch: {
'$store.state.ibp.rightClickCount': function (val) {
const model = this.$store.getters['ibp/updateDeviceData'];
if (model._type === 'Background' ){
this.form.bgWidth = model.width;
this.form.bgHeight = model.height;
}
}
}, },
mounted() { mounted() {
}, },