bfg-common 1.5.512 → 1.5.514

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.
@@ -1233,7 +1233,7 @@
1233
1233
  "recommendations": "Рэкамендацыі",
1234
1234
  "recommended": "рэкамендуецца",
1235
1235
  "reconnect": "Паўторна падлучыцца",
1236
- "reconnectDesc": "Ваша сесія скончыцца праз:",
1236
+ "reconnectDesc": "Ваша сесія скончыцца праз некалькі секунд:",
1237
1237
  "redirectUrls": "URL-адрасы перанакіравання",
1238
1238
  "reduceEnergyConsumptionAtTheRisk": "Скароціце спажыванне энергіі з рызыкай зніжэння прадукцыйнасці",
1239
1239
  "reduceEnergyConsumptionWithMin": "Паменшыце спажыванне энергіі з мінімальным кампрамісам у прадукцыйнасці",
@@ -2477,7 +2477,8 @@
2477
2477
  "noConnectedPhysicalNetworkAdaptersMessage": "Вы ўпэўненыя, што хочаце працягнуць працу з адключанымі фізічнымі сеткавымі адаптарамі? Каб праглядзець унесеныя змены, націсніце Адмена.",
2478
2478
  "generalSettings": "Агульныя налады",
2479
2479
  "specifyValidHostDestinationComputeResource": "Укажыце сапраўдны хост як мэтавы вылічальны рэсурс.",
2480
- "selectValidHostDestinationComputeResource": "Выберыце сапраўдны хост як мэтавы вылічальны рэсурс."
2480
+ "selectValidHostDestinationComputeResource": "Выберыце сапраўдны хост як мэтавы вылічальны рэсурс.",
2481
+ "editTheNotesFor": "Рэдагаваць нататкі для "
2481
2482
  },
2482
2483
  "auth": {
2483
2484
  "welcomeTo": "Сардэчна запрашаем у",
@@ -1232,7 +1232,7 @@
1232
1232
  "recommendations": "Recommendations",
1233
1233
  "recommended": "recommended",
1234
1234
  "reconnect": "Reconnect",
1235
- "reconnectDesc": "Your session is about to expire after:",
1235
+ "reconnectDesc": "Your session will expire in a few seconds:",
1236
1236
  "redirectUrls": "Redirect URLs",
1237
1237
  "reduceEnergyConsumptionAtTheRisk": "Reduce energy consumption at the risk of lower performance",
1238
1238
  "reduceEnergyConsumptionWithMin": "Reduce energy consumption with minimal performance compromise",
@@ -2481,7 +2481,8 @@
2481
2481
  "noConnectedPhysicalNetworkAdaptersMessage": "Are you sure you want to continue with all assigned physical network adapters disconnected? To review your changes, click Cancel.",
2482
2482
  "generalSettings": "General Settings",
2483
2483
  "specifyValidHostDestinationComputeResource": "Specify a valid host as destination compute resource.",
2484
- "selectValidHostDestinationComputeResource": "Select a valid host as destination compute resource."
2484
+ "selectValidHostDestinationComputeResource": "Select a valid host as destination compute resource.",
2485
+ "editTheNotesFor": "Edit the notes for "
2485
2486
  },
