Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Yesterday at 10:57 AM
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Yesterday at 10:55 AM
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Yesterday at 10:53 AM
Canva Pro Lifetime Own Mail Activation LKR 500
sayuru bandara
Updated:
Yesterday at 10:51 AM
Tele marketing executive
nuwandse
Updated:
Monday at 12:27 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
SwiftUi ගැටලුව අන්ක 02 - mouse scroll එකෙන් zoom කිරීම
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="tarson" data-source="post: 28845972" data-attributes="member: 176018"><p>පුලුවන් කෙනෙක් මොකක්ද අව්ල කියල කියන්න. මේක මවුස් එකෙන් ස්ක්රොල් කරනකොට මැද තියෙන rectangle එක සූම් වෙන එකක්.</p><p>මේකෙ කෝඩ් එක රන් වෙනව errors මුකුත් නෑ, ඒත් මේකෙ එක පාරක් ස්ක්රොල් කරාම දිගටම සූම් වෙනව නවත්තන්න බෑ, සූම් අවුට් කලොත් දිගටම සූම් අවුට් වෙනව. මේකත් පුලුවන් තරම් ට්රයි කලා හදන්න, ඒත් මොන රෙද්දක් කරලවත් දිගටම ඔටෝ සූම් වෙන්නෙ මොකෝ කියල හිතාගන්න බෑ.</p><p></p><p>මවුස් ඉවෙන්ට් එකේදි ` thisClassLocal.thisDownRefreshState.toggle()` ටොග්ල් වෙන්න හැදුවෙ මවුස් එකෙන් එන අන්ක ඒකාකාරි නැති නිසා. ස්ක්රොල් කරනකොට ලස්සනට සූම් වෙන්න, සූම් අවුට් වෙන්නයි ඕනෙ.</p><p></p><p>[CODE=swift]</p><p></p><p>import SwiftUI</p><p>import Combine</p><p></p><p>@main</p><p>struct This4App: App {</p><p> </p><p> @State var subs = Set<AnyCancellable>()</p><p> @StateObject var thisClassLocal = ThisClass(thisIn: 7, thisUpRefreshState: true, thisDownRefreshState: true, thisScaleBy: 1)</p><p></p><p> var body: some Scene {</p><p> WindowGroup {</p><p> ThisView1()</p><p> .onAppear {ThisFunction()}</p><p> .environmentObject(thisClassLocal)</p><p> } }}</p><p></p><p>struct ThisView1: View {</p><p></p><p> @State var scaleby: CGFloat = 2</p><p> @EnvironmentObject var thisClassLocal2 : ThisClass</p><p></p><p> var body: some View {</p><p> VStack {</p><p> Rectangle()</p><p> .fill(.gray)</p><p> .frame(width: 100, height: 100)</p><p> }</p><p> .padding()</p><p> .scaleEffect(scaleby)</p><p> .onChange(of: thisClassLocal2.thisDownRefreshState) { newValue in</p><p> withAnimation { scaleby -= 2 }</p><p> }</p><p></p><p> .onChange(of: thisClassLocal2.thisUpRefreshState) { newValue in</p><p> withAnimation { scaleby += 2</p><p></p><p> } }}</p><p></p><p>extension This4App {</p><p></p><p>func ThisFunction() {</p><p></p><p> NSApp.publisher(for: \.currentEvent)</p><p> .filter { event in event?.type == .scrollWheel }</p><p> .throttle(for: .milliseconds(200),</p><p> scheduler: DispatchQueue.main,</p><p> latest: true)</p><p> .sink {</p><p></p><p> if let event = $0 {</p><p> if event.deltaY > 0 {</p><p> thisClassLocal.thisUpRefreshState.toggle()</p><p> }</p><p></p><p> if event.deltaY < 0 {</p><p> thisClassLocal.thisDownRefreshState.toggle()</p><p></p><p> } } }</p><p> .store(in: &subs)</p><p> }}</p><p></p><p>class ThisClass: ObservableObject {</p><p></p><p> @Published var thisUpRefreshState: Bool</p><p> @Published var thisDownRefreshState: Bool</p><p></p><p> init(thisIn: CGFloat, thisUpRefreshState: Bool, thisDownRefreshState: Bool, thisScaleBy: CGFloat) {</p><p></p><p> self.thisUpRefreshState = thisUpRefreshState</p><p> self.thisDownRefreshState = thisDownRefreshState</p><p> }</p><p></p><p>}[/CODE]</p><p></p><p>[USER=559478]@uia9030[/USER]</p><p>[USER=575911]@Solo Rider[/USER]</p><p></p><p>ප්රශ්න තියෙනවනම් අහන්න, දන්න විදිහට කියන්නම්, ප්රශ්න නැති අනිත් අය බම්ප් එකක් දාන් යන්න <img class="smilie smilie--emoji" loading="lazy" alt="🍻" title="Clinking beer mugs :beers:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f37b.png" data-shortname=":beers:" /></p></blockquote><p></p>
[QUOTE="tarson, post: 28845972, member: 176018"] පුලුවන් කෙනෙක් මොකක්ද අව්ල කියල කියන්න. මේක මවුස් එකෙන් ස්ක්රොල් කරනකොට මැද තියෙන rectangle එක සූම් වෙන එකක්. මේකෙ කෝඩ් එක රන් වෙනව errors මුකුත් නෑ, ඒත් මේකෙ එක පාරක් ස්ක්රොල් කරාම දිගටම සූම් වෙනව නවත්තන්න බෑ, සූම් අවුට් කලොත් දිගටම සූම් අවුට් වෙනව. මේකත් පුලුවන් තරම් ට්රයි කලා හදන්න, ඒත් මොන රෙද්දක් කරලවත් දිගටම ඔටෝ සූම් වෙන්නෙ මොකෝ කියල හිතාගන්න බෑ. මවුස් ඉවෙන්ට් එකේදි ` thisClassLocal.thisDownRefreshState.toggle()` ටොග්ල් වෙන්න හැදුවෙ මවුස් එකෙන් එන අන්ක ඒකාකාරි නැති නිසා. ස්ක්රොල් කරනකොට ලස්සනට සූම් වෙන්න, සූම් අවුට් වෙන්නයි ඕනෙ. [CODE=swift] import SwiftUI import Combine @main struct This4App: App { @State var subs = Set<AnyCancellable>() @StateObject var thisClassLocal = ThisClass(thisIn: 7, thisUpRefreshState: true, thisDownRefreshState: true, thisScaleBy: 1) var body: some Scene { WindowGroup { ThisView1() .onAppear {ThisFunction()} .environmentObject(thisClassLocal) } }} struct ThisView1: View { @State var scaleby: CGFloat = 2 @EnvironmentObject var thisClassLocal2 : ThisClass var body: some View { VStack { Rectangle() .fill(.gray) .frame(width: 100, height: 100) } .padding() .scaleEffect(scaleby) .onChange(of: thisClassLocal2.thisDownRefreshState) { newValue in withAnimation { scaleby -= 2 } } .onChange(of: thisClassLocal2.thisUpRefreshState) { newValue in withAnimation { scaleby += 2 } }} extension This4App { func ThisFunction() { NSApp.publisher(for: \.currentEvent) .filter { event in event?.type == .scrollWheel } .throttle(for: .milliseconds(200), scheduler: DispatchQueue.main, latest: true) .sink { if let event = $0 { if event.deltaY > 0 { thisClassLocal.thisUpRefreshState.toggle() } if event.deltaY < 0 { thisClassLocal.thisDownRefreshState.toggle() } } } .store(in: &subs) }} class ThisClass: ObservableObject { @Published var thisUpRefreshState: Bool @Published var thisDownRefreshState: Bool init(thisIn: CGFloat, thisUpRefreshState: Bool, thisDownRefreshState: Bool, thisScaleBy: CGFloat) { self.thisUpRefreshState = thisUpRefreshState self.thisDownRefreshState = thisDownRefreshState } }[/CODE] [USER=559478]@uia9030[/USER] [USER=575911]@Solo Rider[/USER] ප්රශ්න තියෙනවනම් අහන්න, දන්න විදිහට කියන්නම්, ප්රශ්න නැති අනිත් අය බම්ප් එකක් දාන් යන්න 🍻 [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom