Comments (10)
This is run from a none UI thread, maybe that has something to do with it?
from tileview.
I don't think the threading is relevant. I suspect it's just that the layout mechanism used by markers and callouts is unfamiliar to you. You can check out TranslationLayout and AnchorLayout for details on how exactly markers are laid out, but the basic idea is that they're positioned based on the full-size map (whatever size you set with TileView.setSize
, and those numbers are "scaled" so that they move with the tileview as it scales, but only positionally (not dimensionally). There's also anchor points to condiser, as is described here and here
Really everything significant is happening in TranslationLayout.onLayout
, here - that should show you what's going on in broad strokes. If you're messing with x or y, then make sure that the values you're setting are relative to the full size image. If you're using width and height, refer to how anchors work.
Hope the helps - post back if not.
from tileview.
Thanks for your answer.
Though I cannot cast my LayoutParams to a AnchorLayout.LayoutParams. This is because my View is contained inside an RelativeLayout. This is my code before the change that causes it to get out of sync when zooming.
My Callout view:
<FrameLayout ...>
...
<RelativeLayout ..>
<ImageView android:id="@+id/car_callout_health_bar"
../>
</RelativeLayout>
...
</FrameLayout>
My Callout.java:
updateCallout() {
ViewGroup.LayoutParams healthParams = findViewById(R.id.car_callout_health_bar).getLayoutParams();
healthParams.width = (int) (getResources().getDimension(R.dimen.car_callout_total_bar_width) * car.health);
findViewById(R.id.car_callout_health_bar).setLayoutParams(healthParams);
}
Shouldn't I be able to change the LayoutParams inside an MarkerView without AnchorLayout? E.g. I need the RelativeLayout to position my ImageView.
from tileview.
sure, the Marker can be anything at all (I generally use RelativeLayout myself - available for review in the demo app). That said, the change in width will affect the total width of the parent (Marker/Callout), which will affect how the anchor value is calculated. Do you understand how the anchor float values work? Have you tried a 0,0 anchor point (so the marker will have it's top-left corner aligned with the pixel position provided).
I'm still not 100% clear on what's happening - can you describe in detail the issue you're experiencing? If you'd like to share your app, I'd be happy to take a look.
from tileview.
Just to let you know. I have recreated my views in the demo app and I don't get the problem there. I will dig into it a bit more later this or the next week and find what is causing the error in my app.
from tileview.
sounds good. good luck
from tileview.
Hi moagrius, I don't want open new issue (I will if needed be :D ) for my small question thats kinda related to this one. You said markers are scaled positionally with TileView and I understand that, but not dimensionally. What's the most elegant way to scale markers dimensionally with TileView?
from tileview.
Hi @Sikter,
There's no way out-of-the-box to do that. I'd probably recommend adding a new ScalingLayout to the TileView. If you can use pixel values (relative to the original/fullsize or largest tile set), it should be fairly easy to implement - if you need to use a coordinate system it could get a little trickier.
You could also have each marker do it's own scaling, and have it listen to scale changes and react appropriately. The basic operation is pretty simple to have a View/Group scale - the concept can be seen pretty quickly in the very short ScalingLayout class (I'm not suggesting you use the class necessarily, but it does show a simple way to scale a View/Group).
Post back (in a new issue, as these are substantively different ideas) if you need more help.
from tileview.
I solved this one !
It was becuase I didn't updated the views on ui-thread.
Thanks for the help!
from tileview.
Glad you got it worked out.
from tileview.
Related Issues (20)
- Remote tile demo freezes and crashes HOT 2
- Combine smooth scroll and scale HOT 2
- Tiles not properly laid out when Scale < 1 with remote tiles HOT 15
- Open source but no license? HOT 2
- Markers disappear when zooming HOT 4
- Cannot add tile images on the fly HOT 1
- StreamProvider asked to provide data for rows and columns out of bounds with to small images HOT 5
- Tiles outside the image are created HOT 8
- White text on white background in Advanved Tile Demo HOT 1
- Get touched position when touch on the tileview (version 4.0.7)
- longtouch
- App killed in background crashes when returning to foreground HOT 1
- `android.os.BadParcelableException` regarding `com.moagrius.widget.ScrollView$SavedState.<init>` HOT 1
- Use in viewholder for recycler view. HOT 2
- build() method starts to return void instead of TileView HOT 1
- Mike passed away HOT 5
- Does this lib support SVG format
- JCenter -> MavenCenter
- implementation 'com.qozix:tileview:2.7.7' doesn't seem to work HOT 1
- Impossible import com.qozix.tileview HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tileview.