@@ -54,7 +54,7 @@ public class TextFlow extends inkCustomController {
5454 protected func InitializeOffsets() {
5555 ArrayResize(this.m_charOffsets, this.m_length + 1);
5656
57- this.m_charOffsets[0] = 0;
57+ this.m_charOffsets[0] = 0.0 ;
5858
5959 if this.m_length > 0 {
6060 let position: Int32 = 1;
@@ -168,8 +168,8 @@ public class TextFlow extends inkCustomController {
168168 return this.m_text.GetLetterCase();
169169 }
170170
171- public func SetLetterCase(case : textLetterCase) {
172- this.m_text.SetLetterCase(case );
171+ public func SetLetterCase(value : textLetterCase) {
172+ this.m_text.SetLetterCase(value );
173173 }
174174
175175 public func GetFontSize() -> Int32 {
@@ -255,16 +255,13 @@ public class TextFlow extends inkCustomController {
255255 position = Max(position, 0);
256256 position = Min(position, this.m_length);
257257
258- switch position {
259- case 0:
260- this.m_value = char + this.m_value;
261- break;
262- case this.m_length:
263- this.m_value += char;
264- break;
265- default:
266- this.m_value = UTF8StrLeft(this.m_value, position)
267- + char + UTF8StrRight(this.m_value, this.m_length - position);
258+ if position == 0 {
259+ this.m_value = char + this.m_value;
260+ } else if position == this.m_length {
261+ this.m_value += char;
262+ } else {
263+ this.m_value = UTF8StrLeft(this.m_value, position)
264+ + char + UTF8StrRight(this.m_value, this.m_length - position);
268265 }
269266
270267 this.m_length += 1;
@@ -284,16 +281,13 @@ public class TextFlow extends inkCustomController {
284281 position = Max(position, 0);
285282 position = Min(position, this.m_length);
286283
287- switch position {
288- case 0:
289- this.m_value = text + this.m_value;
290- break;
291- case this.m_length:
292- this.m_value += text;
293- break;
294- default:
295- this.m_value = UTF8StrLeft(this.m_value, position)
296- + text + UTF8StrRight(this.m_value, this.m_length - position);
284+ if position == 0 {
285+ this.m_value = text + this.m_value;
286+ } else if position == this.m_length {
287+ this.m_value += text;
288+ } else {
289+ this.m_value = UTF8StrLeft(this.m_value, position)
290+ + text + UTF8StrRight(this.m_value, this.m_length - position);
297291 }
298292
299293 this.m_length += length;
@@ -312,16 +306,13 @@ public class TextFlow extends inkCustomController {
312306 position = Max(position, 0);
313307 position = Min(position, this.m_length - 1);
314308
315- switch position {
316- case 0:
317- this.m_value = UTF8StrRight(this.m_value, this.m_length - 1);
318- break;
319- case this.m_length - 1:
320- this.m_value = UTF8StrLeft(this.m_value, this.m_length - 1);
321- break;
322- default:
323- this.m_value = UTF8StrLeft(this.m_value, position)
324- + UTF8StrRight(this.m_value, this.m_length - position - 1);
309+ if position == 0 {
310+ this.m_value = UTF8StrRight(this.m_value, this.m_length - 1);
311+ } else if position == this.m_length - 1 {
312+ this.m_value = UTF8StrLeft(this.m_value, this.m_length - 1);
313+ } else {
314+ this.m_value = UTF8StrLeft(this.m_value, position)
315+ + UTF8StrRight(this.m_value, this.m_length - position - 1);
325316 }
326317
327318 this.m_length -= 1;
0 commit comments