2486
2487
  "auth": {
2487
2488
  "welcomeTo": "Welcome to",
@@ -1232,7 +1232,7 @@
1232
1232
  "recommendations": "Առաջարկություններ",
1233
1233
  "recommended": "խորհուրդ է տրվում",
1234
1234
  "reconnect": "Կրկին Միացեք",
1235
- "reconnectDesc": "Ձեր սեսիան կավարտվի հետո՝",
1235
+ "reconnectDesc": "Ձեր սեսիան կավարտվի մի քանի վայրկյանից՝",
1236
1236
  "redirectUrls": "Վերահղման URL-ներ",
1237
1237
  "reduceEnergyConsumptionAtTheRisk": "Նվազեցնել էներգիայի սպառումը ցածր արդյունավետության վտանգի դեպքում",
1238
1238
  "reduceEnergyConsumptionWithMin": "Նվազեցնել էներգիայի սպառումը նվազագույն կատարողականի փոխզիջումով",
@@ -2481,7 +2481,8 @@
2481
2481
  "noConnectedPhysicalNetworkAdaptersMessage": "Համոզվա՞ծ եք, որ ցանկանում եք շարունակել աշխատել անջատված ֆիզիկական ցանցային ադապտերների հետ: Կատարված փոփոխությունները դիտելու համար սեղմեք Չեղարկել կոճակը:",
2482
2482
  "generalSettings": "Ընդհանուր պարամետրեր",
2483
2483
  "specifyValidHostDestinationComputeResource": "Նշեք վավեր հոստ՝ որպես նպատակային հաշվարկային ռեսուրս։",
2484
- "selectValidHostDestinationComputeResource": "Ընտրեք վավեր հոստ՝ որպես նպատակային հաշվարկային ռեսուրս։"
2484
+ "selectValidHostDestinationComputeResource": "Ընտրեք վավեր հոստ՝ որպես նպատակային հաշվարկային ռեսուրս։",
2485
+ "editTheNotesFor": "Խմբագրել գրառումները "
2485
2486
  },
2486
2487
  "auth": {
2487
2488
  "welcomeTo": "Բարի գալուստ",
@@ -1232,7 +1232,7 @@
1232
1232
  "recommendations": "Ұсыныстар",
1233
1233
  "recommended": "ұсынылады",
1234
1234
  "reconnect": "Қайта қосылу",
1235
- "reconnectDesc": "Сіздің сессияңыз мына уақыттан кейін аяқталады:",
1235
+ "reconnectDesc": "Сіздің сессияңыз бірнеше секундтан кейін аяқталады:",
1236
1236
  "redirectUrls": "Қайта бағыттау URL мекенжайлары",
1237
1237
  "reduceEnergyConsumptionAtTheRisk": "Төмен өнімділік қаупімен қуат тұтынуды азайтыңыз",
1238
1238
  "reduceEnergyConsumptionWithMin": "Өнімділіктің ең аз төмендеуімен қуат тұтынуды азайтыңыз",
@@ -2480,7 +2480,8 @@
2480
2480
  "noConnectedPhysicalNetworkAdaptersMessage": "Барлық тағайындалған физикалық желілік адаптерлерді ажыратуды жалғастырғыңыз келетініне сенімдісіз бе? Өзгерістерді көру үшін \"Болдырмау\" түймесін басыңыз.",
2481
2481
  "generalSettings": "Жалпы Параметрлер",
2482
2482
  "specifyValidHostDestinationComputeResource": "Мақсатты есептеу ресурсы ретінде жарамды хостты көрсетіңіз.",
2483
- "selectValidHostDestinationComputeResource": "Мақсатты есептеу ресурсы ретінде жарамды хостты таңдаңыз."
2483
+ "selectValidHostDestinationComputeResource": "Мақсатты есептеу ресурсы ретінде жарамды хостты таңдаңыз.",
2484
+ "editTheNotesFor": "Үшін жазбаларды өңдеңіз "
2484
2485
  },
2485
2486
  "auth": {
2486
2487
  "welcomeTo": "Қош келдіңіз",
@@ -1232,7 +1232,7 @@
1232
1232
  "recommendations": "Рекомендации",
1233
1233
  "recommended": "рекомендуемый",
1234
1234
  "reconnect": "Повторно подключиться",
1235
- "reconnectDesc": "Ваша сессия завершится через:",
1235
+ "reconnectDesc": "Ваш сеанс завершится через несколько секунд:",
1236
1236
  "redirectUrls": "URL-адреса перенаправления",
1237
1237
  "reduceEnergyConsumptionAtTheRisk": "Снижение энергопотребления с риском снижения производительности",
1238
1238
  "reduceEnergyConsumptionWithMin": "Снижение энергопотребления с минимальным снижением производительности",
@@ -2480,7 +2480,8 @@
2480
2480
  "noConnectedPhysicalNetworkAdaptersMessage": "Вы уверены, что хотите продолжить работу с отключенными физическими сетевыми адаптерами? Чтобы просмотреть внесенные изменения, нажмите кнопку Отмена.",
2481
2481
  "generalSettings": "Общие настройки",
2482
2482
  "specifyValidHostDestinationComputeResource": "Укажите допустимый хост в качестве целевого вычислительного ресурса.",
2483
- "selectValidHostDestinationComputeResource": "Выберите допустимый хост в качестве целевого вычислительного ресурса."
2483
+ "selectValidHostDestinationComputeResource": "Выберите допустимый хост в качестве целевого вычислительного ресурса.",
2484
+ "editTheNotesFor": "Редактирование заметки для "
2484
2485
  },
