Commit 7925919e authored by Chen Jiping's avatar Chen Jiping

fix:调整滚动条显示

parent 7bd290c9
...@@ -764,7 +764,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -764,7 +764,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let scrollbar = new Scrollbar(); let scrollbar = new Scrollbar();
scrollbar.init(this.mapScale, this.mapScale, viewHight, Math.floor(totalHeight - dH), 14); scrollbar.init(this.mapScale, this.mapScale, viewHight, Math.floor(totalHeight - dH), 14);
scrollbar.showScrollbar(); scrollbar.showScrollbar();
//scrollbar.hide(); scrollbar.hide();
scrollbar.bg.x = this.canvasWidth / 2 + 161 * this.mapScale; scrollbar.bg.x = this.canvasWidth / 2 + 161 * this.mapScale;
scrollbar.bg.y = this.canvasHeight / 2 - 231 * this.mapScale; scrollbar.bg.y = this.canvasHeight / 2 - 231 * this.mapScale;
this.renderArr.push(scrollbar.bg); this.renderArr.push(scrollbar.bg);
...@@ -943,7 +943,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -943,7 +943,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let y = sentence.getBoundingBox().y; let y = sentence.getBoundingBox().y;
let h = sentence.getBoundingBox().height; let h = Math.floor(sentence.getBoundingBox().height);
let offsetY = Math.floor(y - h / 2); let offsetY = Math.floor(y - h / 2);
...@@ -953,16 +953,21 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -953,16 +953,21 @@ export class PlayComponent implements OnInit, OnDestroy {
let dH = 24 * this.mapScale; let dH = 24 * this.mapScale;
console.log(offsetY, Math.floor(this.initY), Math.floor(this.initY + this.sentenceBg.height)) console.log(offsetY, Math.floor(this.initY), Math.floor(this.initY + this.sentenceBg.height))
let maxY = Math.floor(this.initY + this.sentenceBg.height);
let minY = Math.floor(this.initY);
//如果句子不在可视窗口,则进行定位滚动 //如果句子不在可视窗口,则进行定位滚动
if(offsetY < Math.floor(this.initY) || offsetY >= Math.floor(this.initY + this.sentenceBg.height)){ if(offsetY < minY || offsetY >= maxY || (offsetY < maxY && offsetY + h >= maxY)){
let dis = 0; let dis = 0;
if(offsetY < Math.floor(this.initY)){ if(offsetY < Math.floor(this.initY)){
dis = Math.floor(this.initY) - offsetY; dis = Math.floor(this.initY) - offsetY;
} }
else if(offsetY >= Math.floor(this.initY + this.sentenceBg.height)){ else if(offsetY >= maxY){
dis = -(offsetY - Math.floor(this.initY + this.sentenceBg.height) + h + dH); dis = -(offsetY - maxY+ h + dH);
} }
this.sentenceBg.y += dis; this.sentenceBg.y += dis;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment