It is currently October 26th, 2021, 11:48 am

Need Help with Mouse control on Shapes.

Help with creating, editing & fixing problems with skins
User avatar
KryptOnyx
Posts: 19
Joined: July 28th, 2021, 10:18 am

Re: Need Help with Mouse control on Shapes.

Post by KryptOnyx »

Wow! That's some awesome code Yincognito...it may take me a bit to understand how it works, especially the RegEx (that's still a mystery).
I should also say that this iteration of the project has some leftover concepts/process/code that are not essential...specifically the moving to -100,-100. Using Hidden flag is just as good.
I realize Meters cannot be Dynamically Created/Deleted (I tried...almost worked), which is why I am trying a two-part Skin.
I was using Sequence only as a Counter to make it easier to Write the Meters and FileIcon sections to a File.
There is the added bonus of easily Removing/Hiding the Last Tile placed because the Counter already tracks it.
Too much code to allow mid-sequence Tiles to be removed and resequencing remaining Tiles.
As for the Launcher I have modified the FileView sample to put Icon Images on the Hex Tiles, which is why you need a Sequence.
FileView will 'scroll' the set of Images if there are more than can be displayed.
I have no issue replacing sections of code that dont work properly. I move them to a ScrapBook file rather than deleting, because they may get used/modified later.
This will give me something to expand on over the weekend...and maybe HexIcon will be posted then.
Here is an example of the Circular variant (hard coded Tile positions).
HexIcon.Circular.variant.png
LMB Click the center Tile (the Base Hex) to Hide all others. Click again to show all.
RMB the center Tile goes back a Folder level (but not beyond the starting FilePath).
Cheers everyone!
You do not have the required permissions to view the files attached to this post.
Everything happens for a Reason, and could Not happen any other way.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Need Help with Mouse control on Shapes.

Post by Yincognito »

death.crafter wrote: August 12th, 2021, 7:09 amNow that's Yincognito for you.
Well, what can I say? I like challenges and don't like "impossible" things, so ... when I get the chance, I attack the problem. :lol:
death.crafter wrote: August 12th, 2021, 7:09 amBut the shapes will probably contain images, so I wonder if including the padding was a good choice :???:
Didn't thought about that, but why would it be? I mean, I only put the "padding" as 2nd Shape to emphasisize the 1st one, aka the hex, so the order could very well be (as it's normal), with the hex the last Shape in the list. Plus, the images you can include there would most likely placed "on top" of the shapes, cropped, resized and all, so I don't see a problem there... :???:

