mirror of
https://github.com/processing/processing4.git
synced 2026-01-28 02:41:08 +01:00
make pixelDensity(displayDensity()) work properly, fixes #3436
This commit is contained in:
@@ -329,6 +329,11 @@ public class PdePreprocessor {
|
||||
String[] pixelDensityContents = matchMethod("pixelDensity", searchArea);
|
||||
if (pixelDensityContents != null) {
|
||||
extraStatements.append(pixelDensityContents[0]);
|
||||
} else {
|
||||
pixelDensityContents = matchDensityMess(searchArea);
|
||||
if (pixelDensityContents != null) {
|
||||
extraStatements.append(pixelDensityContents[0]);
|
||||
}
|
||||
}
|
||||
|
||||
String[] sizeContents = matchMethod("size", searchArea);
|
||||
@@ -433,6 +438,13 @@ public class PdePreprocessor {
|
||||
}
|
||||
|
||||
|
||||
static protected String[] matchDensityMess(String searchArea) {
|
||||
final String regexp =
|
||||
"(?:^|\\s|;)pixelDensity\\s*\\(\\s*displayDensity\\s*\\([^\\)]*\\)\\s*\\)\\s*\\;";
|
||||
return PApplet.match(searchArea, regexp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replace all commented portions of a given String as spaces.
|
||||
* Utility function used here and in the preprocessor.
|
||||
|
||||
Reference in New Issue
Block a user