forked from thisdp/dgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
1680 lines (1657 loc) · 64.2 KB
/
client.lua
File metadata and controls
1680 lines (1657 loc) · 64.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
focusBrowser()
------------Copyrights thisdp's DirectX Graphical User Interface System
--Speed Up
local abs = math.abs
local find = string.find
local rep = string.rep
local gsub = string.gsub
local floor = math.floor
local min = math.min
local max = math.max
local tocolor = tocolor
--Dx Functions
local dxDrawLine = dxDrawLine
local dxDrawImage = dxDrawImageExt
local dxDrawImageSection = dxDrawImageSectionExt
local dxDrawText = dxDrawText
local dxGetFontHeight = dxGetFontHeight
local dxDrawRectangle = dxDrawRectangle
local dxSetShaderValue = dxSetShaderValue
local dxGetPixelsSize = dxGetPixelsSize
local dxGetPixelColor = dxGetPixelColor
local dxSetRenderTarget = dxSetRenderTarget
local dxGetTextWidth = dxGetTextWidth
local dxSetBlendMode = dxSetBlendMode
--
local utf8Len = utf8.len
local tableInsert = table.insert
local tableRemove = table.remove
local tableCount = table.count
local tableRemoveItemFromArray = table.removeItemFromArray
local applyColorAlpha = applyColorAlpha
local getCursorPosition = getCursorPosition
local triggerEvent = triggerEvent
local unpack = unpack
local tostring = tostring
local tonumber = tonumber
local type = type
local isElement = isElement
local _getElementID = getElementID
local getElementID = function(ele) return isElement(ele) and _getElementID(ele) or tostring(ele) end
----
sW,sH = guiGetScreenSize()
white = 0xFFFFFFFF
black = 0xFF000000
green = 0xFF00FF00
red = 0xFFFF0000
blue = 0xFF0000FF
yellow = 0xFFFFFF00
fontSize = {}
self,renderArguments = false,false
dgsRenderSetting = {
postGUI = nil,
renderPriority = "normal",
}
dgsRenderer = {}
function dgsGetRenderSetting(name) return dgsRenderSetting[name] end
function dgsSetRenderSetting(name,value)
if name == "renderPriority" then
assert(type(value)=="string","Bad Argument @dgsSetRenderSetting at argument 2, expected a string got "..dgsGetType(value))
removeEventHandler("onClientRender",root,dgsCoreRender)
local success = addEventHandler("onClientRender",root,dgsCoreRender,false,value)
if not success then
addEventHandler("onClientRender",root,dgsCoreRender,false,dgsRenderSetting.renderPriority)
end
assert(success,"Bad Argument @dgsSetRenderSetting at argument 2, failed to set the priority")
end
dgsRenderSetting[name] = value
return true
end
-----------------------------dx-GUI
MouseData = {}
MouseData.enter = false
MouseData.lastEnter = false
MouseData.scbEnterData = false
MouseData.scbEnterRltPos = false
MouseData.scrollPane = false
MouseData.hit = false
MouseData.nowShow = false
MouseData.editMemoCursor = false
MouseData.gridlistMultiSelection = false
MouseData.lastPos = {-1,-1}
MouseData.interfaceHit = {}
MouseData.intfaceHitElement = false
MouseData.lock3DInterface = false
MouseData.dgsCursorPos = {}
MouseData.EditMemoTimer = setTimer(function()
local dgsType = dgsGetType(MouseData.nowShow)
if dgsType == "dgs-dxedit" or dgsType == "dgs-dxmemo" then
MouseData.editMemoCursor = not MouseData.editMemoCursor
end
end,500,0)
function dgsCoreRender()
local tk = getTickCount()
triggerEvent("onDgsPreRender",resourceRoot)
local bottomTableSize = #BottomFatherTable
local centerTableSize = #CenterFatherTable
local topTableSize = #TopFatherTable
local dx3DInterfaceTableSize = #dx3DInterfaceTable
local dx3DTextTableSize = #dx3DTextTable
MouseData.hit = false
DGSShow = 0
wX,wY,wZ = nil,nil,nil
local mx,my = -1000,-1000
MouseData.intfaceHitElement = false
if isCursorShowing() then
mx,my = getCursorPosition()
mx,my = mx*sW,my*sH
wX,wY,wZ = getWorldFromScreenPosition(mx,my,1)
MouseX,MouseY = mx,my
else
MouseData.Move = false
MouseData.MoveScroll = false
MouseData.scbClickData = false
MouseData.selectorClickData = false
MouseData.clickl = false
MouseData.clickr = false
MouseData.clickm = false
MouseData.lock3DInterface = false
MouseData.Scale = false
MouseData.scrollPane = false
MouseData.dgsCursorPos = {false,false}
end
if isElement(BlurBoxGlobalScreenSource) then
dxUpdateScreenSource(BlurBoxGlobalScreenSource,true)
end
local normalMx,normalMy = mx,my
if bottomTableSize+centerTableSize+topTableSize+dx3DInterfaceTableSize+dx3DTextTableSize ~= 0 then
local dgsData = dgsElementData
dxSetRenderTarget()
MouseData.interfaceHit = {}
local dxInterfaceHitElement = false
local intfaceClickElementl = false
local dimension = getElementDimension(localPlayer)
local interior = getCameraInterior()
for i=1,dx3DInterfaceTableSize do
local v = dx3DInterfaceTable[i]
local eleData = dgsData[v]
if (eleData.dimension == -1 or eleData.dimension == dimension) and (eleData.interior == -1 or eleData.interior == interior) then
dxSetBlendMode(eleData.blendMode)
if renderGUI(v,mx,my,{eleData.enabled,eleData.enabled},eleData.renderTarget_parent,{0,0,0,0},0,0,1,eleData.visible,MouseData.clickl) then
intfaceClickElementl = true
end
end
end
dxSetBlendMode("blend")
dxSetRenderTarget()
MouseData.WithinElements = {}
local intfaceMx,intfaceMy = MouseX,MouseY
MouseData.intfaceHitElement = MouseData.hit
local mx,my = normalMx,normalMy
for i=1,dx3DTextTableSize do
local v = dx3DTextTable[i]
local eleData = dgsData[v]
if (eleData.dimension == -1 or eleData.dimension == dimension) and (eleData.interior == -1 or eleData.interior == interior) then
renderGUI(v,mx,my,{eleData.enabled,eleData.enabled},nil,{0,0,0,0},0,0,1,eleData.visible)
end
end
for i=1,bottomTableSize do
local v = BottomFatherTable[i]
local eleData = dgsData[v]
renderGUI(v,mx,my,{eleData.enabled,eleData.enabled},nil,{0,0,0,0},0,0,1,eleData.visible)
end
for i=1,centerTableSize do
local v = CenterFatherTable[i]
local eleData = dgsData[v]
renderGUI(v,mx,my,{eleData.enabled,eleData.enabled},nil,{0,0,0,0},0,0,1,eleData.visible)
end
for i=1,topTableSize do
local v = TopFatherTable[i]
local eleData = dgsData[v]
renderGUI(v,mx,my,{eleData.enabled,eleData.enabled},nil,{0,0,0,0},0,0,1,eleData.visible)
end
if intfaceClickElementl then
MouseX,MouseY = intfaceMx,intfaceMy
else
if MouseData.clickl then
MouseX,MouseY = normalMx,normalMy
elseif MouseData.hit == MouseData.intfaceHitElement then
MouseX,MouseY = intfaceMx,intfaceMy
else
MouseX,MouseY = normalMx,normalMy
end
end
MouseData.dgsCursorPos = {MouseX,MouseY}
dxSetRenderTarget()
if not isCursorShowing() then
MouseData.hit = false
MouseData.Move = false
MouseData.MoveScroll = false
MouseData.scbClickData = false
MouseData.selectorClickData = false
MouseData.clickl = false
MouseData.clickr = false
MouseData.clickm = false
MouseData.lock3DInterface = false
MouseData.Scale = false
MouseData.scrollPane = false
MouseX,MouseY = nil,nil
end
triggerEvent("onDgsRender",resourceRoot)
dgsCheckHit(MouseData.hit,MouseX,MouseY)
if KeyHolder.repeatKey then
local tick = getTickCount()
if tick-KeyHolder.repeatStartTick >= KeyHolder.repeatDuration then
KeyHolder.repeatStartTick = tick
if getKeyState(KeyHolder.lastKey) then
onClientKeyTriggered(KeyHolder.lastKey)
else
KeyHolder = {}
end
end
end
if MouseHolder.repeatKey then
local tick = getTickCount()
if tick-MouseHolder.repeatStartTick >= MouseHolder.repeatDuration then
MouseHolder.repeatStartTick = tick
if getKeyState(MouseHolder.lastKey) and isElement(MouseHolder.element) then
onClientMouseTriggered(MouseHolder.lastKey)
else
MouseHolder = {}
end
end
end
end
local ticks = getTickCount()-tk
if debugMode then
if isElement(MouseData.hit) and debugMode == 2 then
local highlight = MouseData.hit
if dgsElementType[MouseData.hit] == "dgs-dxtab" then
highlight = dgsElementData[highlight].parent
end
if dgsGetType(highlight) ~= "dgs-dx3dinterface" and dgsGetType(highlight) ~= "dgs-dx3dtext" then
local absX,absY = dgsGetPosition(highlight,false)
local rltX,rltY = dgsGetPosition(highlight,true)
local absW,absH = dgsGetSize(highlight,false)
local rltW,rltH = dgsGetSize(highlight,true)
dxDrawText("ABS X: "..absX , sW*0.5-99,11,sW,sH,black)
dxDrawText("ABS Y: "..absY , sW*0.5-99,26,sW,sH,black)
dxDrawText("RLT X: "..rltX , sW*0.5-99,41,sW,sH,black)
dxDrawText("RLT Y: "..rltY , sW*0.5-99,56,sW,sH,black)
dxDrawText("ABS W: "..absW , sW*0.5-99,71,sW,sH,black)
dxDrawText("ABS H: "..absH , sW*0.5-99,86,sW,sH,black)
dxDrawText("RLT W: "..rltW , sW*0.5-99,101,sW,sH,black)
dxDrawText("RLT H: "..rltH , sW*0.5-99,116,sW,sH,black)
dxDrawText("ABS X: "..absX , sW*0.5-100,10)
dxDrawText("ABS Y: "..absY , sW*0.5-100,25)
dxDrawText("RLT X: "..rltX , sW*0.5-100,40)
dxDrawText("RLT Y: "..rltY , sW*0.5-100,55)
dxDrawText("ABS W: "..absW , sW*0.5-100,70)
dxDrawText("ABS H: "..absH , sW*0.5-100,85)
dxDrawText("RLT W: "..rltW , sW*0.5-100,100)
dxDrawText("RLT H: "..rltH , sW*0.5-100,115)
local sideColor = tocolor(dgsHSVToRGB(getTickCount()%3600/10,100,50))
local sideSize = math.sin(getTickCount()/500%2*math.pi)*2+4
local hSideSize = sideSize*0.5
local debugData = dgsElementData[highlight].debugData
if debugData then
local x,y,w,h = debugData[5],debugData[6],absW,absH
dxDrawLine(x-sideSize,y-hSideSize,x+w+sideSize,y-hSideSize,sideColor,sideSize,isPostGUI)
dxDrawLine(x-hSideSize,y,x-hSideSize,y+h,sideColor,sideSize,isPostGUI)
dxDrawLine(x+w+hSideSize,y,x+w+hSideSize,y+h,sideColor,sideSize,isPostGUI)
dxDrawLine(x-sideSize,y+h+hSideSize,x+w+sideSize,y+h+hSideSize,sideColor,sideSize,isPostGUI)
end
end
local parent = MouseData.hit
local parentIndex = 0
dxDrawText("Parent List:", sW*0.5+91,11,sW,sH,black)
dxDrawText("Parent List:", sW*0.5+90,10)
while(parent) do
dxDrawText("↓"..dgsGetPluginType(parent).."("..tostring(parent)..")", sW*0.5+101,26+parentIndex*15,sW,sH,black)
dxDrawText("↓"..dgsGetPluginType(parent).."("..tostring(parent)..")", sW*0.5+100,25+parentIndex*15)
parent = dgsGetParent(parent)
parentIndex = parentIndex+1
end
dxDrawText("DGS Root("..tostring(resourceRoot)..")", sW*0.5+100,26+parentIndex*15,sW,sH,black)
dxDrawText("DGS Root("..tostring(resourceRoot)..")", sW*0.5+99,25+parentIndex*15)
end
local version = getElementData(resourceRoot,"Version") or "?"
dxDrawText("Thisdp's Dx Lib(DGS)",6,sH*0.4-129,sW,sH,black)
dxDrawText("Thisdp's Dx Lib(DGS)",5,sH*0.4-130)
dxDrawText("Version: "..version,6,sH*0.4-114,sW,sH,black)
dxDrawText("Version: "..version,5,sH*0.4-115)
dxDrawText("Render Time: "..ticks.." ms",11,sH*0.4-99,sW,sH,black)
local tickColor
if ticks <= 8 then
tickColor = green
elseif ticks <= 20 then
tickColor = yellow
else
tickColor = red
end
dxDrawText("Render Time: "..ticks.." ms",10,sH*0.4-100,_,_,tickColor)
local Focused = MouseData.nowShow and dgsGetPluginType(MouseData.nowShow).."("..getElementID(MouseData.nowShow)..")" or "None"
local enterStr = MouseData.hit and dgsGetPluginType(MouseData.hit).." ("..getElementID(MouseData.hit)..")" or "None"
local leftStr = MouseData.clickl and dgsGetPluginType(MouseData.clickl).." ("..getElementID(MouseData.clickl)..")" or "None"
local rightStr = MouseData.clickr and dgsGetPluginType(MouseData.clickr).." ("..getElementID(MouseData.clickr)..")" or "None"
dxDrawText("Focused: "..Focused,6,sH*0.4-84,sW,sH,black)
dxDrawText("Focused: "..Focused,5,sH*0.4-85)
dxDrawText("Enter: "..enterStr,11,sH*0.4-69,sW,sH,black)
dxDrawText("Enter: "..enterStr,10,sH*0.4-70)
dxDrawText("Click:",11,sH*0.4-54,sW,sH,black)
dxDrawText("Click:",10,sH*0.4-55)
dxDrawText(" Left: "..leftStr,11,sH*0.4-39,sW,sH,black)
dxDrawText(" Left: "..leftStr,10,sH*0.4-40)
dxDrawText(" Right: "..rightStr,11,sH*0.4-24,sW,sH,black)
dxDrawText(" Right: "..rightStr,10,sH*0.4-25)
DGSCount = 0
for i=1,#dgsType do
local value = dgsType[i]
local elements = #getElementsByType(value)
DGSCount = DGSCount+elements
local x = 15
if value == "dgs-dxtab" or value == "dgs-dxcombobox-Box" then
x = 30
end
dxDrawText(value.." : "..elements,x+1,sH*0.4+15*i+6,sW,sH,black)
dxDrawText(value.." : "..elements,x,sH*0.4+15*i+5)
end
dxDrawText("Rendering: "..DGSShow,11,sH*0.4-9,sW,sH,black)
dxDrawText("Rendering: "..DGSShow,10,sH*0.4-10,sW,sH,green)
dxDrawText("Created: "..DGSCount,11,sH*0.4+6,sW,sH,black)
dxDrawText("Created: "..DGSCount,10,sH*0.4+5,sW,sH,yellow)
local anim = tableCount(animGUIList)
local move = tableCount(moveGUIList)
local size = tableCount(sizeGUIList)
local alp = tableCount(alphaGUIList)
local all = anim+move+size+alp
dxDrawText("Running Animation("..all.."):",301,sH*0.4-114,sW,sH,black)
dxDrawText("Running Animation("..all.."):",300,sH*0.4-115)
dxDrawText("Anim:"..anim,301,sH*0.4-99,sW,sH,black)
dxDrawText("Anim:"..anim,300,sH*0.4-100)
dxDrawText("Move:"..move,301,sH*0.4-84,sW,sH,black)
dxDrawText("Move:"..move,300,sH*0.4-85)
dxDrawText("Size:"..size,301,sH*0.4-69,sW,sH,black)
dxDrawText("Size:"..size,300,sH*0.4-70)
dxDrawText("Alpha:"..alp,301,sH*0.4-54,sW,sH,black)
dxDrawText("Alpha:"..alp,300,sH*0.4-55)
ResCount = 0
for ka,va in pairs(boundResource) do
if type(ka) == "userdata" and va then
local resDGSCnt = tableCount(va)
if resDGSCnt ~= 0 then
ResCount = ResCount +1
dxDrawText(getResourceName(ka).." : "..resDGSCnt,301,sH*0.4+15*(ResCount+1)+1,sW,sH,black)
dxDrawText(getResourceName(ka).." : "..resDGSCnt,300,sH*0.4+15*(ResCount+1))
end
end
end
dxDrawText("Resource Elements("..ResCount.."):",301,sH*0.4+16,sW,sH,black)
dxDrawText("Resource Elements("..ResCount.."):",300,sH*0.4+15)
end
end
function renderGUI(source,mx,my,enabled,rndtgt,position,OffsetX,OffsetY,parentAlpha,visible,checkElement)
local isElementInside = false
local eleData = dgsElementData[source]
local enabled = {enabled[1] and eleData.enabled,eleData.enabled}
if eleData.visible and visible and isElement(source) then
visible = eleData.visible
local eleType = dgsElementType[source]
if eleType == "dgs-dxscrollbar" then
local pnt = eleData.attachedToParent
if isElement(pnt) and dgsElementData[pnt] then
if not dgsElementData[pnt].visible then return end
parentAlpha = parentAlpha*dgsElementData[pnt].alpha
end
end
local rndtgt = isElement(rndtgt) and rndtgt or false
local globalBlendMode = rndtgt and "modulate_add" or "blend"
dxSetBlendMode(globalBlendMode)
if debugMode then
DGSShow = DGSShow+1
end
local parent,children,parentAlpha = FatherTable[source] or false,ChildrenTable[source] or {},(eleData.alpha or 1)*parentAlpha
local eleTypeP,eleDataP = dgsElementType[parent],dgsElementData[parent]
dxSetRenderTarget(rndtgt)
local absPos = eleData.absPos
local absSize = eleData.absSize
if eleData.externalFunction then
if eleData.externalFunction.dgsGetPosition then
absPos = eleData.externalFunction.dgsGetPosition(eleData.externalRef,false)
end
if eleData.externalFunction.dgsGetSize then
absSize = eleData.externalFunction.dgsGetPosition(eleData.externalRef,false)
end
end
--Side Processing
local PosX,PosY,w,h = 0,0,0,0
if eleTypeP == "dgs-dxwindow" then
PosY = (not eleDataP.ignoreTitle and not eleData.ignoreParentTitle) and PosY+(eleDataP.titleHeight or 0) or PosY
elseif eleTypeP == "dgs-dxtab" then
local gpEleData = dgsElementData[FatherTable[parent]]
local gpSize = gpEleData.absSize
local tabHeight = gpEleData.tabHeight[2] and gpEleData.tabHeight[1]*gpSize[2] or gpEleData.tabHeight[1]
PosY = PosY+tabHeight
w,h = gpSize[1],gpSize[2]-tabHeight
end
if eleType ~= "dgs-dxtab" then
absPos = absPos or {0,0}
absSize = absSize or {0,0}
PosX,PosY = PosX+absPos[1],PosY+absPos[2]
w,h = absSize[1],absSize[2]
end
if eleData.lor == "right" then
local pSize = parent and eleDataP.absSize or {sW,sH}
PosX = pSize[1]-PosX
end
if eleData.tob == "bottom" then
local pSize = parent and eleDataP.absSize or {sW,sH}
PosY = pSize[2]-PosY
end
local x,y = PosX+OffsetX,PosY+OffsetY
OffsetX,OffsetY = 0,0
position = {position[1]+x,position[2]+y,position[3]+x,position[4]+y}
local isPostGUI = not debugMode and (not rndtgt) and (dgsRenderSetting.postGUI == nil and eleData.postGUI) or dgsRenderSetting.postGUI
if eleDataP and eleDataP.renderTarget_parent == rndtgt and rndtgt then
position[1],position[2] = x,y
end
local x,y,cx,cy = position[1],position[2],position[3],position[4]
self = source
renderArguments = {x,y,w,h,cx,cy}
if x and y then
------------------------------------
if eleData.functionRunBefore then
local fnc = eleData.functions
if type(fnc) == "table" then
fnc[1](unpack(fnc[2]))
end
end
------------------------------------
if eleData.PixelInt then x,y,w,h = x-x%1,y-y%1,w-w%1,h-h%1 end
------------------------------------Main Renderer
local _mx,_my,rt,noRender
if dgsRenderer[eleType] then
--local usingBlurBox =
rt,noRender,_mx,_my,offx,offy = dgsRenderer[eleType](source,x,y,w,h,mx,my,cx,cy,enabled,eleData,parentAlpha,isPostGUI,rndtgt,position,OffsetX,OffsetY,visible)
if MouseData.hit then
MouseData.WithinElements[MouseData.hit] = true
end
if debugMode then
dgsElementData[source].debugData = {x,y,w,h,cx,cy}
end
rndtgt = rt or rndtgt
OffsetX,OffsetY = offx or OffsetX,offy or OffsetY
end
mx,my = _mx or mx,_my or my
------------------------------------
if not eleData.functionRunBefore then
local fnc = eleData.functions
if type(fnc) == "table" then
fnc[1](unpack(fnc[2]))
end
end
------------------------------------OutLine
if not noRender then
local outlineData = eleData.outline
if outlineData then
local sideColor = outlineData[3]
local sideSize = outlineData[2]
local hSideSize = sideSize*0.5
sideColor = applyColorAlpha(sideColor,parentAlpha)
local side = outlineData[1]
if side == "in" then
dxDrawLine(x,y+hSideSize,x+w,y+hSideSize,sideColor,sideSize,isPostGUI)
dxDrawLine(x+hSideSize,y,x+hSideSize,y+h,sideColor,sideSize,isPostGUI)
dxDrawLine(x+w-hSideSize,y,x+w-hSideSize,y+h,sideColor,sideSize,isPostGUI)
dxDrawLine(x,y+h-hSideSize,x+w,y+h-hSideSize,sideColor,sideSize,isPostGUI)
elseif side == "center" then
dxDrawLine(x-hSideSize,y,x+w+hSideSize,y,sideColor,sideSize,isPostGUI)
dxDrawLine(x,y+hSideSize,x,y+h-hSideSize,sideColor,sideSize,isPostGUI)
dxDrawLine(x+w,y+hSideSize,x+w,y+h-hSideSize,sideColor,sideSize,isPostGUI)
dxDrawLine(x-hSideSize,y+h,x+w+hSideSize,y+h,sideColor,sideSize,isPostGUI)
elseif side == "out" then
dxDrawLine(x-sideSize,y-hSideSize,x+w+sideSize,y-hSideSize,sideColor,sideSize,isPostGUI)
dxDrawLine(x-hSideSize,y,x-hSideSize,y+h,sideColor,sideSize,isPostGUI)
dxDrawLine(x+w+hSideSize,y,x+w+hSideSize,y+h,sideColor,sideSize,isPostGUI)
dxDrawLine(x-sideSize,y+h+hSideSize,x+w+sideSize,y+h+hSideSize,sideColor,sideSize,isPostGUI)
end
end
else
visible = false
end
------------------------------------
else
visible = false
end
local oldMouseIn = eleData.rndTmp_mouseIn or false
local newMouseIn = MouseData.hit and true or false
if eleData.enableFullEnterLeaveCheck then
if oldMouseIn ~= newMouseIn then
eleData.rndTmp_mouseIn = newMouseIn
triggerEvent("onDgsElement"..(newMouseIn and "Enter" or "Leave"),source)
end
end
if eleData.renderEventCall then
triggerEvent("onDgsElementRender",source,x,y,w,h)
end
if not eleData.hitoutofparent then
if MouseData.hit ~= source then
enabled[1] = false
end
end
local childrenCnt = #children
if childrenCnt ~= 0 then
if eleType == "dgs-dxtabpanel" then
for i=1,childrenCnt do
local child = children[i]
if dgsElementType[child] ~= "dgs-dxtab" then
isElementInside = renderGUI(child,mx,my,enabled,rndtgt,position,OffsetX,OffsetY,parentAlpha,visible,checkElement) or isElementInside
end
end
elseif eleType == "dgs-dxgridlist" then
for i=1,childrenCnt do
local child = children[i]
if not dgsElementData[child].attachedToGridList then
isElementInside = renderGUI(child,mx,my,enabled,rndtgt,position,OffsetX,OffsetY,parentAlpha,visible,checkElement) or isElementInside
end
end
else
for i=1,childrenCnt do
isElementInside = renderGUI(children[i],mx,my,enabled,rndtgt,position,OffsetX,OffsetY,parentAlpha,visible,checkElement) or isElementInside
end
end
end
dxSetBlendMode("blend")
end
return isElementInside or source == checkElement
end
addEventHandler("onClientRender",root,dgsCoreRender,false,dgsRenderSetting.renderPriority)
addEventHandler("onClientKey",root,function(button,state)
if button == "mouse_wheel_up" or button == "mouse_wheel_down" then
if isElement(MouseData.enter) then
triggerEvent("onDgsMouseWheel",MouseData.enter,button == "mouse_wheel_down" and -1 or 1)
end
local scroll = button == "mouse_wheel_down" and 1 or -1
local scrollbar = MouseData.enter
local dgsType = dgsGetType(MouseData.enter)
if dgsGetType(scrollbar) == "dgs-dxscrollbar" then
scrollScrollBar(scrollbar,button == "mouse_wheel_down" or false)
elseif dgsType == "dgs-dxgridlist" then
local scrollbar
local scrollbar1,scrollbar2 = dgsElementData[MouseData.enter].scrollbars[1],dgsElementData[MouseData.enter].scrollbars[2]
local visibleScb1,visibleScb2 = dgsGetVisible(scrollbar1),dgsGetVisible(scrollbar2)
if visibleScb1 and not visibleScb2 then
scrollbar = scrollbar1
elseif visibleScb2 and not visibleScb1 then
scrollbar = scrollbar2
elseif visibleScb1 and visibleScb2 then
local whichScrollBar = dgsElementData[MouseData.enter].mouseWheelScrollBar and 2 or 1
scrollbar = dgsElementData[MouseData.enter].scrollbars[whichScrollBar]
end
if scrollbar then
scrollScrollBar(scrollbar,button == "mouse_wheel_down" or false)
end
elseif dgsType == "dgs-dxmemo" then
local scrollbar = dgsElementData[MouseData.enter].scrollbars[1]
if dgsGetVisible(scrollbar) then
scrollScrollBar(scrollbar,button == "mouse_wheel_down" or false)
end
elseif isElement(MouseData.scrollPane) then
local scrollbar
local scrollbar1,scrollbar2 = dgsElementData[MouseData.scrollPane].scrollbars[1],dgsElementData[MouseData.scrollPane].scrollbars[2]
local visibleScb1,visibleScb2 = dgsGetVisible(scrollbar1),dgsGetVisible(scrollbar2)
if visibleScb1 and not visibleScb2 then
scrollbar = scrollbar1
elseif visibleScb2 and not visibleScb1 then
scrollbar = scrollbar2
elseif visibleScb1 and visibleScb2 then
local whichScrollBar = dgsElementData[MouseData.scrollPane].mouseWheelScrollBar and 2 or 1
scrollbar = dgsElementData[MouseData.scrollPane].scrollbars[whichScrollBar]
end
if scrollbar then
scrollScrollBar(scrollbar,button == "mouse_wheel_down" or false)
end
elseif dgsType == "dgs-dxtabpanel" or dgsType == "dgs-dxtab" then
local tabpanel = MouseData.enter
if dgsType == "dgs-dxtab" then
tabpanel = dgsElementData[MouseData.enter].parent
end
local width = dgsTabPanelGetWidth(tabpanel)
local w,h = dgsElementData[tabpanel].absSize[1],dgsElementData[tabpanel].absSize[2]
if width > w then
local mx,my = getCursorPosition()
mx,my = (mx or -1)*sW,(my or -1)*sH
local _,y = dgsGetPosition(tabpanel,false,true)
local height = dgsElementData[tabpanel].tabHeight[2] and dgsElementData[tabpanel].tabHeight[1]*h or dgsElementData[tabpanel].tabHeight[1]
if my < y+height then
local speed = dgsElementData[tabpanel].scrollSpeed[2] and dgsElementData[tabpanel].scrollSpeed[1] or dgsElementData[tabpanel].scrollSpeed[1]/width
local orgoff = dgsElementData[tabpanel].showPos
orgoff = math.restrict(orgoff+scroll*speed,0,1)
dgsSetData(tabpanel,"showPos",orgoff)
end
end
elseif dgsType == "dgs-dxcombobox-Box" then
local combo = dgsElementData[MouseData.enter].myCombo
local scrollbar = dgsElementData[combo].scrollbar
if dgsGetVisible(scrollbar) then
scrollScrollBar(scrollbar,button == "mouse_wheel_down" or false)
end
elseif dgsType == "dgs-dxselector" then
if dgsElementData[MouseData.enter].enableScroll and MouseData.nowShow == MouseData.enter then
local itemData = dgsElementData[MouseData.enter].itemData
local itemCount = #itemData
local currentItem = dgsElementData[MouseData.enter].selectedItem
dgsSelectorSetSelectedItem(MouseData.enter,math.floor(math.restrict(currentItem+(button == "mouse_wheel_down" and 1 or -1),1,itemCount)))
end
end
elseif state then
local dgsType = dgsGetType(MouseData.nowShow)
if dgsType == "dgs-dxmemo" or dgsType == "dgs-dxedit" then
if not button:find("mouse") then
local typingSound = dgsElementData[MouseData.nowShow].typingSound
if typingSound then
playSound(typingSound)
end
end
end
end
end)
function onClientKeyTriggered(button)
local makeEventCancelled = false
if dgsGetType(MouseData.nowShow) == "dgs-dxedit" then
local dgsEdit = MouseData.nowShow
local text = dgsElementData[dgsEdit].text
local shift = getKeyState("lshift") or getKeyState("rshift")
local ctrl = getKeyState("lctrl") or getKeyState("rctrl")
if button == "arrow_l" then
dgsEditMoveCaret(dgsEdit,-1,shift)
elseif button == "arrow_r" then
dgsEditMoveCaret(dgsEdit,1,shift)
elseif button == "arrow_u" then
local cmd = dgsElementData[dgsEdit].mycmd
if dgsGetPluginType(cmd) == "dgs-dxcmd" then
local int = dgsElementData[cmd].cmdCurrentHistory+1
local history = dgsElementData[cmd].cmdHistory
if history[int] then
dgsSetData(cmd,"cmdCurrentHistory",int)
dgsSetText(dgsEdit,history[int])
dgsEditSetCaretPosition(dgsEdit,#history[int])
end
end
elseif button == "arrow_d" then
local cmd = dgsElementData[dgsEdit].mycmd
if dgsGetPluginType(cmd) == "dgs-dxcmd" then
local int = dgsElementData[cmd].cmdCurrentHistory-1
local history = dgsElementData[cmd].cmdHistory
if history[int] then
dgsSetData(cmd,"cmdCurrentHistory",int)
dgsSetText(dgsEdit,history[int])
dgsEditSetCaretPosition(dgsEdit,#history[int])
end
end
elseif button == "home" then
dgsEditSetCaretPosition(dgsEdit,0,shift)
elseif button == "end" then
dgsEditSetCaretPosition(dgsEdit,#text,shift)
elseif button == "delete" then
if not dgsElementData[dgsEdit].readOnly then
local cpos = dgsElementData[dgsEdit].caretPos
local spos = dgsElementData[dgsEdit].selectFrom
if cpos ~= spos then
dgsEditDeleteText(dgsEdit,cpos,spos)
dgsElementData[dgsEdit].selectFrom = dgsElementData[dgsEdit].caretPos
else
dgsEditDeleteText(dgsEdit,cpos,cpos+1)
end
end
elseif button == "backspace" then
if not dgsElementData[dgsEdit].readOnly then
local cpos = dgsElementData[dgsEdit].caretPos
local spos = dgsElementData[dgsEdit].selectFrom
if cpos ~= spos then
dgsEditDeleteText(dgsEdit,cpos,spos)
dgsElementData[dgsEdit].selectFrom = dgsElementData[dgsEdit].caretPos
else
dgsEditDeleteText(dgsEdit,cpos-1,cpos)
end
end
elseif button == "c" or button == "x" and ctrl then
if dgsElementData[dgsEdit].allowCopy then
local cpos = dgsElementData[dgsEdit].caretPos
local spos = dgsElementData[dgsEdit].selectFrom
if cpos ~= spos then
local deleteText = button == "x" and not dgsElementData[dgsEdit].readOnly
local theText = dgsEditGetPartOfText(dgsEdit,cpos,spos,deleteText)
setClipboard(theText)
end
end
elseif button == "z" and ctrl then
dgsEditDoOpposite(dgsEdit,true)
elseif button == "y" and ctrl then
dgsEditDoOpposite(dgsEdit,false)
elseif button == "tab" then
makeEventCancelled = true
local autoCompleteShow = dgsElementData[dgsEdit].autoCompleteShow
if autoCompleteShow then
dgsSetText(dgsEdit,autoCompleteShow[1])
else
triggerEvent("onDgsEditPreSwitch",dgsEdit)
end
elseif button == "a" and ctrl then
dgsSetData(dgsEdit,"caretPos",0)
local text = dgsElementData[dgsEdit].text
dgsSetData(dgsEdit,"selectFrom",utf8Len(text))
end
elseif dgsGetType(MouseData.nowShow) == "dgs-dxmemo" then
local memo = MouseData.nowShow
local shift = getKeyState("lshift") or getKeyState("rshift")
local ctrl = getKeyState("lctrl") or getKeyState("rctrl")
local isWordWrap = dgsElementData[memo].wordWrap
if button == "arrow_l" then
dgsMemoMoveCaret(memo,-1,0,shift)
elseif button == "arrow_r" then
dgsMemoMoveCaret(memo,1,0,shift)
elseif button == "arrow_u" then
dgsMemoMoveCaret(memo,0,-1,shift,true)
elseif button == "arrow_d" then
dgsMemoMoveCaret(memo,0,1,shift,true)
elseif button == "home" then
if isWordWrap then
local text = dgsElementData[memo].text
local index,line = dgsElementData[memo].caretPos[1],dgsElementData[memo].caretPos[2]
local weakLineIndex,weakLine = dgsMemoFindWeakLineInStrongLine(text[line],index)
local currentPos = utf8Len(text[line][0],1,index)-utf8Len(text[line][1][weakLine][0],1,weakLineIndex)
dgsMemoSetCaretPosition(memo,currentPos,ctrl and 1,shift)
else
dgsMemoSetCaretPosition(memo,0,ctrl and 1,shift)
end
elseif button == "end" then
local text = dgsElementData[memo].text
local index,line = dgsElementData[memo].caretPos[1],dgsElementData[memo].caretPos[2]
if isWordWrap then
local weakLineIndex,weakLine = dgsMemoFindWeakLineInStrongLine(dgsElementData[memo].text[line],index,true)
local currentPos = utf8Len(dgsElementData[memo].text[line][0],1,index)-utf8Len(text[line][1][weakLine][0],1,weakLineIndex)+dgsElementData[memo].text[line][1][weakLine][3]
dgsMemoSetCaretPosition(memo,currentPos,ctrl and #text,shift,not ctrl and true)
else
dgsMemoSetCaretPosition(memo,utf8Len(text[line][0] or ""),ctrl and #text,shift)
end
elseif button == "delete" then
if not dgsElementData[memo].readOnly then
local cpos = dgsElementData[memo].caretPos
local spos = dgsElementData[memo].selectFrom
if cpos[1] ~= spos[1] or cpos[2] ~= spos[2] then
dgsMemoDeleteText(memo,cpos[1],cpos[2],spos[1],spos[2])
dgsElementData[memo].selectFrom = dgsElementData[memo].caretPos
else
local tarindex,tarline = dgsMemoSeekPosition(dgsElementData[memo].text,cpos[1]+1,cpos[2])
dgsMemoDeleteText(memo,cpos[1],cpos[2],tarindex,tarline)
end
end
elseif button == "backspace" then
if not dgsElementData[memo].readOnly then
local cpos = dgsElementData[memo].caretPos
local spos = dgsElementData[memo].selectFrom
if cpos[1] ~= spos[1] or cpos[2] ~= spos[2] then
dgsMemoDeleteText(memo,cpos[1],cpos[2],spos[1],spos[2])
dgsElementData[memo].selectFrom = dgsElementData[memo].caretPos
else
local tarindex,tarline = dgsMemoSeekPosition(dgsElementData[memo].text,cpos[1]-1,cpos[2])
dgsMemoDeleteText(memo,tarindex,tarline,cpos[1],cpos[2])
end
end
elseif button == "c" or button == "x" and ctrl then
if dgsElementData[memo].allowCopy then
local cpos = dgsElementData[memo].caretPos
local spos = dgsElementData[memo].selectFrom
if not(cpos[1] == spos[1] and cpos[2] == spos[2]) then
local deleteText = button == "x" and not dgsElementData[memo].readOnly
local theText = dgsMemoGetPartOfText(memo,cpos[1],cpos[2],spos[1],spos[2],deleteText)
setClipboard(theText)
end
end
elseif button == "a" and ctrl then
dgsMemoSetSelectedArea(memo,0,1,"all")
end
elseif dgsGetType(MouseData.nowShow) == "dgs-dxgridlist" then
local gridlist = MouseData.nowShow
if dgsElementData[gridlist].enableNavigation then
if button == "arrow_u" then
if dgsElementData[gridlist].selectionMode ~= 2 then
local lastSelected = dgsElementData[gridlist].lastSelectedItem
local nextSelected = lastSelected[1]-1 <= 1 and 1 or lastSelected[1]-1
while(true) do
if dgsGridListGetRowSelectable(gridlist,nextSelected) then
dgsGridListSetSelectedItem(gridlist,nextSelected,lastSelected[2],true)
break
else
nextSelected = nextSelected-1
if nextSelected-1 < 1 then break end
end
end
end
elseif button == "arrow_d" then
if dgsElementData[gridlist].selectionMode ~= 2 then
local lastSelected = dgsElementData[gridlist].lastSelectedItem
local rowCount = #dgsElementData[gridlist].rowData
local nextSelected = lastSelected[1]+1 >= rowCount and rowCount or lastSelected[1]+1
while(true) do
if dgsGridListGetRowSelectable(gridlist,nextSelected) then
dgsGridListSetSelectedItem(gridlist,nextSelected,lastSelected[2],true)
break
else
nextSelected = nextSelected+1
if nextSelected+1 > rowCount then
break
end
end
end
dgsGridListSetSelectedItem(gridlist,nextSelected,lastSelected[2],true)
end
elseif button == "arrow_l" then
if dgsElementData[gridlist].selectionMode ~= 1 then
local lastSelected = dgsElementData[gridlist].lastSelectedItem
local nextSelected = lastSelected[2]-1
dgsGridListSetSelectedItem(gridlist,lastSelected[1],nextSelected <= 1 and 1 or nextSelected,true)
end
elseif button == "arrow_r" then
if dgsElementData[gridlist].selectionMode ~= 1 then
local lastSelected = dgsElementData[gridlist].lastSelectedItem
local nextSelected = lastSelected[2]+1
local columCount = #dgsElementData[gridlist].columnData
dgsGridListSetSelectedItem(gridlist,lastSelected[1],nextSelected >= columCount and columCount or nextSelected,true)
end
end
end
end
return makeEventCancelled
end
KeyHolder = {}
function onClientKeyCheck(button,state)
if state then
if button:sub(1,5) ~= "mouse" then
if isTimer(KeyHolder.Timer) then killTimer(KeyHolder.Timer) end
KeyHolder = {}
KeyHolder.lastKey = button
KeyHolder.Timer = setTimer(function()
if not getKeyState(KeyHolder.lastKey) then
KeyHolder = {}
return
end
KeyHolder.repeatKey = true
KeyHolder.repeatStartTick = getTickCount()
KeyHolder.repeatDuration = 25
end,400,1)
if onClientKeyTriggered(button) then
cancelEvent()
end
end
end
end
addEventHandler("onClientKey",root,onClientKeyCheck)
function dgsCheckHit(hits,mx,my)
if not isElement(MouseData.clickl) or not (dgsGetType(MouseData.clickl) == "dgs-dxscrollbar" and MouseData.scbClickData == 3) then
if MouseData.enter ~= hits then
if isElement(MouseData.enter) then
triggerEvent("onDgsMouseLeave",MouseData.enter,mx,my,hits)
if dgsGetType(MouseData.enter) == "dgs-dxgridlist" then
dgsSetData(MouseData.enter,"preSelect",{-1,-1})
end
end
if isElement(hits) then
triggerEvent("onDgsMouseEnter",hits,mx,my,MouseData.enter)
end
MouseData.lastEnter = MouseData.enter
MouseData.enter = hits
end
end
if dgsElementType[hits] == "dgs-dxtab" then
local parent = dgsElementData[hits].parent
dgsElementData[parent].preSelect = dgsElementData[parent].rndPreSelect
end
if isElement(hits) then
if MouseData.lastPos[1] ~= mx or MouseData.lastPos[2] ~= my then
triggerEvent("onDgsMouseMove",hits,mx,my)
end
end
if isElement(MouseData.clickl) then
if MouseData.lastPos[1] ~= mx or MouseData.lastPos[2] ~= my then
triggerEvent("onDgsMouseDrag",MouseData.clickl,mx,my)
end
if MouseData.Move then
local pos = {0,0}
local parent = FatherTable[MouseData.clickl]
if parent then
pos = {getParentLocation(parent)}
if dgsElementType[parent] == "dgs-dxwindow" then
if not dgsElementData[MouseData.clickl].ignoreParentTitle and not dgsElementData[parent].ignoreTitle then
pos[2] = pos[2] + (dgsElementData[parent].titleHeight or 0)
end
elseif dgsElementType[parent] == "dgs-dxtab" then
local tabpanel = dgsElementData[parent].parent
local size = dgsElementData[tabpanel].absSize[2]
local height = dgsElementData[tabpanel].tabHeight[2] and dgsElementData[tabpanel].tabHeight[1]*size or dgsElementData[tabpanel].tabHeight[1]
pos[2] = pos[2] + height
end
end
local posX = (mx-MouseData.Move[1]-pos[1])
local posY = (my-MouseData.Move[2]-pos[2])
local absPos = dgsElementData[MouseData.clickl].absPos
if absPos[1] ~= posX or absPos[2] ~= posY then
calculateGuiPositionSize(MouseData.clickl,posX,posY,false)
end
end
if MouseData.Scale then
local pos = {dgsGetPosition(MouseData.clickl,false,true)}
local addPos = {0,0}
local parent = FatherTable[MouseData.clickl]
if parent then
addPos = {getParentLocation(parent)}
if dgsElementType[parent] == "dgs-dxwindow" then
if not dgsElementData[MouseData.clickl].ignoreParentTitle and not dgsElementData[parent].ignoreTitle then
addPos[2] = addPos[2] + (dgsElementData[parent].titleHeight or 0)
end
elseif dgsElementType[parent] == "dgs-dxtab" then
local tabpanel = dgsElementData[parent].parent
local size = dgsElementData[tabpanel].absSize[2]
local height = dgsElementData[tabpanel].tabHeight[2] and dgsElementData[tabpanel].tabHeight[1]*size or dgsElementData[tabpanel].tabHeight[1]
addPos[2] = addPos[2] + height
end
end
local absPos = dgsElementData[MouseData.clickl].absPos
local _size = dgsElementData[MouseData.clickl].absSize
local siz = {_size[1],_size[2]}
local endr = pos[1] + siz[1]
local endd = pos[2] + siz[2]
local minSize = dgsElementData[MouseData.clickl].minSize or {10,10}
local minSizeX,minSizeY = minSize[1] or 10,minSize[2] or 10
if MouseData.Scale[5] == 1 then
local old = pos[1]
siz[1] = (siz[1]-(mx-MouseData.Scale[1]-old))
if siz[1] < minSizeX then
siz[1] = minSizeX
pos[1] = endr-siz[1]
else
pos[1] = (mx-MouseData.Scale[1])
end
end
if MouseData.Scale[5] == 3 then
siz[1] = (mx-pos[1]-MouseData.Scale[3])
if siz[1] < minSizeX then
siz[1] = minSizeX
end
end
if MouseData.Scale[6] == 2 then
local old = pos[2]
siz[2] = siz[2]-(my-MouseData.Scale[2]-old)
if siz[2] < minSizeY then
siz[2] = minSizeY
pos[2] = endd-siz[2]
else
pos[2] = (my-MouseData.Scale[2])
end
end
if MouseData.Scale[6] == 4 then
siz[2] = (my-pos[2]-MouseData.Scale[4])
if siz[2] < minSizeY then
siz[2] = minSizeY
end
end
local posX,posY = pos[1]-addPos[1],pos[2]-addPos[2]
local sizeX,sizeY = siz[1],siz[2]
local absSize = dgsElementData[MouseData.clickl].absSize
if posX+posY-absPos[1]-absPos[2] ~= 0 or sizeX+sizeY-absSize[1]-absSize[2] ~= 0 then
calculateGuiPositionSize(MouseData.clickl,posX,posY,false,sizeX,sizeY,false)
end
else
MouseData.lastPos = {-1,-1}
end
if not getKeyState("mouse1") then
MouseData.clickl = false
MouseData.scbClickData = false
MouseData.selectorClickData = false
MouseData.Move = false
MouseData.Scale = false
MouseData.lock3DInterface = false
end
if not getKeyState("mouse2") then
MouseData.clickr = false
end
else
MouseData.lastPos = {}
end
MouseData.lastPos = {mx,my}
end
function onClientMouseTriggered()
if MouseHolder.element == MouseData.enter then
local dgsType = dgsGetType(MouseHolder.element)
if dgsType == "dgs-dxscrollbar" then