This commit is contained in:
Nick Fisher
2022-12-14 14:53:22 +08:00
61 changed files with 172 additions and 172 deletions

1
.gitattributes vendored
View File

@@ -68,4 +68,5 @@ linux/lib/libtinyexr.a filter=lfs diff=lfs merge=lfs -text
linux/lib/libz.a filter=lfs diff=lfs merge=lfs -text
linux/lib/libmatdbg.a filter=lfs diff=lfs merge=lfs -text
linux/lib/libSPIRV-Tools-opt.a filter=lfs diff=lfs merge=lfs -text
windows/lib/** filter=lfs diff=lfs merge=lfs -text
*.a filter=lfs diff=lfs merge=lfs -text

View File

@@ -345,6 +345,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_CFLAGS = "-fvisibility=default";
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -476,6 +477,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_CFLAGS = "-fvisibility=default";
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -499,6 +501,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_CFLAGS = "-fvisibility=default";
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -119,11 +119,6 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
kCVPixelFormatType_32BGRA, pixelBufferAttrs, &targetPixelBuffer) != kCVReturnSuccess) {
print("Error allocating pixel buffer")
}
if(self.viewer != nil) {
create_swap_chain(self.viewer, unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self))
update_viewport_and_camera_projection(self.viewer!, Int32(width), Int32(height), 1.0);
}
print("Pixel buffer created")
}
@@ -136,12 +131,17 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
freeResourcePtr = unsafeBitCast(freeResource, to: UnsafeMutableRawPointer.self)
viewer = filament_viewer_new_ios(
unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self),
nil,
loadResourcePtr!,
freeResourcePtr!,
Unmanaged.passUnretained(self).toOpaque()
)
create_swap_chain(
self.viewer,
unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self),
UInt32(width), UInt32(height))
update_viewport_and_camera_projection(self.viewer!, Int32(width), Int32(height), 1.0);
createDisplayLink()
@@ -285,6 +285,10 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
let width = Int(args[0])
let height = Int(args[1])
createPixelBuffer(width: width, height:height)
create_swap_chain(
self.viewer,
unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self),
UInt32(width), UInt32(height))
result("OK")
case "rotateStart":
let args = call.arguments as! Array<Any>

View File

@@ -22,7 +22,7 @@ void* load_glb(void* viewer, const char* assetPath);
void* load_gltf(void* viewer, const char* assetPath, const char* relativePath);
bool set_camera(void* viewer, void* asset, const char* nodeName);
void render(void* viewer, uint64_t frameTimeInNanos);
void create_swap_chain(void* viewer, void* surface = nullptr, uint32_t width = 0, uint32_t height = 0);
void create_swap_chain(void* viewer, void* surface, uint32_t width, uint32_t height);
void destroy_swap_chain(void* viewer);
void set_frame_interval(void* viewer, float interval);
void* get_renderer(void* viewer);

View File

@@ -1,3 +1,2 @@
void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
void create_swap_chain(void* viewer, void* texture);

View File

@@ -1,7 +1,7 @@
#ifndef SwiftPolyvoxFilamentPlugin_Bridging_Header_h
#define SwiftPolyvoxFilamentPlugin_Bridging_Header_h
void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
// void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
#import "PolyvoxFilamentIOSApi.h"
#import "PolyvoxFilamentApi.h"

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d6bc9d1aac4a998df612725940893b208acefcd739e840235d19bf4a710ba17f
size 7936
oid sha256:67a885031c437bf03aab72cd9b6c2cb6053bb0190180e442b8f7685b7d406cd0
size 7584

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f93715e22183f7a9ba9e31f571d28988d16dda3f80e929f038d501cc2db61cb6
size 10912
oid sha256:e3787fd3c97246401bddbe7d640dc0a6dc3568f7d8629b3f5ecf14496df2a7ae
size 9192

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:23b789386679df0f2205c519ddcfa4033f03faf5f226cf7134a38b6847e70a36
size 732008
oid sha256:3fce187f0ff158fa61d32dc74ffad911c32124fc6559e13e01e96e8a60b556d7
size 726256

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:67ef8f8786edb835360be3d7efbd271b88d344287fafd74f322797441a209968
size 338320
oid sha256:012fbd6d889d7d56984d9c6921f61f8f1a0f60040df5a4a3473b8fc294722b3b
size 331408

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34ffb5b56d4c699a823cbf464415f0a683a9c0d2f9f8baf246b16ef3f81a39eb
size 545456
oid sha256:ee6719214288cfb083f4e8993b13dd0a4e49c3d7dbbb70ff7592d3b221f2e278
size 530632

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e355e731a98aba32bebe6a5477b3357d7dc56a816d1e272c29f6303bc2d2eded
size 23434560
oid sha256:d76e2bf6f554ac67141a67fa0327f9771826a65e4938e39c63d04cb046e130cd
size 22963344

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bfe65291e73c84a94f2e176fedcd5f50c266bc5bea849d0cff2e160adca63892
size 2544432
oid sha256:3395a57153a7b10566e670aa5254875432682cd87d8084f1c7bc499a0626aef7
size 2456384

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f7ee27c94f8b11d6bcc8d2d146f1d836721c0b503ec44937f7cc2db97f5bde7
size 8125440
oid sha256:70db04e2a6e9a7c340abc12dc931438d8326668dc50bfcc31925dd6e66a69158
size 7987696

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:40adb43d831ed9b4e9c5b011455a870e1ec7351b3290e3e89a98804b17281c47
size 2427840
oid sha256:9c022157a454af87cf20d3caeab8c5eb884758e3d95fa5bb6547681886e32143
size 2603368

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09670a317b57817f019cf9d1b6aee9e32f405692d08d03348b417b78e9c29d39
size 2328528
oid sha256:bd10dff457b7d078cdcf8cf518ea29b523966eda41a2899c599a3c93195d0c75
size 2426680

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a6dd6a945cb5d18c46b2f28418ed74721c6a348faa141297dc7175f200d43d6
size 994136
oid sha256:dc8b7ba0b74297a6a4249210a54e14e12512c2aca116f52beb330b730e2c0986
size 1055512

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:455c2b644de5e71617406a0dbeeb95455f61675ad99be47b24bbf851bbd6ce2e
size 1977768
oid sha256:3eb059649b6a6710c8eea46c0958900581939aa61d1750b0664d7bf507e51232
size 2040680

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4f0ca5ab489e4d0237b2b6e7d01925f2b45d3ef33a2d1d770973255e335208b4
size 2541000
oid sha256:4e15a1f104f4e35badbe96fbbb71bb87e484f0670f3bd419fc3972a2b8e2f61e
size 2520104

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2abd82174104ca094ac9676b8615a4cc8241aa40762b03fd74183783ccd17d6e
size 908328
oid sha256:bca7d29d734a6f309c4bde8d9e8f9f0066e876108a9fa20f63415f0639becec3
size 906848

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3bd0c674c51e3d44cc1d6c98a0c677890c0325888c0c6cf1077ec95a31af374
size 945120
oid sha256:d7b52bac3614d76a52991bc4f4dacc1a1b760b4b68e1ef363fa77e2e8456cb8d
size 909696

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3bcb95ba234b249dda50bb9b1ec54f152d9abe2c9742230400d51730a4e1397
size 6192
oid sha256:a7bc987ab76614e0e4a7edddd8e749bb85cd1fbdea598e12d6d61136f95dbf7b
size 5512

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3fc865dd9a42384987f7ccd265094b883e1728f2b3923959d6ea3f57991692a
size 80672
oid sha256:be058fd2532334f1aef703a6b8516ece827bd9af427e68b020f10a72df509ab8
size 78072

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4de4258d5856247915c5fde373adddf0a70234920082e8dc67e8516bae64821
size 607400
oid sha256:1029a420d99b0aeadc8c5025302c18e4f96e332cafb103dbc382723ba2dbb6ee
size 609016

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72dfcddf41e904ead0426fa0f25ab750b4fbc4827c2365384112697f89edcec8
size 4012752
oid sha256:3681e1f293b3034e73dd48a4b98e528a5ee2fc1b3639e44e7f789c32754b1135
size 3877784

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:293687a0caddc6271d2cea6782e00fea18b493fdbc1d4bcaa6f45b95709d1783
size 132816
oid sha256:adee128ec5caad836013b943113dfc931d256cbaafff37caeb37e2b2965e5c14
size 113536

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:41e9494e5e11d29905e596c092da24eb7af0eb76130e57a2b44ef7f3516d8d63
size 100952
oid sha256:4525b6b443db387eb9bdabcca3aa19662fa951f8c4248404d63743b1c809e65f
size 95376

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:201e1e42f2c2f5116993e245ca9a0c81b417814eab30303f579e5f8e34929af2
size 166296
oid sha256:f6735777a2e2be584acb93546044d8ee1cfc7fcb69cba2bbba8503590edd8de3
size 170856

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38d82e9eb24b35070a51cc60242d983b1c07afd443c44c933f501708bcc7f57
size 1566464
oid sha256:dc9bdfaca3e9b0f88221feb5956e149b5d1adaf419ce1f19427bdcfba107c53b
size 1710192

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:52c2e29d1113a2cd574d31a862383cedaeaed0b42f424d7bd7dcdf60d9aa1660
size 52786080
oid sha256:5a027e52d553051085c45794ff598bdb9a3f67452c8ad1cd26bd559901442b70
size 52777672

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:77adfbbe917bd6cee619de6c7e88458dc42a29bc8853207424c23cb36f752c5d
size 888880
oid sha256:0a052cc799327f892502ce48c0c4ae3fcdd5031c6f00358392337409e2800a2b
size 927560

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dce3bbb6d80d32130ddce6dc146bdc41edac93e6b60237e531d16accfcae3f2d
size 89648
oid sha256:04ca03d94021ed48a03a6e8bb831c3694fc366e8e57af0ababac4f929d6facbc
size 89576

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4bd65b3d94d2e968995aa7727c2197a364075e5357f4640e5fa0481c61aab41
size 5287608
oid sha256:c44be9a71fdd920b002da629596eed12954d6c969fbd1d0de7cba916413b53f2
size 5443552

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f54585368e2c11cfde07ee5dd548bcc071b51155fb5e9afbede81a4ff226aed0
size 73296
oid sha256:2169529581b798975b3d59fe6a1f879541c7a5e6374033ef3cc80426a2f667cc
size 69304

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d56253e5666055da717ce66f67c7a475ad1c1732ae1ac7f93ccbf10886316dcb
size 68608
oid sha256:6f23ca8c54c4fd25a26f86e673b08d91d448bcfde632cb6c27f9212f3747e570
size 75928

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b74bc855914818f0bf82ba79e488cbc3791a3acae4ccffc49ca542a45494419d
size 19720
oid sha256:e3be5b3b418610b68f9e1242fc322c4d9ec80bcbd62c5ed9609b41cd7e24bc68
size 18336

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d9b03e367e689df2b85632f1de30884c949292e011cf490c7272e93948a350ed
size 7922232
oid sha256:98c04e8a8b6c6a3742f1a0fe0330e2754603e74a86b3f6b2b83ae0d783a99999
size 8258848

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7550105c7d533cd848112c2b9ed55d4b286d148a0da9a538708afb4284956e77
size 2099384
oid sha256:0ee75ceb05b2f0be8c5bbed730bba730033824712ae0ef4b182ae50f189af044
size 2027624

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c17a0c691760fe5739b86c39b206d0f153a7161a419a46108ba7abc6a494f481
size 983520
oid sha256:330b476b97e973b65fdd603f62838ad9b3da6ffd5c3cd826ddf482e58b9c701f
size 985040

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb4a150b2d694e7e9b89034efcd8143b4f49b3af9eef0296bb7f98b938a18a07
size 476936
oid sha256:9c4c0f6612e474efa7a07635bbe285b90a7edfee9be7e26863a0e0eb8500a401
size 467280

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:80655358b1874b68bf511ef4c157cd7cb724cfa20c74a0f54292eb11d2404736
size 574968
oid sha256:327ae761fcd581d82e68325d8df0dbdc00e5db19619808cabf85d4bbc15fdfb3
size 562800

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60829b308ae2a1ea11a2a4e45aa5aa95e3591809f33a5c208ffae2638547e1f2
size 169960
oid sha256:d5e05c02f53caed7de9f178c7d8e21992bad9412f43e05a13c1af289e13f9656
size 178040

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:759dcf06e24b810e15995dc19dad55f91f47c6af7e1a13f22d7521c04496a9d8
size 2980760
oid sha256:5d2faeb705f9b4f85fd624d3ba680e4001561b76afc5f18c844ccca4f3b82dba
size 2978336

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bdf8e8fce9d0e6716c08b254b57733abb7877922bb574acff33f96053072cc1e
size 90352
oid sha256:fdd8ed48840f0b186c97f619ff6636b02928a4ecac263f0dd9943e4571d193ee
size 89280

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ac61618609af1d3de56a3ef91582fddf89a0efcd9d404888ee7eafd3cc73def
size 2872
oid sha256:2770adbd8f1a815137fb4bbc1c1bd111bebc18b024bb8c1d356935250cf0d559
size 2968

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1edda72de0b860e655507941b4649dac7246cc33e1505294106f61472ee4ffd2
size 61280
oid sha256:8a3aab3c4db306312ca66729bf5da81e433248ed36531100005b10e013f0905c
size 61080

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:799f2347dd0b746d26c04379ca0f9c0f4eebaa623f0a650d264f0eadabf20a47
size 164400
oid sha256:7f2c6485bdd26365c3e8a4b0c5260afae2a9b6d3d3da9046a7b7ee3a9df46aa7
size 264416

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7528d2aade629775ee104bd407ee60208fa97070da1d05b61fb3b01361918025
size 121656
oid sha256:8faa896aa2323a16ef3f98d55acb38c46aa85d8620aa231856b7dd7484402c02
size 124240

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:69f3f132969d9d11311a723fe627ec643876f2d304687686fd4c47457fa4f87f
size 121408
oid sha256:fbcf0a4ca4f84d6c63e0b6d87b1167f27462d080f9689841a3a25efc3367cfc6
size 118904

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:548a35a7de1453775574c9994f0484f562b0bdef32262609a7dde13722d09b34
size 1516400
oid sha256:78ac7f7f858ec6e6b1924494b93765dfb6ad77c5ee4ce8a8ad2b2478b7a7986c
size 1498896

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6b3fb6fb342bbba8398a69b83bf861ce9694b91cbeac0e96ed7ed2cda491a4dc
size 3248448
oid sha256:fea0e109b18943efb08a56cb74e95e32a039aa9a02e11f09ddbcc7f0c62b661e
size 3231376

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:05a553d984e493c9b5cae3e5aead10e8aa0982ba47042f12c7289811375b142a
size 4522840
oid sha256:8cc76358d8df4369a5d683b5ef832c1ff8f0ebacd42f1f37e62b58d709e04d21
size 4504144

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08c30ea25b4f582754b7e6b48e56bca4163fb7add3adc382913ef2c7854bfada
size 330736
oid sha256:fccd398a1e25a287a6b0b1e62b529752852a2c79a6b176790955ca6ff1b56e94
size 326112

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d15deccdb2c37b3cb92e9dcd878faa57623c3ab9e00a275fdbff6428a6dd674
size 1059296
oid sha256:7b5c20b578563901cadefc3021addb331fb27cde4802804977bda9cb67f275a1
size 1152496

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e5c540ab8c2e00c281bca8c01d442cd0c484f5526bb1be856a979a5432e7c6e
size 67672
oid sha256:bdbbb4c5dd4875d4ca411aefd11a3c0379817673dc2e5a85b774f39259d9c2a8
size 67776

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09d1314d14b68658c11586344b15583044d7099d94fc51531a2f15b49c73521d
size 518016
oid sha256:dedbb70526a40adcff1800efc88434ddc0f595d62992f8527cf154eb9c371d86
size 473384

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5fded3588145f7c45cb64d89fbb7b33c2c417fb4e784d9c6a3c894e913494b53
size 862784
oid sha256:14170902189377e9db401b13fa22ceb3f6c82d37c94fd1e30e78b6c3f1745c80
size 866984

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:96cc5a8ff6bf70e1ef37336fe5b78b8eadedafd44b8f18e28754a9038d26045a
size 4472
oid sha256:6c7c8063332e51ec62584c1970d46386511552ca5e731f18f3fd2ee74522e100
size 4576

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de2248cd688f3f9156c439174fa81fd958b68b5c84b1458a60f300379b2269e7
size 2182120
oid sha256:46e221994f1a81aefe56b8f5c06272ff84cd05e12d8b53489256a54d5fdedc39
size 2422464

View File

@@ -26,7 +26,4 @@ extern "C" {
return (void*)viewer;
}
void create_swap_chain(void* viewer, void* texture) {
((FilamentViewer*)viewer)->createSwapChain(texture);
}
}

View File

@@ -83,65 +83,61 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
Widget build(BuildContext context) {
return Stack(children: [
Positioned.fill(
child: Listener(
onPointerSignal: (pointerSignal) async {
if (pointerSignal is PointerScrollEvent) {
_scrollTimer?.cancel();
// pinch zoom on mobile
// couldn't find any equivalent for pointerCount in Listener so we use two widgets:
// - outer is a GestureDetector only for pinch zoom
// - inner is a Listener for all other gestures
child: GestureDetector(
onScaleStart: (d) async {
if (d.pointerCount == 2) {
await widget.controller.zoomEnd();
await widget.controller.zoomBegin();
await widget.controller.zoomUpdate(
pointerSignal.scrollDelta.dy > 0 ? 100 : -100);
_scrollTimer = Timer(Duration(milliseconds: 100), () {
widget.controller.zoomEnd();
_scrollTimer = null;
});
} else {
print(pointerSignal);
}
},
onPointerPanZoomStart: (pzs) {
print(pzs);
onScaleEnd: (d) async {
if (d.pointerCount == 2) {
_lastScale = 0;
await widget.controller.zoomEnd();
}
},
onPointerDown: (d) async {
await _functionStart(d.localPosition.dx, d.localPosition.dy);
onScaleUpdate: (d) async {
if (d.pointerCount == 2) {
if (_lastScale != 0) {
await widget.controller
.zoomUpdate(100 * (_lastScale - d.scale));
}
}
_lastScale = d.scale;
},
onPointerMove: (d) async {
await _functionUpdate(d.localPosition.dx, d.localPosition.dy);
},
onPointerUp: (d) async {
await _functionEnd();
},
// on
// onScaleStart: (d) async {
// print("SCALE START");
// if (d.pointerCount == 2) {
// await widget.controller.zoomEnd();
// await widget.controller.zoomBegin();
// } else {
// await _functionStart(d.focalPoint.dx, d.focalPoint.dy);
// }
// },
// onScaleEnd: (d) async {
// print("SCALE END");
// if (d.pointerCount == 2) {
// _lastScale = 0;
// await widget.controller.zoomEnd();
// } else {
// await _functionEnd();
// }
// },
// onScaleUpdate: (d) async {
// if (d.pointerCount == 2) {
// if (_lastScale != 0) {
// await widget.controller
// .zoomUpdate(100 * (_lastScale - d.scale));
// }
// } else {
// await _functionUpdate(d.focalPoint.dx, d.focalPoint.dy);
// }
// _lastScale = d.scale;
// },
child: widget.child)),
child: Listener(
onPointerSignal: (pointerSignal) async {
// scroll-wheel zoom on desktop
if (pointerSignal is PointerScrollEvent) {
_scrollTimer?.cancel();
await widget.controller.zoomBegin();
await widget.controller.zoomUpdate(
pointerSignal.scrollDelta.dy > 0 ? 100 : -100);
_scrollTimer = Timer(Duration(milliseconds: 100), () {
widget.controller.zoomEnd();
_scrollTimer = null;
});
} else {
print(pointerSignal);
}
},
onPointerPanZoomStart: (pzs) {},
onPointerDown: (d) async {
await _functionStart(
d.localPosition.dx, d.localPosition.dy);
},
onPointerMove: (d) async {
await _functionUpdate(
d.localPosition.dx, d.localPosition.dy);
},
onPointerUp: (d) async {
await _functionEnd();
},
child: widget.child))),
widget.showControls
? Align(
alignment: Alignment.bottomRight,