graphico 1.1.0 → 1.1.1

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/dist/canvas.js CHANGED
@@ -164,10 +164,15 @@ var Canvas = /** @class */ (function () {
164
164
  _this.animation = requestAnimationFrame(function (time) { return _this.startAnimate(time); });
165
165
  });
166
166
  main.addEventListener('focusout', function (e) {
167
- _this.focused = false;
168
- main.style.borderColor = _this.config.borderBlur;
169
- _this.log(e.type, _this.focused);
170
- cancelAnimationFrame(_this.animation);
167
+ if (_this.config.keepFocused) {
168
+ main.focus();
169
+ }
170
+ else {
171
+ _this.focused = false;
172
+ main.style.borderColor = _this.config.borderBlur;
173
+ _this.log(e.type, _this.focused);
174
+ cancelAnimationFrame(_this.animation);
175
+ }
171
176
  });
172
177
  window.addEventListener('blur', function (e) {
173
178
  _this.log(e.type);
@@ -441,6 +446,7 @@ var Canvas = /** @class */ (function () {
441
446
  border: 'transparent',
442
447
  borderBlur: 'transparent',
443
448
  showMouse: true,
449
+ keepFocused: false,
444
450
  numLayers: 1,
445
451
  numTracks: 1,
446
452
  keydown: function () { return; },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphico",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Canvas 2D rendering toolkit for games and visual projects",
5
5
  "homepage": "https://npm.nicfv.com/",
6
6
  "bin": "",
package/types/types.d.ts CHANGED
@@ -38,6 +38,10 @@ export interface Options {
38
38
  * Optionally show or hide the mouse when hovering over the canvas
39
39
  */
40
40
  readonly showMouse: boolean;
41
+ /**
42
+ * Refocus the canvas when it loses focus
43
+ */
44
+ readonly keepFocused: boolean;
41
45
  /**
42
46
  * The number of layers in this canvas
43
47
  */