smsmslib 1.0.46 → 1.0.48

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.
@@ -15,7 +15,16 @@
15
15
  * Imports.
16
16
  * --------------------------------------------------------------------------- */
17
17
 
18
- import {HtmlElement_t} from "../system/index.js";
18
+ import
19
+ {
20
+ HtmlElement_t,
21
+ Subject_t,
22
+ sj_Subject_get,
23
+ sj_element_key_get,
24
+ sj_prop_chg_own,
25
+ }
26
+ from "../system/index.js";
27
+
19
28
  import {AvControllerState_t} from "./AvControllerState_t.js"
20
29
 
21
30
 
@@ -36,6 +45,8 @@ export class HtmlTimerFrame_t extends HtmlElement_t
36
45
  constructor(s_selector)
37
46
  {
38
47
  super(s_selector);
48
+
49
+ this._o_element.addEventListener("click", HtmlTimerFrame_on_click);
39
50
  }
40
51
 
41
52
 
@@ -55,6 +66,49 @@ export class HtmlTimerFrame_t extends HtmlElement_t
55
66
  * Functions.
56
67
  * --------------------------------------------------------------------------- */
57
68
 
69
+ /**
70
+ * Handles click events on the timer frame to update the media playback position.
71
+ *
72
+ * @description
73
+ * This function calculates horizontal offset relative to the element's left edge to
74
+ * set `i_offset_x`.
75
+ *
76
+ * @param {PointerEvent} o_event - The click or pointer event from the timer element.
77
+ */
78
+ function HtmlTimerFrame_on_click(o_event)
79
+ {
80
+ const o_element = o_event.currentTarget;
81
+ const s_key = sj_element_key_get(o_element);
82
+ const o_Subject = sj_Subject_get(s_key);
83
+ let o_state = undefined;
84
+ const o_client_rect = o_element.getBoundingClientRect();
85
+ const i_offset_x = o_event.clientX - o_client_rect.left;
86
+
87
+ if (o_Subject instanceof Subject_t)
88
+ {
89
+ o_state = o_Subject.data_get();
90
+ }
91
+
92
+ if (o_state instanceof AvControllerState_t)
93
+ {
94
+ const o_chg = {};
95
+
96
+ if (o_state.d_start_sec < o_state.d_end_sec)
97
+ {
98
+ const d_total_sec = o_state.d_end_sec - o_state.d_start_sec;
99
+ const d_current_sec = d_total_sec * (i_offset_x / o_state.i_bar_px_max);
100
+
101
+ sj_prop_chg_own(o_state, "currentTime", d_current_sec, o_chg);
102
+ }
103
+
104
+ if (0 < Object.keys(o_chg).length)
105
+ {
106
+ o_Subject.observer_update(o_chg, o_element);
107
+ }
108
+ }
109
+ }
110
+
111
+
58
112
  /**
59
113
  * Retrieves the physical width of the timer frame and updates the state.
60
114
  *
@@ -14,7 +14,7 @@
14
14
  * Imports.
15
15
  * --------------------------------------------------------------------------- */
16
16
 
17
- import {sj_prop_add_own_new} from "./prop.js";
17
+ import {sj_prop_add_own_new, sj_prop_delete_own} from "./prop.js";
18
18
  import {Subject_t} from "./Subject_t.js";
19
19
 
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smsmslib",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "Reusable functions for me.",
5
5
  "files": [
6
6
  "javascr/**/*.js",
@@ -11,16 +11,11 @@
11
11
  "test": "echo \"Error: no test specified\" && exit 1"
12
12
  },
13
13
  "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/szoo2022/work.git"
14
+ "private": true
16
15
  },
17
16
  "keywords": [
18
17
  "smsmslib"
19
18
  ],
20
19
  "author": "",
21
- "license": "ISC",
22
- "bugs": {
23
- "url": "https://github.com/szoo2022/work/issues"
24
- },
25
- "homepage": "https://github.com/szoo2022/work#readme"
20
+ "license": "ISC"
26
21
  }