调整大屏偏移

This commit is contained in:
zyy 2020-05-07 09:04:28 +08:00
parent faa2b72003
commit ca4a4689fc
4 changed files with 32 additions and 21 deletions

View File

@ -136,10 +136,6 @@ class Jlmap {
const options = this.pullBack(opts);
this.$options.update(options);
this.$painter.updateTransform(this.$options);
// this.$painter.updateTransform1([
// { scaleRate: 0.3, offsetX: -50, offsetY: -100, width: 1600, height: 500 },
// { scaleRate: 0.3, offsetX: 1500, offsetY: -300, width: 1600, height: 500},
// { scaleRate: 0.3, offsetX: 3050, offsetY: -500, width: 1600, height: 500}]);
if (this.$options.disabled == true) {
this.$mouseController.disable();
} else {
@ -160,6 +156,19 @@ class Jlmap {
}
}
setUpdateScreen(opts) {
this.$painter.updateTransform1(
[
{ scaleRate: 0.3, offsetY: -100 },
{ scaleRate: 0.3, offsetY: -300 },
{ scaleRate: 0.3, offsetY: -500 },
{ scaleRate: 0.3, offsetY: -700 },
{ scaleRate: 0.3, offsetY: -900 },
{ scaleRate: 0.3, offsetY: -1100 }
],
{width: opts.width, height: opts.height});
}
setLevelVisible(list) {
this.$painter.setLevelVisible(list);
}

View File

@ -192,8 +192,8 @@ class Painter {
this.$transformHandle.updateTransform(opt);
}
updateTransform1(opts) {
this.$transformHandleScreen.updateTransform(opts);
updateTransform1(list, opts) {
this.$transformHandleScreen.updateTransform(list, opts);
}
/**
* 更新zrender尺寸

View File

@ -4,27 +4,18 @@ import {createTransform, createBoundingRect} from './utils/parser';
class TransformHandle {
constructor(painter) {
this.$painter = painter;
this.width = 1600;
this.parentLevel = painter.getParentLevel();
this.rect = { x: 0, y: 0, width: 1600, height: 800 };
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.transform = [createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 })];
}
checkVisible(view, rect) {
// return createBoundingRect(view).intersect(rect);
checkVisible(view) {
return createBoundingRect(view).intersect(this.rect);
}
revisibleView(view) {
if (this.checkVisible(view)) {
view.show();
} else {
view.hide();
}
// view.dirty();
}
// 视图进行缩放/平移
transformView(view) {
if (view) {
@ -48,9 +39,13 @@ class TransformHandle {
}
// 更新偏移量
updateTransform(opts) {
updateTransform(list, opts) {
const rightWidth = 80; // 右边空余宽度
this.rect = { x: 0, y: 0, width: opts.width - rightWidth, height: opts.height };
this.width = opts.width - rightWidth;
this.transform = [];
opts.forEach(item => {
list.forEach((item, index) => {
item['offsetX'] = index * (this.width - 50) - 50;
this.transform.push(createTransform(item));
});
this.transformAll();

View File

@ -53,9 +53,9 @@ export default {
},
'$store.state.map.mapViewLoadedCount':function() {
this.$store.dispatch('map/setTrainWindowShow', false);
console.log(this, this.$jlmap);
this.$jlmap.off('zoom');
this.$jlmap.off('pan');
this.handleUpdateScreen();
}
},
async beforeDestroy() {
@ -104,6 +104,13 @@ export default {
const height = this.height;
this.$store.dispatch('config/resize', { width, height });
});
},
handleUpdateScreen() {
const size = {
width: this.$store.state.app.width - (this.widthLeft || 450) - 2,
height: this.height
};
this.$jlmap.setUpdateScreen(size);
}
}
};