This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix fontSizeChange event for Restore Font Size command #7443
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think delta for
em
is 0.1, not 10. Look at the one used in_adjustFontSize
function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RaymondLim it's a 10:1 ratio for ems:pixel. The code you refer to is a 1:0.1 ratio which equates to 10:1. If the units are in ems, we need to multiply them by 10 to convert them into pixels. I think keeping everything in pixels is the best bet even if we are using ems because, I think, the calculated font-size always comes back in pixels regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, if I am being completely honest with both of you, I haven't tested this with setting the font size to em units...so, I probably should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomMalbran, if the value of
$(".CodeMirror").css("font-size")
always comes back in pixels, and I think it does, we don't have to check for ems, correct? Or am I wrong about it always coming back as pixels?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that on chrome it does return the calculated value, but not
sure about other browsers or if the api might change once chrome is able to
return the original value.
Anyway this is just for completition since the rest of the code aaaumes it
can be either value. We probably won't be able to test it. But if we don't
add it here we should assume that we alwaya get px and remove the em bit
and be sure that it will work on other browsers. Ao maybe that is for
another clean up, and I think that it might have been discussed before.
El 08/04/2014 02:09, "Lance Campbell" notifications@github.com escribió:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomMalbran, okay, sounds good. Thanks for addressing all my questions.
@RaymondLim, I tested the code setting the font size to em units. It works; however, as @TomMalbran and I were discussing, that branch of the code never gets run. Currently, all font sizes contained in variables
oldFontSize
andnewFontSize
are always in terms of pixels. I addressed your question on the math of em ratios as best I could so I think this code review is done. I have nothing to change in the code at this point.