@urso/core 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -9,7 +9,7 @@ let ConfigMain = {
9
9
  useTransport: false, // use transport module for connetcting with server
10
10
  fps: {
11
11
  limit: 60, //max fps limit
12
- optimizeLowPerformance: true //down to 30 fps if lower 60
12
+ optimizeLowPerformance: false //down to 30 fps if lower 60
13
13
  }
14
14
  };
15
15
 
@@ -14,6 +14,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
14
14
  _minMoveDurationForEasing = 100;
15
15
  _minMoveDistanceForEasing = 50;
16
16
  _minMoveDistance = 15;
17
+ _currentPosition = 0;
17
18
 
18
19
  constructor(params) {
19
20
  super(params);
@@ -25,6 +26,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
25
26
  this._setSliderHandler = this._setSliderHandler.bind(this);
26
27
  this._switchBlock = this._switchBlock.bind(this);
27
28
  this._pointerEventsHandler = this._pointerEventsHandler.bind(this);
29
+ this._onResolutionChange = this._onResolutionChange.bind(this);
28
30
 
29
31
  this._setupDragContainer();
30
32
  containers.push(this);
@@ -83,6 +85,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
83
85
  this._resizeInteractiveLayer();
84
86
  this._resizeMask();
85
87
  this._setResizeReactively();
88
+ this._currentPosition = this._baseObject.y;
86
89
  }
87
90
 
88
91
  /**
@@ -396,8 +399,6 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
396
399
  this._onMoveCallback();
397
400
  const y = this._validateY(nextY, isWheel);
398
401
  this._setNewPosition(y);
399
- this._mask.y = -y;
400
- this._interactiveLayer.y = -y;
401
402
  this._needMoveSlider && this._setSliderPosition(y);
402
403
  }
403
404
 
@@ -450,6 +451,9 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
450
451
  */
451
452
  _setNewPosition(y) {
452
453
  this._baseObject.y = y;
454
+ this._mask.y = -y;
455
+ this._interactiveLayer.y = -y;
456
+ this._currentPosition = y;
453
457
  }
454
458
 
455
459
  /**
@@ -530,7 +534,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
530
534
  }
531
535
 
532
536
  /**
533
- * Creates a PIXI.Graohics rectangle which represents area in which we can interact with dragContainer.
537
+ * Creates a PIXI.Graphics rectangle which represents area in which we can interact with dragContainer.
534
538
  * @returns { Object }
535
539
  */
536
540
  _makeInteractiveLayer() {
@@ -546,7 +550,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
546
550
  }
547
551
 
548
552
  /**
549
- * Create PIXI.Graohics object that used as mask of dragContainer.
553
+ * Create PIXI.Graphics object that used as mask of dragContainer.
550
554
  * @returns { Object }
551
555
  */
552
556
  _makeMask() {
@@ -647,6 +651,13 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
647
651
  }
648
652
  }
649
653
 
654
+ /**
655
+ * Resets last saved position of dragContainer on resolution change.
656
+ */
657
+ _onResolutionChange() {
658
+ this._setNewPosition(this._currentPosition);
659
+ }
660
+
650
661
  /**
651
662
  * Unsubscribes methods on object destroy.
652
663
  */
@@ -657,6 +668,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
657
668
  this.removeListener(Urso.events.MODULES_SCENES_DISPLAY_FINISHED, this._setSliderHandler);
658
669
  this.removeListener(Urso.events.MODULES_OBJECTS_DRAGCONTAINER_SETSLIDER, this._setSliderHandler);
659
670
  this.removeListener(Urso.events.MODULES_OBJECTS_DRAGCONTAINER_SWITCHBLOCK, this._switchBlock);
671
+ this.removeListener(Urso.events.MODULES_SCENES_NEW_RESOLUTION, this._onResolutionChange);
660
672
  }
661
673
 
662
674
  /**
@@ -669,6 +681,7 @@ class ModulesObjectsModelsDragContainer extends ModulesObjectsModelsContainer {
669
681
  this.addListener(Urso.events.MODULES_SCENES_DISPLAY_FINISHED, this._setSliderHandler);
670
682
  this.addListener(Urso.events.MODULES_OBJECTS_DRAGCONTAINER_SETSLIDER, this._setSliderHandler);
671
683
  this.addListener(Urso.events.MODULES_OBJECTS_DRAGCONTAINER_SWITCHBLOCK, this._switchBlock);
684
+ this.addListener(Urso.events.MODULES_SCENES_NEW_RESOLUTION, this._onResolutionChange);
672
685
  }
673
686
  }
674
687