2485
2486
  "auth": {
2486
2487
  "welcomeTo": "Добро пожаловать в",
@@ -1231,7 +1231,7 @@
1231
1231
  "recommendations": "建议",
1232
1232
  "recommended": "受到推崇的",
1233
1233
  "reconnect": "重新连接",
1234
- "reconnectDesc": "您的会话将在以下时间后过期:",
1234
+ "reconnectDesc": "您的会话将在几秒后过期:",
1235
1235
  "redirectUrls": "重定向 URL",
1236
1236
  "reduceEnergyConsumptionAtTheRisk": "以降低性能的風險降低能耗",
1237
1237
  "reduceEnergyConsumptionWithMin": "以最小的性能妥協降低能耗",
@@ -2478,7 +2478,8 @@
2478
2478
  "noConnectedPhysicalNetworkAdaptersMessage": "您确定要继续断开所有已分配的物理网络适配器的连接吗? 要查看更改,请单击\"取消\"。",
2479
2479
  "generalSettings": "常规设置",
2480
2480
  "specifyValidHostDestinationComputeResource": "请指定一个有效的主机作为目标计算资源。",
2481
- "selectValidHostDestinationComputeResource": "请选择一个有效的主机作为目标计算资源。"
2481
+ "selectValidHostDestinationComputeResource": "请选择一个有效的主机作为目标计算资源。",
2482
+ "editTheNotesFor": "编辑笔记 "
2482
2483
  },
