-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced Mode button cut off in Updated Label Screen #831
Comments
According to ionic v1 source code, there is a custom height option and a dynamic height option for the I found out where the height of the trip-items were hardcoded to .diary-card {
width: 100%;
height: 330px;
margin: 0;
border: 2px solid rgba(0, 136, 206, 0.2);
box-sizing: border-box;
border-radius: 30px;
overflow: hidden;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
} /* ----------- iPhone 6+ ----------- */
/* Portrait and Landscape */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (-webkit-min-device-pixel-ratio: 3) {
.angular-leaflet-map { height: 150px; width: 330px; }
} This hardcoded px value + the height of the WHAT DID I TRY? (3 tests)If we change the values found in So the height is big enough to fit the If we edit the HTML in <div collection-repeat="trip in data.displayTrips" item-height="max-height"> So all the trips get displayed over each other and the height does not appear to be displaying dynamically between them; they all appear to still be the original If we edit the HTML in <div collection-repeat="trip in data.displayTrips" item-height="400px"> So we can see that it extends the height of the div around the trip item, but does not extend the height of the trip item because it is still hard-coded to
|
@shankari I am going to step away for a bit today to run some errands but I will come back today by around 4pm MST |
@sebastianbarry when you are planning to come back to this?
Please list out the full set of use cases in the testing done. |
I was able to figure out how to dynamically change the item-height! By using a JS function in the HTML for <div collection-repeat="trip in data.displayTrips" item-height="getTripHeight(trip)"> $scope.getTripHeight = function(trip) {
if(trip.INPUTS[2]) {
return 460;
} else {
return 390;
}
} This results in the height of the Additionally, if we remove the hard-coded .diary-card {
width: 100%;
height: 80%;
margin: 0;
border: 2px solid rgba(0, 136, 206, 0.2);
box-sizing: border-box;
border-radius: 30px;
overflow: hidden;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
} Screen.Recording.2022-11-06.at.10.38.10.PM.movThe problem, as can be seen in that video, is that when we click the button it does not dynamically change the height of the given space for the This space can be thought of as 2 pieces broken up:
I have set the Screen.Recording.2022-11-06.at.10.31.26.PM.movThe What does this mean?This means that, we need to get it so that somehow, when you click "e-bike" as the mode for your trip, right at that moment the One solution I think would solve this, is to have the Screen.Recording.2022-11-06.at.10.54.40.PM.mov |
@sebastianbarry good job! I see what you are saying in general, but the devil is in the details and I am not sure your description matches what I see in the video. I don't see the collection-repeat height as dynamic in |
I may be mistaken but it looks to me like the heights in Is this not what you are talking about? Also, my point in |
@sebastianbarry that is what I am talking about. However, the height is already 461px at the beginning of the video when the mode is walk?! |
Oh yes I see what you mean, good eye! |
so I am a bit confused. You first say:
and then
So when is it set and when is it not set? and how does this interact with "CSS needs to dynamically pick the height of the diary-card style for that as well" For the CSS, if the problem is recalculating the height of the diary-card, seems like you should be able to make be calculating using a function as well instead of using a %. |
I also noticed the map was not stretching to fit the As you can see, the map now dynamically stretches to fit the trip item div. This required a bit of restructuring of the div structure within the trip_list_item.html. You may also be able to tell, the map displays slightly strangely, where sometimes there is a little whitespace below the map, and sometimes the map displays past the bottom of the div. This is because I set it with a percentage, but that varies for each trip and for each device: /* ----------- iPhone 6+ ----------- */
/* Portrait and Landscape */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (-webkit-min-device-pixel-ratio: 3) {
.angular-leaflet-map { position: absolute; height: 82.8%; width: 46.8%; }
} |
@sebastianbarry from the ionic1 code, it looks like what we really want is to invoke
so if we can get the element similarly in our directive and call |
so the As you can see from the jquery event documentation, the way to pass an event to an element is using So a high level, it seems like you should be able to do:
This is intended to be a rough outline of the direction to follow. Please read the ionic source code and the angular and jquery documentation in detail to understand what you are doing. And if this doesn't work, we may want to change the format of the item so that it does not need the height to be changed - e.g. can we display the buttons side by side instead of one above the other so that the width changes but not the height? |
Note that with |
Per http://websystique.com/angularjs/angularjs-custom-directives-controllers-require-option-guide/ But maybe you don't need to find the element to notify it after all. angular's event mechanism is much more sophisticated than jquery and does not need you to have the element. Instead, you can pass events up and down the DOM tree. So maybe something as simple as Or maybe not; it looks like the two eventing mechanisms are completely different But |
Final comment. It does not look like the However, it does listen to Note however, the on window resize, it calls However, looking at the implementation of
so I thought that maybe we could inject the repeat manager, similar to
get our own copy of it
and call Not sure this will work if all the elements are required to pass in, but if some of them are not used in |
@sebastianbarry I have outlined three possible approaches:
If none of those are easy to use, our options are:
Try them out and LMK what works. |
Here's a proposed patch with a lot of comments. |
I have spent today morning trying to get the patch to work, and while I see how it is supposed to work, I think my knowledge of Angular First, here is the proper render, with all of the changes in the patch commented out: Then, I just tried requiring
Then, I just tried requiring function postLink(scope, element, attr, scrollCtrl, transclude) {
element.on('height-change-needed', scrollCtrl.$element.trigger('scroll-resize'));
}; inside the Then, I tried the <multilabel>
<a> Hello </a>
</multilabel> It gets rendered to <multilabel>
<multilabelcontent... />
<a> Hello </a>
</multilabel> Instead of just <multilabelcontent... />
<!-- Notice how the Hello has disappeared and the heading element for the directive <multilabel> has disappeared too --> However, I am not sure how Finally, I tried your suggestion of using @shankari do you see a flaw in my thought process? I was trying to learn this by looking it up on my own through the angular documentation, but do you see if I'm looking in the wrong places or looking for the wrong thing? |
First, did you look at the console logs to see if there are any errors? If the directive is not rendering, there is an error.
Because the documentation for
Did you try to add log statements or access through the debugger to see what the |
There does seem to be an error during the compile stage for 'multilabel': Following the link to that issue, we get this Angular documentation page which is not much help: I believe this is an issue with my understanding of Angular, and how the different modules interact. I found this page which has been helping me to understand how it works, but I still don't know how to execute it in the code: https://stackoverflow.com/questions/20018507/angular-js-what-is-the-need-of-the-directive-s-link-function-when-we-already-ha |
this is an easy fix - the require doesn't go inside the scope, it goes outside the scope That's what "invalid isolate scope" means - the isolated aka modular scope that you are creating is invalid. |
Here is the patch I had with my previous changes to make the trip-item height dynamic as opposed to singularly-static to the original 330px: Changes:
infinite_scroll_list.js
infinite_scroll_list.html
trip_list_item.html
|
@sebastianbarry if I apply your patch, then there is a fair amount of gap between adjacent trips, and the gap is filled in if we select e-bike. Is this what you expected? Why is this not good enough? height_already_changes_dynamically.mov |
That works. Please see attached video and focus on the second item_height_change_dynamically.movI have also attached a patch of all the changes (including @sebastianbarry's and my changes). @sebastianbarry can you take over now and finish testing? Also, it would be good if you would sent the Also, can you answer my questions about the item-height versus the card height above? It looks like the replaced mode is not cut off even without changing the item-height because the card height changes dynamically. So why do we need to change the item height? |
…is displayed Changes by @sebastianbarry - main.diary.css - Changed the way the map displays, so that it is variable and changes with the height of the trip item - Changed the way the diary card displays as min-content, dynamic, instead of a static hard-coded pixel value - infinite_scroll_list.js - Added a function that returns a hard-coded pixel height value for the trip item in the template's collection-repeat - infinite_scroll_list.html - Added the dynamic collection-repeat "item-height" attribute that is calling the function we made in the controller - trip_list_item.html - Added some styling to the elements so that they display properly with the dynamic height now Changes by @shankari - Find the closest ancestor scroll element if present - Cache it for future use - Call scroll-resize on it Testing done: e-mission/e-mission-docs#831 (comment) Pending testing: - test in all locations where we use the linked survey - at least infinite scroll, diary, diary detail and infinite scroll detail - also include others found through a recursive search Pending improvement: - only trigger the resize if the original value or the new value is e-bike Testing done: Connected via the inspector and verified that the item height changed when the mode was changed to/from e-bike. The distance between items also remained the same, unlike with the prior implementation where the card size changed, but the item size did not, so the gap between items narrowed.
Here are my changes, as they get more complex, I thought it would be easier to commit them into a branch than send patches around: e-mission/e-mission-phone#911 Please let me know when you are done with the testing/minor additional fix. |
Here is the PR which contains the testing on 3 different devices, and my minor additional fix for the sizing of the gap between trip items: e-mission/e-mission-phone#912 |
@sebastianbarry did you note my request for the additional fix - resize only if the to/from mode is e-bike... |
I did not take a look at that. Let me give it a try and see if I can make that change now |
@sebastianbarry also please see the additional testing requested in my commit. I write long commit messages for a reason 😄 |
I added the change to resize only if the to/from mode is e-bike: e-mission/e-mission-phone@a7b6bc3 I am curious to know if this works when the app is on a study To-Do:
|
yes, you should definitely test that the e-bike mode does not change anything on studies. iOS: e-mission/e-mission-phone@089797e |
The problem with the way the diary card is displaying currently is that: In the Diary card, we are currently using 2 div columns separated by a Apparently, when you use
Adding overflow to the parent in this case does not magically cause the floated div to fill to the height of the parent: We may have to restructure the way the template is written for this trip list item, so that we don't need to use
I tried absolute positioning, but this still does not fill the div to be the height of the parent A lot of these guides I'm finding online work when they're using text, because text has an inherent pixel height, but we NEED this I think a table layout would be suitable for this (as seen in the quote above from Stack Overflow), but I've never done it before and I am not sure the pros/cons to doing it that way/. @shankari do you have any ideas on this? |
Again, given that we will remove the diary tab later, can we just create multiple css types - one for label and one for diary? |
I was able to get the map to display properly in both places without using additional css types - this is because they were already using different css types. The label screen was using Testing: Screen.Recording.2022-11-21.at.11.03.28.AM.mov |
@sebastianbarry I don't see the e-bike being selected in any of the detail screens. You have to think through and test all combinations 😄 |
I updated the testing screenshots with screenshots of "e-bike" as selected. One thing I noticed: The replaced mode button is displaying and getting cut off by the bottom of the diary screen We can dedicate time to fix this, but since we are planning on getting rid of the diary screen anyway, we may want to decide to label this as a defect |
@sebastianbarry Ah yes, I know that people in my family still sometimes use the diary screen. I think we should fix it. Since we made most of the changes to the multi-label-ui directive, they are already in the diary as well. So this should be as simple as making the item height of the diary screen also be dynamic. |
Regarding the diary screen replaced mode labeling:
As you can see, the iPhones are working well, even with drastically different pixel dimensions the diary displays well and responds to the program e-bike height on the diary list screen and diary detail screen. The Pixel on the other hand, is not displaying the diary screen at all. I am not sure if this is because of the change I made or if I'm not setting it up right. It is displaying label screen trips, but the app cannot get all green checks on the app status screen because the location says the permissions aren't set right. Usually this hasn't been a problem, but I think it may be a problem for the Android I looked through the logs and I am not seeing any logging errors related to the diary screen loading, so not sure where this issue is coming from: Screen.Recording.2022-11-22.at.9.51.57.AM.movThe only error coming up is this: And it only comes up when I try to click or scroll on the screen |
The app status should not affect the diary screen. Having the diary not show up at all is pretty bad. |
I don't believe I've ever tried or seen the diary screen working on the Pixel. |
I just tried the Pixel on the But after 30 seconds it magically loaded and let me see the trips:
Testing it out on my branch: It is not working, diary screen is not displaying. The only error I see is this: And possibly any of these: |
I got it to work with a different Android emulator! Screen.Recording.2022-11-23.at.9.14.59.AM.movAndroid looks good this change should be good to go |
Great! Merging and deploying today. You should be able to see the change on the test phones if you happen to have them with you. |
Fixed and merged and tested. |
The third "Replaced Mode" button (that displays IF the app is on a program AND the trip's mode is set to "e-bike") gets cut off with the new Updated Label Screen:
The text was updated successfully, but these errors were encountered: