Skip to content

Commit ee6857f

Browse files
author
Hannah
authoredJun 30, 2020
Merge pull request #8993 from CesiumGS/ios-workaround
Avoid 'use' in SVG due to iOS 13.5.1 bug
2 parents 3b54b9d + fd9d3d0 commit ee6857f

File tree

2 files changed

+86
-75
lines changed

2 files changed

+86
-75
lines changed
 

‎CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Fixed `scene.pickFromRay` intersection inaccuracies. [#8439](https://github.com/CesiumGS/cesium/issues/8439)
2828
- Fixed a bug where a null or undefined name property passed to the `Entity` constructor would throw an exception.[#8832](https://github.com/CesiumGS/cesium/pull/8832)
2929
- Fixed JSDoc and TypeScript type definitions for `ScreenSpaceEventHandler.getInputAction` which listed incorrect return type. [#9002](https://github.com/CesiumGS/cesium/pull/9002)
30+
- Fixed animation widget SVG icons not appearing in iOS 13.5.1. [#8993](https://github.com/CesiumGS/cesium/pull/8993)
3031

3132
### 1.70.1 - 2020-06-10
3233

‎Source/Widgets/Animation/Animation.js

+85-75
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,56 @@ function getElementColor(element) {
2929
);
3030
}
3131

32+
var svgIconsById = {
33+
animation_pathReset: {
34+
tagName: "path",
35+
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
36+
d:
37+
"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z",
38+
},
39+
animation_pathPause: {
40+
tagName: "path",
41+
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
42+
d: "M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z",
43+
},
44+
animation_pathPlay: {
45+
tagName: "path",
46+
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
47+
d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z",
48+
},
49+
animation_pathPlayReverse: {
50+
tagName: "path",
51+
transform: "translate(16,16) scale(-0.85,0.85) translate(-16,-16)",
52+
d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z",
53+
},
54+
animation_pathLoop: {
55+
tagName: "path",
56+
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
57+
d:
58+
"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z",
59+
},
60+
animation_pathClock: {
61+
tagName: "path",
62+
transform: "translate(16,16) scale(0.85) translate(-16,-15.5)",
63+
d:
64+
"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z",
65+
},
66+
animation_pathWingButton: {
67+
tagName: "path",
68+
d:
69+
"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z",
70+
},
71+
animation_pathPointer: {
72+
tagName: "path",
73+
d: "M-15,-65,-15,-55,15,-55,15,-65,0,-95z",
74+
},
75+
animation_pathSwooshFX: {
76+
tagName: "path",
77+
d:
78+
"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z",
79+
},
80+
};
81+
3282
//Dynamically builds an SVG element from a JSON object.
3383
function svgFromObject(obj) {
3484
var ele = document.createElementNS(svgNS, obj.tagName);
@@ -86,6 +136,8 @@ function makeColorString(background, gradient) {
86136
}
87137

88138
function rectButton(x, y, path) {
139+
var iconInfo = svgIconsById[path];
140+
89141
var button = {
90142
tagName: "g",
91143
class: "cesium-animation-rectButton",
@@ -108,9 +160,11 @@ function rectButton(x, y, path) {
108160
ry: 4,
109161
},
110162
{
111-
tagName: "use",
112163
class: "cesium-animation-buttonPath",
113-
"xlink:href": path,
164+
id: path,
165+
tagName: iconInfo.tagName,
166+
transform: iconInfo.transform,
167+
d: iconInfo.d,
114168
},
115169
{
116170
tagName: "title",
@@ -122,25 +176,32 @@ function rectButton(x, y, path) {
122176
}
123177

124178
function wingButton(x, y, path) {
179+
var buttonIconInfo = svgIconsById[path];
180+
var wingIconInfo = svgIconsById["animation_pathWingButton"];
181+
125182
var button = {
126183
tagName: "g",
127184
class: "cesium-animation-rectButton",
128185
transform: "translate(" + x + "," + y + ")",
129186
children: [
130187
{
131-
tagName: "use",
132188
class: "cesium-animation-buttonGlow",
133-
"xlink:href": "#animation_pathWingButton",
189+
id: "animation_pathWingButton",
190+
tagName: wingIconInfo.tagName,
191+
d: wingIconInfo.d,
134192
},
135193
{
136-
tagName: "use",
137194
class: "cesium-animation-buttonMain",
138-
"xlink:href": "#animation_pathWingButton",
195+
id: "animation_pathWingButton",
196+
tagName: wingIconInfo.tagName,
197+
d: wingIconInfo.d,
139198
},
140199
{
141-
tagName: "use",
142200
class: "cesium-animation-buttonPath",
143-
"xlink:href": path,
201+
id: path,
202+
tagName: buttonIconInfo.tagName,
203+
transform: buttonIconInfo.transform,
204+
d: buttonIconInfo.d,
144205
},
145206
{
146207
tagName: "title",
@@ -436,19 +497,19 @@ function Animation(container, viewModel) {
436497
this._topG = topG;
437498

438499
this._realtimeSVG = new SvgButton(
439-
wingButton(3, 4, "#animation_pathClock"),
500+
wingButton(3, 4, "animation_pathClock"),
440501
viewModel.playRealtimeViewModel
441502
);
442503
this._playReverseSVG = new SvgButton(
443-
rectButton(44, 99, "#animation_pathPlayReverse"),
504+
rectButton(44, 99, "animation_pathPlayReverse"),
444505
viewModel.playReverseViewModel
445506
);
446507
this._playForwardSVG = new SvgButton(
447-
rectButton(124, 99, "#animation_pathPlay"),
508+
rectButton(124, 99, "animation_pathPlay"),
448509
viewModel.playForwardViewModel
449510
);
450511
this._pauseSVG = new SvgButton(
451-
rectButton(84, 99, "#animation_pathPause"),
512+
rectButton(84, 99, "animation_pathPause"),
452513
viewModel.pauseViewModel
453514
);
454515

@@ -467,19 +528,24 @@ function Animation(container, viewModel) {
467528
});
468529
this._shuttleRingBackPanel = shuttleRingBackPanel;
469530

531+
var swooshIconInfo = svgIconsById["animation_pathSwooshFX"];
532+
var shuttleRingPointerIconInfo = svgIconsById["animation_pathPointer"];
533+
470534
var shuttleRingSwooshG = svgFromObject({
471535
tagName: "g",
472536
class: "cesium-animation-shuttleRingSwoosh",
473537
children: [
474538
{
475-
tagName: "use",
539+
tagName: swooshIconInfo.tagName,
476540
transform: "translate(100,97) scale(-1,1)",
477-
"xlink:href": "#animation_pathSwooshFX",
541+
id: "animation_pathSwooshFX",
542+
d: swooshIconInfo.d,
478543
},
479544
{
480-
tagName: "use",
545+
tagName: swooshIconInfo.tagName,
481546
transform: "translate(100,97)",
482-
"xlink:href": "#animation_pathSwooshFX",
547+
id: "animation_pathSwooshFX",
548+
d: swooshIconInfo.d,
483549
},
484550
{
485551
tagName: "line",
@@ -493,9 +559,10 @@ function Animation(container, viewModel) {
493559
this._shuttleRingSwooshG = shuttleRingSwooshG;
494560

495561
this._shuttleRingPointer = svgFromObject({
496-
tagName: "use",
497562
class: "cesium-animation-shuttleRingPointer",
498-
"xlink:href": "#animation_pathPointer",
563+
id: "animation_pathPointer",
564+
tagName: shuttleRingPointerIconInfo.tagName,
565+
d: shuttleRingPointerIconInfo.d,
499566
});
500567

501568
var knobG = svgFromObject({
@@ -1164,63 +1231,6 @@ Animation.prototype.applyThemeChanges = function () {
11641231
},
11651232
],
11661233
},
1167-
{
1168-
id: "animation_pathReset",
1169-
tagName: "path",
1170-
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
1171-
d:
1172-
"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z",
1173-
},
1174-
{
1175-
id: "animation_pathPause",
1176-
tagName: "path",
1177-
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
1178-
d:
1179-
"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z",
1180-
},
1181-
{
1182-
id: "animation_pathPlay",
1183-
tagName: "path",
1184-
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
1185-
d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z",
1186-
},
1187-
{
1188-
id: "animation_pathPlayReverse",
1189-
tagName: "path",
1190-
transform: "translate(16,16) scale(-0.85,0.85) translate(-16,-16)",
1191-
d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z",
1192-
},
1193-
{
1194-
id: "animation_pathLoop",
1195-
tagName: "path",
1196-
transform: "translate(16,16) scale(0.85) translate(-16,-16)",
1197-
d:
1198-
"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z",
1199-
},
1200-
{
1201-
id: "animation_pathClock",
1202-
tagName: "path",
1203-
transform: "translate(16,16) scale(0.85) translate(-16,-15.5)",
1204-
d:
1205-
"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z",
1206-
},
1207-
{
1208-
id: "animation_pathWingButton",
1209-
tagName: "path",
1210-
d:
1211-
"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z",
1212-
},
1213-
{
1214-
id: "animation_pathPointer",
1215-
tagName: "path",
1216-
d: "M-15,-65,-15,-55,15,-55,15,-65,0,-95z",
1217-
},
1218-
{
1219-
id: "animation_pathSwooshFX",
1220-
tagName: "path",
1221-
d:
1222-
"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z",
1223-
},
12241234
],
12251235
});
12261236

0 commit comments

Comments
 (0)
Please sign in to comment.