2483
2484
  "auth": {
2484
2485
  "welcomeTo": "欢迎来到",
@@ -16,7 +16,7 @@
16
16
  :class="['portlet-js portlet-container', themeMode]"
17
17
  :data-id="item.id"
18
18
  :style="item.id === draggedPortletId && style"
19
- @mousedown.prevent.stop="onmousedown($event, item)"
19
+ @mousedown="onmousedown($event, item)"
20
20
  >
21
21
  <slot :portlet-id="item.id"></slot>
22
22
  </div>
@@ -57,7 +57,7 @@
57
57
  :class="['portlet-js portlet-container', themeMode]"
58
58
  :data-id="item.id"
59
59
  :style="item.id === draggedPortletId && style"
60
- @mousedown.prevent.stop="onmousedown($event, item)"
60
+ @mousedown="onmousedown($event, item)"
61
61
  >
62
62
  <slot :portlet-id="item.id"></slot>
63
63
  </div>
@@ -7,5 +7,6 @@ export interface UI_I_TableInfoItem {
7
7
  localizationTemplate?: string
8
8
  isCapital?: boolean
9
9
  iconName?: string
10
+ iconClassName?: string
10
11
  separator?: boolean
11
12
  }
@@ -3,15 +3,22 @@
3
3
  v-if="isNewView"
4
4
  :minutes="minutes"
5
5
  :seconds="seconds"
6
+ :is-hide-seconds-text="props.isHideSecondsText"
6
7
  />
7
8
  <common-countdown-timer-old v-else :minutes="minutes" :seconds="seconds" />
8
9
  </template>
9
10
 
10
11
  <script lang="ts" setup>
11
- const props = defineProps<{
12
- timer: number
13
- totalTime: number
14
- }>()
12
+ const props = withDefaults(
13
+ defineProps<{
14
+ timer: number
15
+ totalTime: number
16
+ isHideSecondsText?: boolean
17
+ }>(),
18
+ {
19
+ isHideSecondsText: false,
20
+ }
21
+ )
15
22
 
16
23
  const { $store }: any = useNuxtApp()
17
24
 
@@ -2,7 +2,9 @@
2
2
  <div class="countdown-timer-container flex items-center justify-center">
3
3
  <div class="inner-block">
4
4
  <span class="value">{{ props.minutes }}:{{ props.seconds }}</span>
5
- <span class="seconds-text">{{ localization.common.seconds }}</span>
5
+ <span v-if="!props.isHideSecondsText" class="seconds-text">{{
6
+ localization.common.seconds
7
+ }}</span>
6
8
  </div>
7
9
  </div>
8
10
  </template>
@@ -10,10 +12,16 @@
10
12
  <script lang="ts" setup>
11
13
  import type { UI_I_Localization } from '~/lib/models/interfaces'
12
14
 
13
- const props = defineProps<{
14
- minutes: string
15
- seconds: string
16
- }>()
15
+ const props = withDefaults(
16
+ defineProps<{
17
+ minutes: string
18
+ seconds: string
19
+ isHideSecondsText?: boolean
20
+ }>(),
21
+ {
22
+ isHideSecondsText: false,
23
+ }
24
+ )
17
25
 
18
26
  const localization = computed<UI_I_Localization>(() => useLocal())
19
27
  </script>
@@ -21,6 +21,7 @@
21
21
  <common-countdown-timer
22
22
  :timer="props.timer"
23
23
  :total-time="props.totalTime"
24
+ is-hide-seconds-text
24
25
  />
25
26
  </div>
26
27
  </div>
@@ -11,6 +11,10 @@
11
11
  <span class="details-item-label"> {{ item.label }}: </span>
12
12
 
13
13
  <div class="details-list__col-right flex-align-center text-ellipsis">
14
+ <span
15
+ v-if="item.iconClassName"
16
+ :class="['sprite-icon mr-2', item.iconClassName]"
17
+ ></span>
14
18
  <ui-icon
15
19
  v-if="item.iconName"
16
20
  :name="item.iconName"
@@ -46,6 +50,7 @@ const dataLocal = computed<UI_I_TableInfoItem[]>(() => {
46
50
  label: item.label,
47
51
  value: item.value,
48
52
  iconName: item.iconName,
53
+ iconClassName: item.iconClassName,
49
54
  })
50
55
  if (item.separator) {
51
56
  result.push({
@@ -105,6 +110,10 @@ const dataLocal = computed<UI_I_TableInfoItem[]>(() => {
105
110
  text-transform: capitalize;
106
111
  white-space: nowrap;
107
112
  }
113
+ .sprite-icon {
114
+ width: 20px;
115
+ height: 20px;
116
+ }
108
117
  .details-item-icon {
109
118
  color: var(--title-form-first-color);
110
119
  }
@@ -87,6 +87,16 @@
87
87
  <option :value="5">H265</option>
88
88
  </select>
89
89
 
90
+ <select
91
+ :value="mouseMode"
92
+ @mouseenter="hover = true"
93
+ @mouseleave="hover = false"
94
+ @change="onChangeMouseMode"
95
+ >
96
+ <option :value="1">Server</option>
97
+ <option :value="2">Client</option>
98
+ </select>
99
+
90
100
  <hr />
91
101
  <button
92
102
  class="vmw-drawer-body__btn animation show-keyboard"
@@ -113,7 +123,10 @@
113
123
  import { useDraggable } from '@vueuse/core'
114
124
  import type { UI_I_DeviceOption } from '~/components/common/spiceConsole/lib/models/interfaces'
115
125
  import type { UI_I_Localization } from '~/lib/models/interfaces'
116
- import type { UI_T_CODEC } from '~/components/common/spiceConsole/lib/models/types'
126
+ import type {
127
+ UI_T_CODEC,
128
+ UI_T_MouseMode,
129
+ } from '~/components/common/spiceConsole/lib/models/types'
117
130
  import {
118
131
  getUSBDeviceType,
119
132
  identifyHIDDevice,
@@ -126,7 +139,7 @@ const emits = defineEmits<{
126
139
 
127
140
  const isWindow = computed<boolean>(() => useRoute().query.window === 'true')
128
141
 
129
- const { $console }: any = useNuxtApp()
142
+ const { $console, $mouse }: any = useNuxtApp()
130
143
 
131
144
  const codec = computed<UI_T_CODEC>(() => $console.codec.value)
132
145
  const onChangeCodec = (event: any): void => {
@@ -145,6 +158,21 @@ const onChangeCodec = (event: any): void => {
145
158
  document.getElementById('inputmanager')?.focus()
146
159
  }
147
160
 
161
+ const mouseMode = computed<UI_T_MouseMode>(() => $mouse.mode.value)
162
+ const onChangeMouseMode = (event: any): void => {
163
+ const value = +event.target.value
164
+ // @ts-ignore
165
+ if (!window.app) return
166
+
167
+ // @ts-ignore
168
+ window.app.packetProcess.processors[
169
+ wdi.SpiceVars.SPICE_CHANNEL_MAIN
170
+ ].changeMouseMode(value)
171
+
172
+ document.getElementById('inputmanager')?.focus()
173
+ isShow.value = false
174
+ }
175
+
148
176
  const isKeyboardShown = ref<boolean>(false)
149
177
  const onToggleKeyboard = (): void => {
150
178
  isKeyboardShown.value = !isKeyboardShown.value
@@ -1 +1,2 @@
1
1
  export type UI_T_CODEC = 1 | 2 | 3 | 4 | 5
2
+ export type UI_T_MouseMode = 1 | 2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.512",
4
+ "version": "1.5.514",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,14 +1,13 @@
1
1
  import { defineNuxtPlugin } from '#app'
2
+ import type { UI_T_CODEC } from '~/components/common/spiceConsole/lib/models/types'
2
3
 
3
4
  export default defineNuxtPlugin(() => {
4
5
  const console = function (): any {
5
6
  const self: any = {
6
- codec: ref<1 | 2 | 3 | 4 | 5>(1)
7
+ codec: ref<UI_T_CODEC>(1),
7
8
  }
8
9
 
9
- self.changeCodec = (
10
- codec: 1 | 2 | 3 | 4 | 5
11
- ): void => {
10
+ self.changeCodec = (codec: UI_T_CODEC): void => {
12
11
  self.codec.value = codec
13
12
  }
14
13
  return self
@@ -0,0 +1,21 @@
1
+ import { defineNuxtPlugin } from '#app'
2
+ import type { UI_T_MouseMode } from '~/components/common/spiceConsole/lib/models/types'
3
+
4
+ export default defineNuxtPlugin(() => {
5
+ const mouse = function (): any {
6
+ const self: any = {
7
+ mode: ref<UI_T_MouseMode>(1),
8
+ }
9
+
10
+ self.changeMode = (mode: UI_T_MouseMode): void => {
11
+ self.mode.value = mode
12
+ }
13
+ return self
14
+ }.call({})
15
+
16
+ return {
17
+ provide: {
18
+ mouse,
19
+ },
20
+ }
21
+ })
@@ -656,6 +656,11 @@ wdi.ClientGui = $.spcExtend(wdi.EventObject.prototype, {
656
656
  })
657
657
 
658
658
  eventLayer['mousemove'](function (event) {
659
+ if (
660
+ self.mouse_mode === wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_SERVER &&
661
+ event.bubbles
662
+ )
663
+ return // Custom code // TODO refactoring. event.bubbles используется так как если переключить mouseMode на серверную то mousemove срабатывает дважды
659
664
  var x = event.pageX
660
665
  var y = event.pageY
661
666
  // self.generateEvent.call(self, 'mousemove', [
@@ -169,6 +169,11 @@ wdi.PacketFactory = {
169
169
  case wdi.SpiceVars.SPICE_MSG_CURSOR_SET:
170
170
  packet = new wdi.RedCursorSet().demarshall(rawSpiceMessage.body, rawSpiceMessage.header.size);
171
171
  break;
172
+ // Custom code
173
+ case wdi.SpiceVars.SPICE_MSG_CURSOR_MOVE:
174
+ packet = new wdi.RedCursorMove().demarshall(rawSpiceMessage.body, rawSpiceMessage.header.size);
175
+ break;
176
+ // Custom code end
172
177
  case wdi.SpiceVars.SPICE_MSG_CURSOR_HIDE:
173
178
  packet = new wdi.RedCursorHide().demarshall(rawSpiceMessage.body, rawSpiceMessage.header.size);
174
179
  break;
@@ -18,92 +18,130 @@
18
18
  */
19
19
 
20
20
  wdi.VirtualMouse = {
21
- eventLayers: [],
22
- mouseData:null,
23
- visible: null,
24
- lastLayer: null,
25
- hotspot: {
26
- x: 0,
27
- y: 0
28
- },
29
- lastMousePosition: {
30
- x: 0,
31
- y: 0,
32
- width: 0,
33
- height: 0
34
- },
35
-
36
- dispose: function () {
37
- wdi.Debug.log("Disposing VirtualMouse");
38
- this.eventLayers = [];
39
- this.mouseData = null;
40
- this.visible = null;
41
- this.lastLayer = null;
42
- this.hotspot = {
43
- x: 0,
44
- y: 0
45
- };
46
- this.lastMousePosition = {
47
- x: 0,
48
- y: 0,
49
- width: 0,
50
- height: 0
51
- };
52
- },
53
-
54
- setHotspot: function(x, y) {
55
- this.hotspot.x = x;
56
- this.hotspot.y = y;
57
- },
58
-
59
- setEventLayer: function(ev, x, y, width, height, position) {
60
- this.eventLayers.push({
61
- layer: ev,
62
- left: x,
63
- top: y,
64
- right: x+width,
65
- bottom: y+height,
66
- position: position
67
- });
68
- },
69
-
70
- removeEventLayer: function(ev) {
71
- var len = this.eventLayers.length;
72
- for(var i=0;i<len;i++) {
73
- if(this.eventLayers[i].layer.id === ev.id) {
74
- this.eventLayers[ev.id] = undefined;
75
- }
76
- }
77
- },
78
-
79
- getEventLayer: function(x, y) {
80
- var len = this.eventLayers.length;
81
- var layer = null;
82
- for(var i=0;i<len;i++) {
83
- layer = this.eventLayers[i];
84
- if(x >= layer.left && x <= layer.right && y >= layer.top && y <= layer.bottom) {
85
- return layer.layer;
86
- }
87
- }
88
- },
89
-
90
- setMouse: function(mouseData, x, y) {
91
- //if(!Modernizr.touch) {
92
- var layer = null;
93
- var len = this.eventLayers.length;
94
- for(var i=0;i<len;i++) {
95
- layer = this.eventLayers[i];
96
- layer.layer.style.cursor = 'url('+mouseData+') ' + x + ' ' + y + ', default';
21
+ eventLayers: [],
22
+ mouseData:null,
23
+ visible: null,
24
+ lastLayer: null,
25
+ cursor: null, // Custom code
26
+ cursorHotspot: { // Custom code
27
+ x: 0,
28
+ y: 0
29
+ },
30
+ hotspot: {
31
+ x: 0,
32
+ y: 0
33
+ },
34
+ lastMousePosition: {
35
+ x: 0,
36
+ y: 0,
37
+ width: 0,
38
+ height: 0
39
+ },
40
+
41
+ dispose: function () {
42
+ wdi.Debug.log("Disposing VirtualMouse");
43
+ this.eventLayers = [];
44
+ this.mouseData = null;
45
+ this.visible = null;
46
+ this.lastLayer = null;
47
+ this.hotspot = {
48
+ x: 0,
49
+ y: 0
50
+ };
51
+ this.lastMousePosition = {
52
+ x: 0,
53
+ y: 0,
54
+ width: 0,
55
+ height: 0
56
+ };
57
+ },
58
+
59
+ initCursor: function() {
60
+ const layer = this.eventLayers[0]
61
+ this.cursor = document.createElement('div');
62
+ this.cursor.style.position = 'fixed';
63
+ this.cursor.style.width = '32px';
64
+ this.cursor.style.height = '32px';
65
+ this.cursor.style.pointerEvents = 'none';
66
+ this.cursor.style.zIndex = '2147483647';
67
+ this.cursor.style.backgroundImage = layer.layer.style.cursor.match(/url\(.+\)/)?.[0] || '';
68
+ this.cursor.style.backgroundRepeat = 'no-repeat';
69
+
70
+ document.body.appendChild(this.cursor);
71
+ const {left, top} = document.getElementById('eventLayer').style
72
+ this.cursorHotspot.x = parseInt(left);
73
+ this.cursorHotspot.y = parseInt(top);
74
+ },
75
+
76
+ updateCursor: function(x, y) {
77
+ if (!this.cursor) return
78
+ this.cursor.style.left = this.cursorHotspot.x + x + 'px';
79
+ this.cursor.style.top = this.cursorHotspot.y + y + 'px';
80
+ },
81
+
82
+ removeCursor: function() {
83
+ this.cursor.remove();
84
+ },
85
+
86
+ setHotspot: function(x, y) {
87
+ this.hotspot.x = x;
88
+ this.hotspot.y = y;
89
+ },
90
+
91
+ setEventLayer: function(ev, x, y, width, height, position) {
92
+ this.eventLayers.push({
93
+ layer: ev,
94
+ left: x,
95
+ top: y,
96
+ right: x+width,
97
+ bottom: y+height,
98
+ position: position
99
+ });
100
+ },
101
+
102
+ removeEventLayer: function(ev) {
103
+ var len = this.eventLayers.length;
104
+ for(var i=0;i<len;i++) {
105
+ if(this.eventLayers[i].layer.id === ev.id) {
106
+ this.eventLayers[ev.id] = undefined;
107
+ }
108
+ }
109
+ },
110
+
111
+ getEventLayer: function(x, y) {
112
+ var len = this.eventLayers.length;
113
+ var layer = null;
114
+ for(var i=0;i<len;i++) {
115
+ layer = this.eventLayers[i];
116
+ if(x >= layer.left && x <= layer.right && y >= layer.top && y <= layer.bottom) {
117
+ return layer.layer;
97
118
  }
119
+ }
120
+ },
121
+
122
+ setMouse: function(mouseData, x, y) {
123
+ //if(!Modernizr.touch) {
124
+ var layer = null;
125
+ var len = this.eventLayers.length;
126
+ for(var i=0;i<len;i++) {
127
+ layer = this.eventLayers[i];
128
+ layer.layer.style.cursor = 'url('+mouseData+') ' + x + ' ' + y + ', default';
129
+ }
130
+
131
+ // Custom code // TODO refactor
132
+ if (this.cursor) {
133
+ this.cursor.style.backgroundImage = 'url("'+mouseData+'")';
134
+ }
135
+ // Custom code end
98
136
  //}
99
- },
100
-
101
- hideMouse: function() {
102
- var layer = null;
103
- var len = this.eventLayers.length;
104
- for(var i=0;i<len;i++) {
105
- layer = this.eventLayers[i];
106
- layer.layer.style.cursor = 'none';
107
- }
108
- }
137
+ },
138
+
139
+ hideMouse: function() {
140
+ var layer = null;
141
+ var len = this.eventLayers.length;
142
+ for(var i=0;i<len;i++) {
143
+ layer = this.eventLayers[i];
144
+ layer.layer.style.cursor = 'none';
145
+ }
146
+ }
109
147
  }