OLD | NEW |
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
2 // limitations under the License. | 2 // limitations under the License. |
3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
7 // | 7 // |
8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
9 // | 9 // |
10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 this.eventHandler_ = null; | 184 this.eventHandler_ = null; |
185 }; | 185 }; |
186 | 186 |
187 | 187 |
188 | 188 |
189 /** | 189 /** |
190 * One point in the stroke. | 190 * One point in the stroke. |
191 * | 191 * |
192 * @param {number} x The x. | 192 * @param {number} x The x. |
193 * @param {number} y The y. | 193 * @param {number} y The y. |
194 * @param {number} time The time in milisecond. | 194 * @param {number} time The time in miliseconds. |
195 * @constructor | 195 * @constructor |
196 */ | 196 */ |
197 i18n.input.hwt.StrokeHandler.Point = function(x, y, time) { | 197 i18n.input.hwt.StrokeHandler.Point = function(x, y, time) { |
198 /** | 198 /** |
199 * The left offset relative to the canvas. | 199 * The left offset relative to the canvas, rounded to 2 decimal places. |
200 * | 200 * |
201 * @type {number} | 201 * @type {number} |
202 */ | 202 */ |
203 this.x = x; | 203 this.x = Math.round(x * 100.0) * 0.01; |
204 | 204 |
205 /** | 205 /** |
206 * The top offset relative to the canvas. | 206 * The top offset relative to the canvas, rounded to 2 decimal places. |
207 * | 207 * |
208 * @type {number} | 208 * @type {number} |
209 */ | 209 */ |
210 this.y = y; | 210 this.y = Math.round(y * 100.0) * 0.01; |
211 | 211 |
212 /** | 212 /** |
213 * The time. | 213 * The time, rounded to the nearest millisecond. |
214 * | 214 * |
215 * @type {number} | 215 * @type {number} |
216 */ | 216 */ |
217 this.time = time; | 217 this.time = Math.round(time); |
218 }; | 218 }; |
219 | 219 |
220 | 220 |
221 /** | 221 /** |
222 * Stroke events. | 222 * Stroke events. |
223 * | 223 * |
224 * @enum {string} | 224 * @enum {string} |
225 */ | 225 */ |
226 i18n.input.hwt.StrokeHandler.EventType = { | 226 i18n.input.hwt.StrokeHandler.EventType = { |
227 STROKE: goog.events.getUniqueId('s'), | 227 STROKE: goog.events.getUniqueId('s'), |
(...skipping 15 matching lines...) Expand all Loading... |
243 goog.base(this, type); | 243 goog.base(this, type); |
244 | 244 |
245 /** | 245 /** |
246 * The point. | 246 * The point. |
247 * | 247 * |
248 * @type {!i18n.input.hwt.StrokeHandler.Point} | 248 * @type {!i18n.input.hwt.StrokeHandler.Point} |
249 */ | 249 */ |
250 this.point = point; | 250 this.point = point; |
251 }; | 251 }; |
252 goog.inherits(i18n.input.hwt.StrokeHandler.StrokeEvent, goog.events.Event); | 252 goog.inherits(i18n.input.hwt.StrokeHandler.StrokeEvent, goog.events.Event); |
OLD | NEW |