Improve naming for viewport properties

This commit is contained in:
Pierre Ossman
2017-10-20 13:12:30 +02:00
parent a80aa41628
commit 0460e5fdbe
7 changed files with 51 additions and 50 deletions
+6 -6
View File
@@ -89,10 +89,10 @@ Display.prototype = {
this._rescale(scale);
},
_viewport: false,
get viewport() { return this._viewport; },
set viewport(viewport) {
this._viewport = viewport;
_clipViewport: false,
get clipViewport() { return this._clipViewport; },
set clipViewport(viewport) {
this._clipViewport = viewport;
// May need to readjust the viewport dimensions
var vp = this._viewportLoc;
this.viewportChangeSize(vp.w, vp.h);
@@ -124,7 +124,7 @@ Display.prototype = {
deltaX = Math.floor(deltaX);
deltaY = Math.floor(deltaY);
if (!this._viewport) {
if (!this._clipViewport) {
deltaX = -vp.w; // clamped later of out of bounds
deltaY = -vp.h;
}
@@ -163,7 +163,7 @@ Display.prototype = {
viewportChangeSize: function(width, height) {
if (!this._viewport ||
if (!this._clipViewport ||
typeof(width) === "undefined" ||
typeof(height) === "undefined") {
+6 -6
View File
@@ -217,7 +217,7 @@ RFB.prototype = {
// ===== PROPERTIES =====
disconnectTimeout: 3,
viewportDrag: false,
dragViewport: false,
_localCursor: false,
get localCursor() { return this._localCursor; },
@@ -262,11 +262,11 @@ RFB.prototype = {
get touchButton() { return this._mouse.touchButton; },
set touchButton(button) { this._mouse.touchButton = button; },
get scale() { return this._display.scale; },
set scale(scale) { this._display.scale = scale; },
get viewportScale() { return this._display.scale; },
set viewportScale(scale) { this._display.scale = scale; },
get viewport() { return this._display.viewport; },
set viewport(viewport) { this._display.viewport = viewport; },
get clipViewport() { return this._display.clipViewport; },
set clipViewport(viewport) { this._display.clipViewport = viewport; },
get isClipped() { return this._display.isClipped; },
@@ -679,7 +679,7 @@ RFB.prototype = {
this._mouse_buttonMask &= ~bmask;
}
if (this._viewportDrag) {
if (this.dragViewport) {
if (down && !this._viewportDragging) {
this._viewportDragging = true;
this._viewportDragPos = {'x': x, 'y': y};