Using the images you mentioned earlier (had to rotated them a bit since the skin is originally configured to use the 0 starting degree, but didn't change the shape order or anything else besides integrating images in the "grand scheme of things", so to speak):
HexaLattice_1.0.0.rmskin
so everything appears to be just...
HexaFine.jpg
Not sure what you thought the problem would be, but I would very much be interested to find out, maybe I'm doing something wrong and the approach needs adjustment. :confused:
You do not have the required permissions to view the files attached to this post.
User avatar
death.crafter
Posts: 1070
Joined: April 24th, 2021, 8:13 pm

Re: Need Help with Mouse control on Shapes.

Post by death.crafter »

Yincognito wrote: August 12th, 2021, 11:24 am HexaFine.jpg

Not sure what you thought the problem would be, but I would very much be interested to find out, maybe I'm doing something wrong and the approach needs adjustment. :confused:
Lmao...

I didn't mean that. I meant in a general basis. An usual square image contained in a hexagon.
from the Realm of Death
My Current Desktop
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Need Help with Mouse control on Shapes.

Post by Yincognito »

death.crafter wrote: August 12th, 2021, 11:44 am Lmao...

I didn't mean that. I meant in a general basis. An usual square image contained in a hexagon.
Well, an usual square image contained in a hexagon would be ... unusual, wouldn't it? :lol:
Even so, it can be made to fit in the hexagon if the opaque pixels form a rectangular/square shape, and if not, Rainmeter's mouse actions being triggered only on opaque pixels in the image will automatically take care of that, assuming the opaque pixels in the image form a hexagonal shape, like above.
User avatar
death.crafter
Posts: 1070
Joined: April 24th, 2021, 8:13 pm

Re: Need Help with Mouse control on Shapes.

Post by death.crafter »

Yincognito wrote: August 12th, 2021, 12:03 pm Well, an usual square image contained in a hexagon would be ... unusual, wouldn't it? :lol:
Even so, it can be made to fit in the hexagon if the opaque pixels form a rectangular/square shape, and if not, Rainmeter's mouse actions being triggered only on opaque pixels in the image will automatically take care of that, assuming the opaque pixels in the image form a hexagonal shape, like above.
Yeah I guess you are right. They will be transparent anyway.
from the Realm of Death
My Current Desktop
User avatar
KryptOnyx
Posts: 19
Joined: July 28th, 2021, 10:18 am

Re: Need Help with Mouse control on Shapes.

Post by KryptOnyx »

@Yincognito : Try this for the Pointy Top Hex :D ...

Code: Select all

; Pointy Top Hex
Angle=30
SlotH=(#Radius#*1.5+#Stroke#+#Gap#)
SlotW=(#Radius#*Sqrt(3)+#Stroke#+#Gap#)
SlotY="((#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2)+Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#)*#SlotH#)"
SlotX="((#SlotW#/2*((Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#))%2))+Trunc(([$*MouseX*]-(#SlotW#/2*((Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#))%2)))/#SlotW#)*#SlotW#)"
I would still rather remove/hide the last Tile placed regardless which Tile is clicked.
When I save the pattern the Sequence cannot have any missing Tiles.

Any chance you could explain what Cleaner and [Next] does?
Much appreciated :D
Everything happens for a Reason, and could Not happen any other way.
User avatar
death.crafter
Posts: 1070
Joined: April 24th, 2021, 8:13 pm

Re: Need Help with Mouse control on Shapes.

Post by death.crafter »

I am curious how it can be done in vanilla Rainmeter.
from the Realm of Death
My Current Desktop
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Need Help with Mouse control on Shapes.

Post by Yincognito »

KryptOnyx wrote: August 12th, 2021, 1:03 pm @Yincognito : Try this for the Pointy Top Hex :D ...

Code: Select all

; Pointy Top Hex
Angle=30
SlotH=(#Radius#*1.5+#Stroke#+#Gap#)
SlotW=(#Radius#*Sqrt(3)+#Stroke#+#Gap#)
SlotY="((#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2)+Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#)*#SlotH#)"
SlotX="((#SlotW#/2*((Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#))%2))+Trunc(([$*MouseX*]-(#SlotW#/2*((Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#))%2)))/#SlotW#)*#SlotW#)"
Yeah, the angle part wasn't an initial requirement, so I left it for later to solve. The following code should do it, but it still has some "bugs" in that it doesn't properly synchronize the hex and image rotation for, say, 45 degrees or so - must be some litle formula that I wrote backwards, LOL (I moved all formulas in [Variables], so they are easier to edit or understand):

Code: Select all

[Variables]
Cleaner="(?:^[^[\x200B]].*|.*[^[\x200B]]$)":"","(?:^[\x200B]|[\x200B]$)":"","(?:^\\\d+|\\\d+$)":""
Status=
Next=0
RoundingRatio=1.1
Radius=30
Stroke=3
Gap=6
Angle=30
SlotW="(Abs(90-#Angle#)%180=90?(#Radius#*1.5+#Stroke#+#Gap#):(#Radius#*Sqrt(3)+#Stroke#+#Gap#))"
SlotH="(Abs(90-#Angle#)%180=90?(#Radius#*Sqrt(3)+#Stroke#+#Gap#):(#Radius#*1.5+#Stroke#+#Gap#))"
SlotX="(Abs(90-#Angle#)%180=90?((#Gap#/2+#Stroke#/2+#Radius#-#SlotW#/2)+Trunc(([$*MouseX*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotW#/2))/#SlotW#)*#SlotW#):((#SlotW#/2*((Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#))%2))+Trunc(([$*MouseX*]-(#SlotW#/2*((Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#))%2)))/#SlotW#)*#SlotW#))"
SlotY="(Abs(90-#Angle#)%180=90?((#SlotH#/2*((Trunc(([$*MouseX*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotW#/2))/#SlotW#))%2))+Trunc(([$*MouseY*]-(#SlotH#/2*((Trunc(([$*MouseX*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotW#/2))/#SlotW#))%2)))/#SlotH#)*#SlotH#):((#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2)+Trunc(([$*MouseY*]-(#Gap#/2+#Stroke#/2+#Radius#-#SlotH#/2))/#SlotH#)*#SlotH#))"
Hidden="(((#SlotX#+#SlotW#+#Radius#*(Abs(90-#Angle#)%180=90?0.25:0)>[*Background:W*])||(#SlotY#+#SlotH#+#Radius#*(Abs(90-#Angle#)%180=90?0:0.25)>[*Background:H*]))?1:0)"
HexaPath="(#SlotW#/2+#Radius#*Cos(Rad(#Angle#+0))),(#SlotH#/2+#Radius#*Sin(Rad(#Angle#+0))) | LineTo (#SlotW#/2+#Radius#*Cos(Rad(#Angle#+60))),(#SlotH#/2+#Radius#*Sin(Rad(#Angle#+60))) | LineTo (#SlotW#/2+#Radius#*Cos(Rad(#Angle#+120))),(#SlotH#/2+#Radius#*Sin(Rad(#Angle#+120))) | LineTo (#SlotW#/2+#Radius#*Cos(Rad(#Angle#+180))),(#SlotH#/2+#Radius#*Sin(Rad(#Angle#+180))) | LineTo (#SlotW#/2+#Radius#*Cos(Rad(#Angle#+240))),(#SlotH#/2+#Radius#*Sin(Rad(#Angle#+240))) | LineTo (#SlotW#/2+#Radius#*Cos(Rad(#Angle#+300))),(#SlotH#/2+#Radius#*Sin(Rad(#Angle#+300))) | ClosePath 1"
PaddingPath="(#SlotW#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Cos(Rad(#Angle#+0))),(#SlotH#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Sin(Rad(#Angle#+0))) | LineTo (#SlotW#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Cos(Rad(#Angle#+60))),(#SlotH#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Sin(Rad(#Angle#+60))) | LineTo (#SlotW#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Cos(Rad(#Angle#+120))),(#SlotH#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Sin(Rad(#Angle#+120))) | LineTo (#SlotW#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Cos(Rad(#Angle#+180))),(#SlotH#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Sin(Rad(#Angle#+180))) | LineTo (#SlotW#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Cos(Rad(#Angle#+240))),(#SlotH#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Sin(Rad(#Angle#+240))) | LineTo (#SlotW#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Cos(Rad(#Angle#+300))),(#SlotH#/2+(#Radius#+#Stroke#/2+#Gap#/2)*#RoundingRatio#*Sin(Rad(#Angle#+300))) | ClosePath 1"
TextX="(#SlotX#+#SlotW#/2)"
TextY="(#SlotY#+#SlotH#/2)"
ImageX="(Abs(90-#Angle#)%180=90?(#SlotX#-#Radius#*0.25+2):(#SlotX#-2))"
ImageY="(Abs(90-#Angle#)%180=90?(#SlotY#-2):(#SlotY#-#Radius#*0.25+3))"
ImageW="(#Radius#*2+#Stroke#+(Abs(90-#Angle#)%180=90?0:2))"
ImageH="(#Radius#*2+#Stroke#+(Abs(90-#Angle#)%180=90?2:0))"
MaxNext=99
FontSize=10
FontColor=255,255,0,255
HexaStrokeColor=255,0,0,255
SlotStrokeColor=255,255,0,255
NearTransparentColor=0,0,0,1
BackgroundColor=255,0,255,100

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!AutoSelectScreen "1" "#CURRENTCONFIG#"]

---Measures---

[Next]
Measure=String
String=#Status#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"S0=0","^.*?S(\d+)=0.*$":"[\x200B]\1[\x200B]","#Cleaner#","^$":"#MaxNext#"
DynamicVariables=1

---Styles---

[Hex]
Group=SGroup
Hidden=1
Shape=Path HexaPath | StrokeWidth #Stroke# | StrokeColor #HexaStrokeColor#
HexaPath=#HexaPath#
Shape2=Path PaddingPath | StrokeWidth 0 | StrokeColor 0,0,0,0 | Fill Color #NearTransparentColor#
PaddingPath=#PaddingPath#
;Shape3=Rectangle 0,0,#SlotW#,#SlotH# | StrokeWidth #Stroke# | StrokeColor #SlotStrokeColor# | Fill Color 0,0,0,0
UpdateDivider=-1
OnUpdateAction=[!SetVariable Status "#Status##CURRENTSECTION#=[#CURRENTSECTION#:W],"]
LeftMouseUpAction=[!SetOption #CURRENTSECTION# Hidden 1][!SetOption #CURRENTSECTION#T Hidden 1][!SetOption #CURRENTSECTION#I Hidden 1][!SetVariable Status ""][!UpdateMeterGroup SGroup][!Redraw][!UpdateMeasure Next][!UpdateMeter Background]
DynamicVariables=1

[Text]
Group=SGroup
Hidden=1
FontFace=Tahoma
FontWeight=700
FontSize=#FontSize#
FontColor=#FontColor#
StringEffect=Shadow
FontEffectColor=0,0,0,255
StringAlign=CenterCenter
UpdateDivider=-1
DynamicVariables=1

[Image]
Group=SGroup
Hidden=1
ImageName=#@##CURRENTSECTION#.png
ImageRotate=(90-#Angle#)
W=#ImageW#
H=#ImageH#
UpdateDivider=-1
DynamicVariables=1

---Meters---

[Background]
Meter=Shape
Shape=Rectangle #WORKAREAX#,#WORKAREAY#,#WORKAREAWIDTH#,#WORKAREAHEIGHT# | Fill Color #BackgroundColor# | StrokeWidth 0
UpdateDivider=-1
LeftMouseUpAction=[!SetVariable Status ""][!SetOption S[Next] X #SlotX#][!SetOption S[Next] Y #SlotY#][!SetOption S[Next] Hidden #Hidden#][!SetOption S[Next]T X #TextX#][!SetOption S[Next]T Y #TextY#][!SetOption S[Next]T Text "[Next]"][!SetOption S[Next]T Hidden #Hidden#][!SetOption S[Next]I X #ImageX#][!SetOption S[Next]I Y #ImageY#][!SetOption S[Next]I Hidden #Hidden#][!UpdateMeterGroup SGroup][!Redraw][!UpdateMeasure Next][!UpdateMeter Background]
MiddleMouseUpAction=[!SetVariable Status ""][!SetOptionGroup SGroup Hidden 1][!UpdateMeterGroup SGroup][!Redraw][!UpdateMeasure Next][!UpdateMeter Background]
DynamicVariables=1

[S0]
Meter=Shape
MeterStyle=Hex

[S0I]
Meter=Image
MeterStyle=Image

[S0T]
Meter=String
MeterStyle=Text

[S1]
Meter=Shape
MeterStyle=Hex

[S1I]
Meter=Image
MeterStyle=Image

[S1T]
Meter=String
MeterStyle=Text

[S2]
Meter=Shape
MeterStyle=Hex

[S2I]
Meter=Image
MeterStyle=Image

[S2T]
Meter=String
MeterStyle=Text

[S3]
Meter=Shape
MeterStyle=Hex

[S3I]
Meter=Image
MeterStyle=Image

[S3T]
Meter=String
MeterStyle=Text

[S4]
Meter=Shape
MeterStyle=Hex

[S4I]
Meter=Image
MeterStyle=Image

[S4T]
Meter=String
MeterStyle=Text

[S5]
Meter=Shape
MeterStyle=Hex

[S5I]
Meter=Image
MeterStyle=Image

[S5T]
Meter=String
MeterStyle=Text

[S6]
Meter=Shape
MeterStyle=Hex

[S6I]
Meter=Image
MeterStyle=Image

[S6T]
Meter=String
MeterStyle=Text

[S7]
Meter=Shape
MeterStyle=Hex

[S7I]
Meter=Image
MeterStyle=Image

[S7T]
Meter=String
MeterStyle=Text

[S8]
Meter=Shape
MeterStyle=Hex

[S8I]
Meter=Image
MeterStyle=Image

[S8T]
Meter=String
MeterStyle=Text

[S9]
Meter=Shape
MeterStyle=Hex

[S9I]
Meter=Image
MeterStyle=Image

[S9T]
Meter=String
MeterStyle=Text

[S10]
Meter=Shape
MeterStyle=Hex

[S10I]
Meter=Image
MeterStyle=Image

[S10T]
Meter=String
MeterStyle=Text

[S11]
Meter=Shape
MeterStyle=Hex

[S11I]
Meter=Image
MeterStyle=Image

[S11T]
Meter=String
MeterStyle=Text

[S12]
Meter=Shape
MeterStyle=Hex

[S12I]
Meter=Image
MeterStyle=Image

[S12T]
Meter=String
MeterStyle=Text

[S13]
Meter=Shape
MeterStyle=Hex

[S13I]
Meter=Image
MeterStyle=Image

[S13T]
Meter=String
MeterStyle=Text

[S14]
Meter=Shape
MeterStyle=Hex

[S14I]
Meter=Image
MeterStyle=Image

[S14T]
Meter=String
MeterStyle=Text

[S15]
Meter=Shape
MeterStyle=Hex

[S15I]
Meter=Image
MeterStyle=Image

[S15T]
Meter=String
MeterStyle=Text

[S16]
Meter=Shape
MeterStyle=Hex

[S16I]
Meter=Image
MeterStyle=Image

[S16T]
Meter=String
MeterStyle=Text

[S17]
Meter=Shape
MeterStyle=Hex

[S17I]
Meter=Image
MeterStyle=Image

[S17T]
Meter=String
MeterStyle=Text

[S18]
Meter=Shape
MeterStyle=Hex

[S18I]
Meter=Image
MeterStyle=Image

[S18T]
Meter=String
MeterStyle=Text

[S19]
Meter=Shape
MeterStyle=Hex

[S19I]
Meter=Image
MeterStyle=Image

[S19T]
Meter=String
MeterStyle=Text

[S20]
Meter=Shape
MeterStyle=Hex

[S20I]
Meter=Image
MeterStyle=Image

[S20T]
Meter=String
MeterStyle=Text

[S21]
Meter=Shape
MeterStyle=Hex

[S21I]
Meter=Image
MeterStyle=Image

[S21T]
Meter=String
MeterStyle=Text

[S22]
Meter=Shape
MeterStyle=Hex

[S22I]
Meter=Image
MeterStyle=Image

[S22T]
Meter=String
MeterStyle=Text

[S23]
Meter=Shape
MeterStyle=Hex

[S23I]
Meter=Image
MeterStyle=Image

[S23T]
Meter=String
MeterStyle=Text

[S24]
Meter=Shape
MeterStyle=Hex

[S24I]
Meter=Image
MeterStyle=Image

[S24T]
Meter=String
MeterStyle=Text

[S25]
Meter=Shape
MeterStyle=Hex

[S25I]
Meter=Image
MeterStyle=Image

[S25T]
Meter=String
MeterStyle=Text

[S26]
Meter=Shape
MeterStyle=Hex

[S26I]
Meter=Image
MeterStyle=Image

[S26T]
Meter=String
MeterStyle=Text

[S27]
Meter=Shape
MeterStyle=Hex

[S27I]
Meter=Image
MeterStyle=Image

[S27T]
Meter=String
MeterStyle=Text

[S28]
Meter=Shape
MeterStyle=Hex

[S28I]
Meter=Image
MeterStyle=Image

[S28T]
Meter=String
MeterStyle=Text

[S29]
Meter=Shape
MeterStyle=Hex

[S29I]
Meter=Image
MeterStyle=Image

[S29T]
Meter=String
MeterStyle=Text

[S30]
Meter=Shape
MeterStyle=Hex

[S30I]
Meter=Image
MeterStyle=Image

[S30T]
Meter=String
MeterStyle=Text

[S31]
Meter=Shape
MeterStyle=Hex

[S31I]
Meter=Image
MeterStyle=Image

[S31T]
Meter=String
MeterStyle=Text

[S32]
Meter=Shape
MeterStyle=Hex

[S32I]
Meter=Image
MeterStyle=Image

[S32T]
Meter=String
MeterStyle=Text

[S33]
Meter=Shape
MeterStyle=Hex

[S33I]
Meter=Image
MeterStyle=Image

[S33T]
Meter=String
MeterStyle=Text

[S34]
Meter=Shape
MeterStyle=Hex

[S34I]
Meter=Image
MeterStyle=Image

[S34T]
Meter=String
MeterStyle=Text

[S35]
Meter=Shape
MeterStyle=Hex

[S35I]
Meter=Image
MeterStyle=Image

[S35T]
Meter=String
MeterStyle=Text

[S36]
Meter=Shape
MeterStyle=Hex

[S36I]
Meter=Image
MeterStyle=Image

[S36T]
Meter=String
MeterStyle=Text

[S37]
Meter=Shape
MeterStyle=Hex

[S37I]
Meter=Image
MeterStyle=Image

[S37T]
Meter=String
MeterStyle=Text

[S38]
Meter=Shape
MeterStyle=Hex

[S38I]
Meter=Image
MeterStyle=Image

[S38T]
Meter=String
MeterStyle=Text

[S39]
Meter=Shape
MeterStyle=Hex

[S39I]
Meter=Image
MeterStyle=Image

[S39T]
Meter=String
MeterStyle=Text

[S40]
Meter=Shape
MeterStyle=Hex

[S40I]
Meter=Image
MeterStyle=Image

[S40T]
Meter=String
MeterStyle=Text

[S41]
Meter=Shape
MeterStyle=Hex

[S41I]
Meter=Image
MeterStyle=Image

[S41T]
Meter=String
MeterStyle=Text

[S42]
Meter=Shape
MeterStyle=Hex

[S42I]
Meter=Image
MeterStyle=Image

[S42T]
Meter=String
MeterStyle=Text

[S43]
Meter=Shape
MeterStyle=Hex

[S43I]
Meter=Image
MeterStyle=Image

[S43T]
Meter=String
MeterStyle=Text

[S44]
Meter=Shape
MeterStyle=Hex

[S44I]
Meter=Image
MeterStyle=Image

[S44T]
Meter=String
MeterStyle=Text

[S45]
Meter=Shape
MeterStyle=Hex

[S45I]
Meter=Image
MeterStyle=Image

[S45T]
Meter=String
MeterStyle=Text

[S46]
Meter=Shape
MeterStyle=Hex

[S46I]
Meter=Image
MeterStyle=Image

[S46T]
Meter=String
MeterStyle=Text

[S47]
Meter=Shape
MeterStyle=Hex

[S47I]
Meter=Image
MeterStyle=Image

[S47T]
Meter=String
MeterStyle=Text

[S48]
Meter=Shape
MeterStyle=Hex

[S48I]
Meter=Image
MeterStyle=Image

[S48T]
Meter=String
MeterStyle=Text

[S49]
Meter=Shape
MeterStyle=Hex

[S49I]
Meter=Image
MeterStyle=Image

[S49T]
Meter=String
MeterStyle=Text

[S50]
Meter=Shape
MeterStyle=Hex

[S50I]
Meter=Image
MeterStyle=Image

[S50T]
Meter=String
MeterStyle=Text

[S51]
Meter=Shape
MeterStyle=Hex

[S51I]
Meter=Image
MeterStyle=Image

[S51T]
Meter=String
MeterStyle=Text

[S52]
Meter=Shape
MeterStyle=Hex

[S52I]
Meter=Image
MeterStyle=Image

[S52T]
Meter=String
MeterStyle=Text

[S53]
Meter=Shape
MeterStyle=Hex

[S53I]
Meter=Image
MeterStyle=Image

[S53T]
Meter=String
MeterStyle=Text

[S54]
Meter=Shape
MeterStyle=Hex

[S54I]
Meter=Image
MeterStyle=Image

[S54T]
Meter=String
MeterStyle=Text

[S55]
Meter=Shape
MeterStyle=Hex

[S55I]
Meter=Image
MeterStyle=Image

[S55T]
Meter=String
MeterStyle=Text

[S56]
Meter=Shape
MeterStyle=Hex

[S56I]
Meter=Image
MeterStyle=Image

[S56T]
Meter=String
MeterStyle=Text

[S57]
Meter=Shape
MeterStyle=Hex

[S57I]
Meter=Image
MeterStyle=Image

[S57T]
Meter=String
MeterStyle=Text

[S58]
Meter=Shape
MeterStyle=Hex

[S58I]
Meter=Image
MeterStyle=Image

[S58T]
Meter=String
MeterStyle=Text

[S59]
Meter=Shape
MeterStyle=Hex

[S59I]
Meter=Image
MeterStyle=Image

[S59T]
Meter=String
MeterStyle=Text

[S60]
Meter=Shape
MeterStyle=Hex

[S60I]
Meter=Image
MeterStyle=Image

[S60T]
Meter=String
MeterStyle=Text

[S61]
Meter=Shape
MeterStyle=Hex

[S61I]
Meter=Image
MeterStyle=Image

[S61T]
Meter=String
MeterStyle=Text

[S62]
Meter=Shape
MeterStyle=Hex

[S62I]
Meter=Image
MeterStyle=Image

[S62T]
Meter=String
MeterStyle=Text

[S63]
Meter=Shape
MeterStyle=Hex

[S63I]
Meter=Image
MeterStyle=Image

[S63T]
Meter=String
MeterStyle=Text

[S64]
Meter=Shape
MeterStyle=Hex

[S64I]
Meter=Image
MeterStyle=Image

[S64T]
Meter=String
MeterStyle=Text

[S65]
Meter=Shape
MeterStyle=Hex

[S65I]
Meter=Image
MeterStyle=Image

[S65T]
Meter=String
MeterStyle=Text

[S66]
Meter=Shape
MeterStyle=Hex

[S66I]
Meter=Image
MeterStyle=Image

[S66T]
Meter=String
MeterStyle=Text

[S67]
Meter=Shape
MeterStyle=Hex

[S67I]
Meter=Image
MeterStyle=Image

[S67T]
Meter=String
MeterStyle=Text

[S68]
Meter=Shape
MeterStyle=Hex

[S68I]
Meter=Image
MeterStyle=Image

[S68T]
Meter=String
MeterStyle=Text

[S69]
Meter=Shape
MeterStyle=Hex

[S69I]
Meter=Image
MeterStyle=Image

[S69T]
Meter=String
MeterStyle=Text

[S70]
Meter=Shape
MeterStyle=Hex

[S70I]
Meter=Image
MeterStyle=Image

[S70T]
Meter=String
MeterStyle=Text

[S71]
Meter=Shape
MeterStyle=Hex

[S71I]
Meter=Image
MeterStyle=Image

[S71T]
Meter=String
MeterStyle=Text

[S72]
Meter=Shape
MeterStyle=Hex

[S72I]
Meter=Image
MeterStyle=Image

[S72T]
Meter=String
MeterStyle=Text

[S73]
Meter=Shape
MeterStyle=Hex

[S73I]
Meter=Image
MeterStyle=Image

[S73T]
Meter=String
MeterStyle=Text

[S74]
Meter=Shape
MeterStyle=Hex

[S74I]
Meter=Image
MeterStyle=Image

[S74T]
Meter=String
MeterStyle=Text

[S75]
Meter=Shape
MeterStyle=Hex

[S75I]
Meter=Image
MeterStyle=Image

[S75T]
Meter=String
MeterStyle=Text

[S76]
Meter=Shape
MeterStyle=Hex

[S76I]
Meter=Image
MeterStyle=Image

[S76T]
Meter=String
MeterStyle=Text

[S77]
Meter=Shape
MeterStyle=Hex

[S77I]
Meter=Image
MeterStyle=Image

[S77T]
Meter=String
MeterStyle=Text

[S78]
Meter=Shape
MeterStyle=Hex

[S78I]
Meter=Image
MeterStyle=Image

[S78T]
Meter=String
MeterStyle=Text

[S79]
Meter=Shape
MeterStyle=Hex

[S79I]
Meter=Image
MeterStyle=Image

[S79T]
Meter=String
MeterStyle=Text

[S80]
Meter=Shape
MeterStyle=Hex

[S80I]
Meter=Image
MeterStyle=Image

[S80T]
Meter=String
MeterStyle=Text

[S81]
Meter=Shape
MeterStyle=Hex

[S81I]
Meter=Image
MeterStyle=Image

[S81T]
Meter=String
MeterStyle=Text

[S82]
Meter=Shape
MeterStyle=Hex

[S82I]
Meter=Image
MeterStyle=Image

[S82T]
Meter=String
MeterStyle=Text

[S83]
Meter=Shape
MeterStyle=Hex

[S83I]
Meter=Image
MeterStyle=Image

[S83T]
Meter=String
MeterStyle=Text

[S84]
Meter=Shape
MeterStyle=Hex

[S84I]
Meter=Image
MeterStyle=Image

[S84T]
Meter=String
MeterStyle=Text

[S85]
Meter=Shape
MeterStyle=Hex

[S85I]
Meter=Image
MeterStyle=Image

[S85T]
Meter=String
MeterStyle=Text

[S86]
Meter=Shape
MeterStyle=Hex

[S86I]
Meter=Image
MeterStyle=Image

[S86T]
Meter=String
MeterStyle=Text

[S87]
Meter=Shape
MeterStyle=Hex

[S87I]
Meter=Image
MeterStyle=Image

[S87T]
Meter=String
MeterStyle=Text

[S88]
Meter=Shape
MeterStyle=Hex

[S88I]
Meter=Image
MeterStyle=Image

[S88T]
Meter=String
MeterStyle=Text

[S89]
Meter=Shape
MeterStyle=Hex

[S89I]
Meter=Image
MeterStyle=Image

[S89T]
Meter=String
MeterStyle=Text

[S90]
Meter=Shape
MeterStyle=Hex

[S90I]
Meter=Image
MeterStyle=Image

[S90T]
Meter=String
MeterStyle=Text

[S91]
Meter=Shape
MeterStyle=Hex

[S91I]
Meter=Image
MeterStyle=Image

[S91T]
Meter=String
MeterStyle=Text

[S92]
Meter=Shape
MeterStyle=Hex

[S92I]
Meter=Image
MeterStyle=Image

[S92T]
Meter=String
MeterStyle=Text

[S93]
Meter=Shape
MeterStyle=Hex

[S93I]
Meter=Image
MeterStyle=Image

[S93T]
Meter=String
MeterStyle=Text

[S94]
Meter=Shape
MeterStyle=Hex

[S94I]
Meter=Image
MeterStyle=Image

[S94T]
Meter=String
MeterStyle=Text

[S95]
Meter=Shape
MeterStyle=Hex

[S95I]
Meter=Image
MeterStyle=Image

[S95T]
Meter=String
MeterStyle=Text

[S96]
Meter=Shape
MeterStyle=Hex

[S96I]
Meter=Image
MeterStyle=Image

[S96T]
Meter=String
MeterStyle=Text

[S97]
Meter=Shape
MeterStyle=Hex

[S97I]
Meter=Image
MeterStyle=Image

[S97T]
Meter=String
MeterStyle=Text

[S98]
Meter=Shape
MeterStyle=Hex

[S98I]
Meter=Image
MeterStyle=Image

[S98T]
Meter=String
MeterStyle=Text

[S99]
Meter=Shape
MeterStyle=Hex

[S99I]
Meter=Image
MeterStyle=Image

[S99T]
Meter=String
MeterStyle=Text
KryptOnyx wrote: August 12th, 2021, 1:03 pm I would still rather remove/hide the last Tile placed regardless which Tile is clicked.
When I save the pattern the Sequence cannot have any missing Tiles.
death.crafter wrote: August 12th, 2021, 1:18 pm I am curious how it can be done in vanilla Rainmeter.
I'm working on a version that will attempt to resequence the whole thing instead of creating gaps when hiding, but it will have to wait until I get the angle part right for every angle whatsoever. I have an idea about how to approach it and I believe it's feasible for the most part, but I will let you know - and satisfy your curiosity and all that, LMAO - when it's done.
KryptOnyx wrote: August 12th, 2021, 1:03 pmAny chance you could explain what Cleaner and [Next] does?
Much appreciated :D
In RegExpSubstitute, a (capture) may not return an empty string, as explained here. Therefore, when that string return is empty, the result will be the literal \1, \2 and so on. Cleaner is my way of dealing with that AND with the instances where the match has not been found, the substitution would not happen, and I get the original string back as a result. It basically gets the capture and only the capture from the string, and the empty string if that capture has not been found. I use the Unicode zero width space, aka [\x200B] (in the "[\x200B]\1[\x200B]" part) as a temporary "invisible" marker to detect whether the capture (empty or not) has been found, then, in Cleaner I first eliminate the original string if the markers are not found, then eliminate the markers, then eliminate the literal \N leftovers, where N is the capture number.

In [Next] I find the FIRST hidden S... meter correspondent by looking into the #Status# list I created in the OnUpdateAction from the [Hex] style that's applied on the hex meters, and get that meter's index. That's how I know from where to start when there's a gap in the "sequence" and I click to show other hexes, since [Next] is used in the [Background]'s LeftMouseUpAction to set the coordinates and the hidden state of a "new" hex on click. The #Status# variable looks something like (you can see it in the log as well):

Code: Select all

S0=64,S1=64,S2=64,S3=64,S4=0,S5=64,S6=64,S7=0,S8=0,S9=0,
It's basically a comma separated list of the hex meter names, the equal sign, and that meter's width. Since a hidden meter has its width (and height) set to 0, all I need to know is the first occurence of a S...=0 in strings like the above. That is done by using the lazy/ungreedy ? flag on the first .* part from the "^.*?S(\d+)=0.*$" pattern. In other words, I'm looking for any "lesser" number of any characters, followed by Snumber=0, followed by any "greater" number of any characters in the explicit string (since I'm using the beginning ^ and the ending $ regex anchors), and get the "number", so I can use it afterwards in the other operations.

That being said, despite the fact that this very much works, they will probably have to be ditched off if I complete the resequence version. That will probably happen later on. ;-)
User avatar
KryptOnyx
Posts: 19
Joined: July 28th, 2021, 10:18 am

Re: Need Help with Mouse control on Shapes.

Post by KryptOnyx »

Yeah, the angle part wasn't an initial requirement, so I left it for later to solve. The following code should do it, but it still has some "bugs" in that it doesn't properly synchronize the hex and image rotation for, say, 45 degrees or so - must be some litle formula that I wrote backwards, LOL (I moved all formulas in [Variables], so they are easier to edit or understand):
Not sure why you would rotate the Image...I would just replace the Text Meter SetOption X and Y with the Image meter (Offset by half the Image W and H).
Everything happens for a Reason, and could Not happen any other way.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Need Help with Mouse control on Shapes.

Post by Yincognito »

KryptOnyx wrote: August 13th, 2021, 9:28 am Not sure why you would rotate the Image...I would just replace the Text Meter SetOption X and Y with the Image meter (Offset by half the Image W and H).
It doesn't work that way. The image X and Y are not the image's center point, but the top left point of the image METER. If you meant that the offsets should be subtracted from the center point of the hex's rectangular slot, that would work fine if the image wasn't rotated.

As for the rotation, apart from death.crafter's linked images requiring an "initial" rotation because they are drawn using a different angle than the 0 angle in this skin (this can be ignored if your images are drawn according to the 0 angle in the skin, of course), you have to rotate the image along with the hex so that the image fits the hex properly, if you change the angle along the way.

Currently I'm almost done with the angle thing, only the image rotation left to be done, but I already have the image meter's bounding box for the rotating image and the X and Y should be only a matter of subtracting half of the bounding box' W and H from the rectangular slot's center.