safex-webgl 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/easing/Back.d.ts +7 -64
- package/dist/actions/easing/Back.d.ts.map +1 -1
- package/dist/actions/easing/Back.js +10 -52
- package/dist/actions/easing/Back.js.map +1 -1
- package/dist/actions/easing/Bounce.d.ts +3 -18
- package/dist/actions/easing/Bounce.d.ts.map +1 -1
- package/dist/actions/easing/Bounce.js +6 -6
- package/dist/actions/easing/Bounce.js.map +1 -1
- package/dist/mesh/MeshNode.js +1 -1
- package/package.json +1 -1
- package/dist/actions/ActionEase.d.ts +0 -1298
- package/dist/actions/ActionEase.d.ts.map +0 -1
- package/dist/actions/ActionEase.js +0 -2767
- package/dist/core/DirectorWebGL.js +0 -10
- package/dist/core/labelttf/LabelTTFCacheRenderCmd.d.ts +0 -5
- package/dist/core/labelttf/LabelTTFCacheRenderCmd.d.ts.map +0 -1
- package/dist/core/labelttf/LabelTTFCacheRenderCmd.js +0 -67
- package/dist/core/labelttf/LabelTTFRenderCmd.d.ts +0 -2
- package/dist/core/labelttf/LabelTTFRenderCmd.d.ts.map +0 -1
- package/dist/core/labelttf/LabelTTFRenderCmd.js +0 -305
- package/dist/particle/ParticleExamples.d.ts +0 -27
- package/dist/particle/ParticleExamples.d.ts.map +0 -1
- package/dist/particle/ParticleExamples.js +0 -839
- package/dist/textures/WebGLTextureAtlas.js +0 -5
- package/dist/ui/base/ProtectedNodeRenderCmd.d.ts +0 -6
- package/dist/ui/base/ProtectedNodeRenderCmd.d.ts.map +0 -1
- package/dist/ui/base/ProtectedNodeRenderCmd.js +0 -110
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Director } from './Director';
|
|
2
|
-
export function installWebGLDirectorExtensions() {
|
|
3
|
-
// Only apply for WebGL render type
|
|
4
|
-
// if (_renderType !== game.RENDER_TYPE_WEBGL) {
|
|
5
|
-
// return;
|
|
6
|
-
// }
|
|
7
|
-
// DirectorDelegate for custom projection
|
|
8
|
-
const _p = Director.prototype;
|
|
9
|
-
}
|
|
10
|
-
// Call this function after Director is defined and _renderType is
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LabelTTFCacheRenderCmd.d.ts","sourceRoot":"","sources":["../../../src/core/labelttf/LabelTTFCacheRenderCmd.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,sBAAsB;;;CAMlC,CAAA"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Texture2D } from '../../textures';
|
|
2
|
-
import { inject } from '../../ui/base/ProtectedNodeWebGLRenderCmd';
|
|
3
|
-
import { Node } from '../base-nodes/Node';
|
|
4
|
-
import { rect } from '../cocoa/Geometry';
|
|
5
|
-
import { LabelTTFRenderCmd } from './LabelTTFRenderCmd';
|
|
6
|
-
export const LabelTTFCacheRenderCmd = function () {
|
|
7
|
-
this._labelCmdCtor();
|
|
8
|
-
const locCanvas = (this._labelCanvas = document.createElement('canvas'));
|
|
9
|
-
locCanvas.width = 1;
|
|
10
|
-
locCanvas.height = 1;
|
|
11
|
-
this._labelContext = locCanvas.getContext('2d');
|
|
12
|
-
};
|
|
13
|
-
LabelTTFCacheRenderCmd.prototype = Object.create(LabelTTFRenderCmd.prototype);
|
|
14
|
-
inject(LabelTTFRenderCmd.prototype, LabelTTFCacheRenderCmd.prototype);
|
|
15
|
-
const proto = LabelTTFCacheRenderCmd.prototype;
|
|
16
|
-
proto.constructor = LabelTTFCacheRenderCmd;
|
|
17
|
-
proto._cacheCmdCtor = LabelTTFCacheRenderCmd;
|
|
18
|
-
proto._updateTexture = function () {
|
|
19
|
-
this._dirtyFlag = (this._dirtyFlag & Node._dirtyFlags.textDirty) ^ this._dirtyFlag;
|
|
20
|
-
const node = this._node;
|
|
21
|
-
node._needUpdateTexture = false;
|
|
22
|
-
const locContentSize = node._contentSize;
|
|
23
|
-
this._updateTTF();
|
|
24
|
-
const width = locContentSize.width, height = locContentSize.height;
|
|
25
|
-
const locContext = this._labelContext, locLabelCanvas = this._labelCanvas;
|
|
26
|
-
if (!node._texture) {
|
|
27
|
-
const labelTexture = new Texture2D();
|
|
28
|
-
labelTexture.initWithElement(this._labelCanvas);
|
|
29
|
-
node.setTexture(labelTexture);
|
|
30
|
-
}
|
|
31
|
-
if (node._string.length === 0) {
|
|
32
|
-
locLabelCanvas.width = 1;
|
|
33
|
-
locLabelCanvas.height = locContentSize.height || 1;
|
|
34
|
-
if (node._texture) {
|
|
35
|
-
node._texture._htmlElementObj = this._labelCanvas;
|
|
36
|
-
node._texture.handleLoadedTexture();
|
|
37
|
-
}
|
|
38
|
-
node.setTextureRect(rect(0, 0, 1, locContentSize.height));
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
//set size for labelCanvas
|
|
42
|
-
locContext.font = this._fontStyleStr;
|
|
43
|
-
const flag = locLabelCanvas.width === width && locLabelCanvas.height === height;
|
|
44
|
-
locLabelCanvas.width = width;
|
|
45
|
-
locLabelCanvas.height = height;
|
|
46
|
-
if (flag)
|
|
47
|
-
locContext.clearRect(0, 0, width, height);
|
|
48
|
-
this._saveStatus();
|
|
49
|
-
this._drawTTFInCanvas(locContext);
|
|
50
|
-
if (node._texture) {
|
|
51
|
-
node._texture._htmlElementObj = this._labelCanvas;
|
|
52
|
-
node._texture.handleLoadedTexture();
|
|
53
|
-
}
|
|
54
|
-
node.setTextureRect(rect(0, 0, width, height));
|
|
55
|
-
return true;
|
|
56
|
-
};
|
|
57
|
-
proto._measureConfig = function () {
|
|
58
|
-
this._labelContext.font = this._fontStyleStr;
|
|
59
|
-
};
|
|
60
|
-
proto._measure = function (text) {
|
|
61
|
-
if (text) {
|
|
62
|
-
return this._labelContext.measureText(text).width;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return 0;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LabelTTFRenderCmd.d.ts","sourceRoot":"","sources":["../../../src/core/labelttf/LabelTTFRenderCmd.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,iBAAiB,YAgB7B,CAAA"}
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { game, global, Node, p, Rect, Size, view } from '../..';
|
|
2
|
-
import { _renderType } from '../../helper/engine';
|
|
3
|
-
import { TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_RIGHT, VERTICAL_TEXT_ALIGNMENT_BOTTOM, VERTICAL_TEXT_ALIGNMENT_CENTER, VERTICAL_TEXT_ALIGNMENT_TOP, } from '../platform';
|
|
4
|
-
import { FontDefinition } from '../platform/FontDefinition';
|
|
5
|
-
import { LabelTTF } from './LabelTTF';
|
|
6
|
-
export const LabelTTFRenderCmd = function () {
|
|
7
|
-
this._fontClientHeight = 18;
|
|
8
|
-
this._fontStyleStr = '';
|
|
9
|
-
this._shadowColorStr = 'rgba(128, 128, 128, 0.5)';
|
|
10
|
-
this._strokeColorStr = '';
|
|
11
|
-
this._fillColorStr = 'rgba(255,255,255,1)';
|
|
12
|
-
this._labelCanvas = null;
|
|
13
|
-
this._labelContext = null;
|
|
14
|
-
this._lineWidths = [];
|
|
15
|
-
this._strings = [];
|
|
16
|
-
this._isMultiLine = false;
|
|
17
|
-
this._status = [];
|
|
18
|
-
this._renderingIndex = 0;
|
|
19
|
-
this._canUseDirtyRegion = true;
|
|
20
|
-
};
|
|
21
|
-
const proto = LabelTTFRenderCmd.prototype;
|
|
22
|
-
proto.constructor = LabelTTFRenderCmd;
|
|
23
|
-
proto._labelCmdCtor = LabelTTFRenderCmd;
|
|
24
|
-
proto._setFontStyle = function (fontNameOrFontDef, fontSize, fontStyle, fontWeight) {
|
|
25
|
-
if (fontNameOrFontDef instanceof FontDefinition) {
|
|
26
|
-
this._fontStyleStr = fontNameOrFontDef._getCanvasFontStr();
|
|
27
|
-
this._fontClientHeight = LabelTTF.__getFontHeightByDiv(fontNameOrFontDef);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const deviceFontSize = fontSize * view.getDevicePixelRatio();
|
|
31
|
-
this._fontStyleStr = `${fontStyle} ${fontWeight} ${deviceFontSize}px '${fontNameOrFontDef}'`;
|
|
32
|
-
this._fontClientHeight = LabelTTF.__getFontHeightByDiv(fontNameOrFontDef, fontSize);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
proto._getFontStyle = function () {
|
|
36
|
-
return this._fontStyleStr;
|
|
37
|
-
};
|
|
38
|
-
proto._getFontClientHeight = function () {
|
|
39
|
-
return this._fontClientHeight;
|
|
40
|
-
};
|
|
41
|
-
proto._updateColor = function () {
|
|
42
|
-
this._setColorsString();
|
|
43
|
-
this._updateTexture();
|
|
44
|
-
};
|
|
45
|
-
proto._setColorsString = function () {
|
|
46
|
-
const locDisplayColor = this._displayedColor, node = this._node, locShadowColor = node._shadowColor || this._displayedColor;
|
|
47
|
-
const locStrokeColor = node._strokeColor, locFontFillColor = node._textFillColor;
|
|
48
|
-
const dr = locDisplayColor.r / 255, dg = locDisplayColor.g / 255, db = locDisplayColor.b / 255;
|
|
49
|
-
this._shadowColorStr = `rgba(${0 | (dr * locShadowColor.r)},${0 | (dg * locShadowColor.g)},${0 | (db * locShadowColor.b)},${node._shadowOpacity})`;
|
|
50
|
-
this._fillColorStr = `rgba(${0 | (dr * locFontFillColor.r)},${0 | (dg * locFontFillColor.g)},${0 | (db * locFontFillColor.b)}, 1)`;
|
|
51
|
-
this._strokeColorStr = `rgba(${0 | (dr * locStrokeColor.r)},${0 | (dg * locStrokeColor.g)},${0 | (db * locStrokeColor.b)}, 1)`;
|
|
52
|
-
};
|
|
53
|
-
const localBB = new Rect();
|
|
54
|
-
proto.getLocalBB = function () {
|
|
55
|
-
const node = this._node;
|
|
56
|
-
localBB.x = localBB.y = 0;
|
|
57
|
-
const pixelRatio = view.getDevicePixelRatio();
|
|
58
|
-
localBB.width = node._getWidth() * pixelRatio;
|
|
59
|
-
localBB.height = node._getHeight() * pixelRatio;
|
|
60
|
-
return localBB;
|
|
61
|
-
};
|
|
62
|
-
proto._updateTTF = function () {
|
|
63
|
-
const node = this._node;
|
|
64
|
-
const pixelRatio = view.getDevicePixelRatio();
|
|
65
|
-
const locDimensionsWidth = node._dimensions.width * pixelRatio;
|
|
66
|
-
let i;
|
|
67
|
-
let strLength;
|
|
68
|
-
const locLineWidth = this._lineWidths;
|
|
69
|
-
locLineWidth.length = 0;
|
|
70
|
-
this._isMultiLine = false;
|
|
71
|
-
this._measureConfig();
|
|
72
|
-
const textWidthCache = {};
|
|
73
|
-
if (locDimensionsWidth !== 0) {
|
|
74
|
-
// Content processing
|
|
75
|
-
this._strings = node._string.split('\n');
|
|
76
|
-
for (i = 0; i < this._strings.length; i++) {
|
|
77
|
-
this._checkWarp(this._strings, i, locDimensionsWidth);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
this._strings = node._string.split('\n');
|
|
82
|
-
for (i = 0, strLength = this._strings.length; i < strLength; i++) {
|
|
83
|
-
if (this._strings[i]) {
|
|
84
|
-
const measuredWidth = this._measure(this._strings[i]);
|
|
85
|
-
locLineWidth.push(measuredWidth);
|
|
86
|
-
textWidthCache[this._strings[i]] = measuredWidth;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
locLineWidth.push(0);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (this._strings.length > 1)
|
|
94
|
-
this._isMultiLine = true;
|
|
95
|
-
let locSize, locStrokeShadowOffsetX = 0, locStrokeShadowOffsetY = 0;
|
|
96
|
-
if (node._strokeEnabled)
|
|
97
|
-
locStrokeShadowOffsetX = locStrokeShadowOffsetY = node._strokeSize * 2;
|
|
98
|
-
if (node._shadowEnabled) {
|
|
99
|
-
const locOffsetSize = node._shadowOffset;
|
|
100
|
-
locStrokeShadowOffsetX += Math.abs(locOffsetSize.x) * 2;
|
|
101
|
-
locStrokeShadowOffsetY += Math.abs(locOffsetSize.y) * 2;
|
|
102
|
-
}
|
|
103
|
-
//get offset for stroke and shadow
|
|
104
|
-
if (locDimensionsWidth === 0) {
|
|
105
|
-
if (this._isMultiLine) {
|
|
106
|
-
locSize = Size(Math.ceil(Math.max(...locLineWidth) + locStrokeShadowOffsetX), Math.ceil(this._fontClientHeight * pixelRatio * this._strings.length + locStrokeShadowOffsetY));
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
let measuredWidth = textWidthCache[node._string];
|
|
110
|
-
if (!measuredWidth && node._string) {
|
|
111
|
-
measuredWidth = this._measure(node._string);
|
|
112
|
-
}
|
|
113
|
-
locSize = Size(Math.ceil((measuredWidth ? measuredWidth : 0) + locStrokeShadowOffsetX), Math.ceil(this._fontClientHeight * pixelRatio + locStrokeShadowOffsetY));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
if (node._dimensions.height === 0) {
|
|
118
|
-
if (this._isMultiLine)
|
|
119
|
-
locSize = Size(Math.ceil(locDimensionsWidth + locStrokeShadowOffsetX), Math.ceil(node.getLineHeight() * pixelRatio * this._strings.length + locStrokeShadowOffsetY));
|
|
120
|
-
else
|
|
121
|
-
locSize = Size(Math.ceil(locDimensionsWidth + locStrokeShadowOffsetX), Math.ceil(node.getLineHeight() * pixelRatio + locStrokeShadowOffsetY));
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
//dimension is already set, contentSize must be same as dimension
|
|
125
|
-
locSize = Size(Math.ceil(locDimensionsWidth + locStrokeShadowOffsetX), Math.ceil(node._dimensions.height * pixelRatio + locStrokeShadowOffsetY));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (node._getFontStyle() !== 'normal') {
|
|
129
|
-
//add width for 'italic' and 'oblique'
|
|
130
|
-
locSize.width = Math.ceil(locSize.width + node._fontSize * 0.3);
|
|
131
|
-
}
|
|
132
|
-
node.setContentSize(locSize);
|
|
133
|
-
node._strokeShadowOffsetX = locStrokeShadowOffsetX;
|
|
134
|
-
node._strokeShadowOffsetY = locStrokeShadowOffsetY;
|
|
135
|
-
// need computing _anchorPointInPoints
|
|
136
|
-
const locAP = node._anchorPoint;
|
|
137
|
-
this._anchorPointInPoints.x = locStrokeShadowOffsetX * 0.5 + (locSize.width - locStrokeShadowOffsetX) * locAP.x;
|
|
138
|
-
this._anchorPointInPoints.y = locStrokeShadowOffsetY * 0.5 + (locSize.height - locStrokeShadowOffsetY) * locAP.y;
|
|
139
|
-
};
|
|
140
|
-
proto._saveStatus = function () {
|
|
141
|
-
const node = this._node;
|
|
142
|
-
const scale = view.getDevicePixelRatio();
|
|
143
|
-
const locStrokeShadowOffsetX = node._strokeShadowOffsetX, locStrokeShadowOffsetY = node._strokeShadowOffsetY;
|
|
144
|
-
const locContentSizeHeight = node._contentSize.height - locStrokeShadowOffsetY, locVAlignment = node._vAlignment, locHAlignment = node._hAlignment;
|
|
145
|
-
const dx = locStrokeShadowOffsetX * 0.5, dy = locContentSizeHeight + locStrokeShadowOffsetY * 0.5;
|
|
146
|
-
let xOffset = 0;
|
|
147
|
-
let yOffset = 0;
|
|
148
|
-
const OffsetYArray = [];
|
|
149
|
-
const locContentWidth = node._contentSize.width - locStrokeShadowOffsetX;
|
|
150
|
-
//lineHeight
|
|
151
|
-
const lineHeight = node.getLineHeight() * scale;
|
|
152
|
-
const transformTop = (lineHeight - this._fontClientHeight * scale) / 2;
|
|
153
|
-
if (locHAlignment === TEXT_ALIGNMENT_RIGHT)
|
|
154
|
-
xOffset += locContentWidth;
|
|
155
|
-
else if (locHAlignment === TEXT_ALIGNMENT_CENTER)
|
|
156
|
-
xOffset += locContentWidth / 2;
|
|
157
|
-
else
|
|
158
|
-
xOffset += 0;
|
|
159
|
-
if (this._isMultiLine) {
|
|
160
|
-
const locStrLen = this._strings.length;
|
|
161
|
-
if (locVAlignment === VERTICAL_TEXT_ALIGNMENT_BOTTOM)
|
|
162
|
-
yOffset = lineHeight - transformTop * 2 + locContentSizeHeight - lineHeight * locStrLen;
|
|
163
|
-
else if (locVAlignment === VERTICAL_TEXT_ALIGNMENT_CENTER)
|
|
164
|
-
yOffset = (lineHeight - transformTop * 2) / 2 + (locContentSizeHeight - lineHeight * locStrLen) / 2;
|
|
165
|
-
for (let i = 0; i < locStrLen; i++) {
|
|
166
|
-
const tmpOffsetY = -locContentSizeHeight + (lineHeight * i + transformTop) + yOffset;
|
|
167
|
-
OffsetYArray.push(tmpOffsetY);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
if (locVAlignment === VERTICAL_TEXT_ALIGNMENT_BOTTOM) {
|
|
172
|
-
//do nothing
|
|
173
|
-
}
|
|
174
|
-
else if (locVAlignment === VERTICAL_TEXT_ALIGNMENT_TOP) {
|
|
175
|
-
yOffset -= locContentSizeHeight;
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
yOffset -= locContentSizeHeight * 0.5;
|
|
179
|
-
}
|
|
180
|
-
OffsetYArray.push(yOffset);
|
|
181
|
-
}
|
|
182
|
-
const tmpStatus = {
|
|
183
|
-
contextTransform: p(dx, dy),
|
|
184
|
-
xOffset: xOffset,
|
|
185
|
-
OffsetYArray: OffsetYArray,
|
|
186
|
-
};
|
|
187
|
-
this._status.push(tmpStatus);
|
|
188
|
-
};
|
|
189
|
-
proto._drawTTFInCanvas = function (context) {
|
|
190
|
-
if (!context)
|
|
191
|
-
return;
|
|
192
|
-
const locStatus = this._status.pop();
|
|
193
|
-
context.setTransform(1, 0, 0, 1, locStatus.contextTransform.x, locStatus.contextTransform.y);
|
|
194
|
-
const xOffset = locStatus.xOffset;
|
|
195
|
-
const yOffsetArray = locStatus.OffsetYArray;
|
|
196
|
-
this.drawLabels(context, xOffset, yOffsetArray);
|
|
197
|
-
};
|
|
198
|
-
proto._checkWarp = function (strArr, i, maxWidth) {
|
|
199
|
-
const text = strArr[i];
|
|
200
|
-
const allWidth = this._measure(text);
|
|
201
|
-
if (allWidth > maxWidth && text.length > 1) {
|
|
202
|
-
let fuzzyLen = (text.length * (maxWidth / allWidth)) | 0;
|
|
203
|
-
let tmpText = text.substr(fuzzyLen);
|
|
204
|
-
let width = allWidth - this._measure(tmpText);
|
|
205
|
-
let sLine;
|
|
206
|
-
let pushNum = 0;
|
|
207
|
-
//Increased while cycle maximum ceiling. default 100 time
|
|
208
|
-
let checkWhile = 0;
|
|
209
|
-
//Exceeded the size
|
|
210
|
-
while (width > maxWidth && checkWhile++ < 100) {
|
|
211
|
-
fuzzyLen *= maxWidth / width;
|
|
212
|
-
fuzzyLen = fuzzyLen | 0;
|
|
213
|
-
tmpText = text.substr(fuzzyLen);
|
|
214
|
-
width = allWidth - this._measure(tmpText);
|
|
215
|
-
}
|
|
216
|
-
checkWhile = 0;
|
|
217
|
-
//Find the truncation point
|
|
218
|
-
while (width < maxWidth && checkWhile++ < 100) {
|
|
219
|
-
if (tmpText) {
|
|
220
|
-
const exec = LabelTTF._wordRex.exec(tmpText);
|
|
221
|
-
pushNum = exec ? exec[0].length : 1;
|
|
222
|
-
sLine = tmpText;
|
|
223
|
-
}
|
|
224
|
-
fuzzyLen = fuzzyLen + pushNum;
|
|
225
|
-
tmpText = text.substr(fuzzyLen);
|
|
226
|
-
width = allWidth - this._measure(tmpText);
|
|
227
|
-
}
|
|
228
|
-
fuzzyLen -= pushNum;
|
|
229
|
-
if (fuzzyLen === 0) {
|
|
230
|
-
fuzzyLen = 1;
|
|
231
|
-
sLine = sLine.substr(1);
|
|
232
|
-
}
|
|
233
|
-
let sText = text.substr(0, fuzzyLen), result;
|
|
234
|
-
//symbol in the first
|
|
235
|
-
if (LabelTTF.wrapInspection) {
|
|
236
|
-
if (LabelTTF._symbolRex.test(sLine || tmpText)) {
|
|
237
|
-
result = LabelTTF._lastWordRex.exec(sText);
|
|
238
|
-
fuzzyLen -= result ? result[0].length : 0;
|
|
239
|
-
if (fuzzyLen === 0)
|
|
240
|
-
fuzzyLen = 1;
|
|
241
|
-
sLine = text.substr(fuzzyLen);
|
|
242
|
-
sText = text.substr(0, fuzzyLen);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
//To judge whether a English words are truncated
|
|
246
|
-
if (LabelTTF._firstEnglish.test(sLine)) {
|
|
247
|
-
result = LabelTTF._lastEnglish.exec(sText);
|
|
248
|
-
if (result && sText !== result[0]) {
|
|
249
|
-
fuzzyLen -= result[0].length;
|
|
250
|
-
sLine = text.substr(fuzzyLen);
|
|
251
|
-
sText = text.substr(0, fuzzyLen);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
strArr[i] = sLine || tmpText;
|
|
255
|
-
strArr.splice(i, 0, sText);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
proto.updateStatus = function () {
|
|
259
|
-
const flags = Node._dirtyFlags, locFlag = this._dirtyFlag;
|
|
260
|
-
if (locFlag & flags.textDirty)
|
|
261
|
-
this._updateTexture();
|
|
262
|
-
this.originUpdateStatus();
|
|
263
|
-
};
|
|
264
|
-
proto._syncStatus = function (parentCmd) {
|
|
265
|
-
const flags = Node._dirtyFlags, locFlag = this._dirtyFlag;
|
|
266
|
-
if (locFlag & flags.textDirty)
|
|
267
|
-
this._updateTexture();
|
|
268
|
-
this._originSyncStatus(parentCmd);
|
|
269
|
-
if (_renderType === game.RENDER_TYPE_WEBGL || locFlag & flags.transformDirty)
|
|
270
|
-
this.transform(parentCmd);
|
|
271
|
-
};
|
|
272
|
-
proto.drawLabels = function (context, xOffset, yOffsetArray) {
|
|
273
|
-
const node = this._node;
|
|
274
|
-
//shadow style setup
|
|
275
|
-
if (node._shadowEnabled) {
|
|
276
|
-
const locShadowOffset = node._shadowOffset;
|
|
277
|
-
context.shadowColor = this._shadowColorStr;
|
|
278
|
-
context.shadowOffsetX = locShadowOffset.x;
|
|
279
|
-
context.shadowOffsetY = -locShadowOffset.y;
|
|
280
|
-
context.shadowBlur = node._shadowBlur;
|
|
281
|
-
}
|
|
282
|
-
const locHAlignment = node._hAlignment, locVAlignment = node._vAlignment, locStrokeSize = node._strokeSize;
|
|
283
|
-
//this is fillText for canvas
|
|
284
|
-
if (context.font !== this._fontStyleStr)
|
|
285
|
-
context.font = this._fontStyleStr;
|
|
286
|
-
context.fillStyle = this._fillColorStr;
|
|
287
|
-
//stroke style setup
|
|
288
|
-
const locStrokeEnabled = node._strokeEnabled;
|
|
289
|
-
if (locStrokeEnabled) {
|
|
290
|
-
context.lineWidth = locStrokeSize * 2;
|
|
291
|
-
context.strokeStyle = this._strokeColorStr;
|
|
292
|
-
}
|
|
293
|
-
context.textBaseline = LabelTTF._textBaseline[locVAlignment];
|
|
294
|
-
context.textAlign = LabelTTF._textAlign[locHAlignment];
|
|
295
|
-
const locStrLen = this._strings.length;
|
|
296
|
-
for (let i = 0; i < locStrLen; i++) {
|
|
297
|
-
const line = this._strings[i];
|
|
298
|
-
if (locStrokeEnabled) {
|
|
299
|
-
context.lineJoin = 'round';
|
|
300
|
-
context.strokeText(line, xOffset, yOffsetArray[i]);
|
|
301
|
-
}
|
|
302
|
-
context.fillText(line, xOffset, yOffsetArray[i]);
|
|
303
|
-
}
|
|
304
|
-
global.g_NumberOfDraws++;
|
|
305
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/****************************************************************************
|
|
2
|
-
Copyright (c) 2008-2010 Ricardo Quesada
|
|
3
|
-
Copyright (c) 2011-2012 cocos2d-x.org
|
|
4
|
-
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
|
5
|
-
|
|
6
|
-
http://www.cocos2d-x.org
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in
|
|
16
|
-
all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
-
THE SOFTWARE.
|
|
25
|
-
****************************************************************************/
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=ParticleExamples.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParticleExamples.d.ts","sourceRoot":"","sources":["../../src/particle/ParticleExamples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;8EAwB8E"}
|