1 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
2 //>>description: Tizen core library
6 define( [ 'jquery.mobile.core' ], function ( ) {
7 //>>excludeEnd("jqmBuildExclude");
9 /* ***************************************************************************
12 Version 1.0, May, 2012
14 http://floralicense.org/license/
16 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
20 "License" shall mean the terms and conditions for use, reproduction,
21 and distribution as defined by Sections 1 through 9 of this document.
23 "Licensor" shall mean the copyright owner or entity authorized by
24 the copyright owner that is granting the License.
26 "Legal Entity" shall mean the union of the acting entity and
27 all other entities that control, are controlled by, or are
28 under common control with that entity. For the purposes of
29 this definition, "control" means (i) the power, direct or indirect,
30 to cause the direction or management of such entity,
31 whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
32 or more of the outstanding shares, or (iii) beneficial ownership of
35 "You" (or "Your") shall mean an individual or Legal Entity
36 exercising permissions granted by this License.
38 "Source" form shall mean the preferred form for making modifications,
39 including but not limited to software source code, documentation source,
40 and configuration files.
42 "Object" form shall mean any form resulting from mechanical
43 transformation or translation of a Source form, including but
44 not limited to compiled object code, generated documentation,
45 and conversions to other media types.
47 "Work" shall mean the work of authorship, whether in Source or Object form,
48 made available under the License, as indicated by a copyright notice
49 that is included in or attached to the work (an example is provided
50 in the Appendix below).
52 "Derivative Works" shall mean any work, whether in Source or Object form,
53 that is based on (or derived from) the Work and for which the editorial
54 revisions, annotations, elaborations, or other modifications represent,
55 as a whole, an original work of authorship. For the purposes of this License,
56 Derivative Works shall not include works that remain separable from,
57 or merely link (or bind by name) to the interfaces of, the Work and
58 Derivative Works thereof.
60 "Contribution" shall mean any work of authorship, including the original
61 version of the Work and any modifications or additions to that Work or
62 Derivative Works thereof, that is intentionally submitted to Licensor
63 for inclusion in the Work by the copyright owner or by an individual or
64 Legal Entity authorized to submit on behalf of the copyright owner.
65 For the purposes of this definition, "submitted" means any form of
66 electronic, verbal, or written communication sent to the Licensor or
67 its representatives, including but not limited to communication on
68 electronic mailing lists, source code control systems, and issue
69 tracking systems that are managed by, or on behalf of, the Licensor
70 for the purpose of discussing and improving the Work, but excluding
71 communication that is conspicuously marked or otherwise designated
72 in writing by the copyright owner as "Not a Contribution."
74 "Contributor" shall mean Licensor and any individual or Legal Entity
75 on behalf of whom a Contribution has been received by Licensor and
76 subsequently incorporated within the Work.
78 "Tizen Certified Platform" shall mean a software platform that complies
79 with the standards set forth in the Compatibility Definition Document
80 and passes the Compatibility Test Suite as defined from time to time
81 by the Tizen Technical Steering Group and certified by the Tizen
82 Association or its designated agent.
84 2. Grant of Copyright License. Subject to the terms and conditions of
85 this License, each Contributor hereby grants to You a perpetual,
86 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
87 copyright license to reproduce, prepare Derivative Works of,
88 publicly display, publicly perform, sublicense, and distribute the
89 Work and such Derivative Works in Source or Object form.
91 3. Grant of Patent License. Subject to the terms and conditions of
92 this License, each Contributor hereby grants to You a perpetual,
93 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
94 (except as stated in this section) patent license to make, have made,
95 use, offer to sell, sell, import, and otherwise transfer the Work
96 solely as incorporated into a Tizen Certified Platform, where such
97 license applies only to those patent claims licensable by such
98 Contributor that are necessarily infringed by their Contribution(s)
99 alone or by combination of their Contribution(s) with the Work solely
100 as incorporated into a Tizen Certified Platform to which such
101 Contribution(s) was submitted. If You institute patent litigation
102 against any entity (including a cross-claim or counterclaim
103 in a lawsuit) alleging that the Work or a Contribution incorporated
104 within the Work constitutes direct or contributory patent infringement,
105 then any patent licenses granted to You under this License for that
106 Work shall terminate as of the date such litigation is filed.
108 4. Redistribution. You may reproduce and distribute copies of the
109 Work or Derivative Works thereof pursuant to the copyright license
110 above, in any medium, with or without modifications, and in Source or
111 Object form, provided that You meet the following conditions:
113 1. You must give any other recipients of the Work or Derivative Works
114 a copy of this License; and
115 2. You must cause any modified files to carry prominent notices stating
116 that You changed the files; and
117 3. You must retain, in the Source form of any Derivative Works that
118 You distribute, all copyright, patent, trademark, and attribution
119 notices from the Source form of the Work, excluding those notices
120 that do not pertain to any part of the Derivative Works; and
121 4. If the Work includes a "NOTICE" text file as part of its distribution,
122 then any Derivative Works that You distribute must include a readable
123 copy of the attribution notices contained within such NOTICE file,
124 excluding those notices that do not pertain to any part of
125 the Derivative Works, in at least one of the following places:
126 within a NOTICE text file distributed as part of the Derivative Works;
127 within the Source form or documentation, if provided along with the
128 Derivative Works; or, within a display generated by the Derivative Works,
129 if and wherever such third-party notices normally appear.
130 The contents of the NOTICE file are for informational purposes only
131 and do not modify the License.
133 You may add Your own attribution notices within Derivative Works
134 that You distribute, alongside or as an addendum to the NOTICE text
135 from the Work, provided that such additional attribution notices
136 cannot be construed as modifying the License. You may add Your own
137 copyright statement to Your modifications and may provide additional or
138 different license terms and conditions for use, reproduction, or
139 distribution of Your modifications, or for any such Derivative Works
140 as a whole, provided Your use, reproduction, and distribution of
141 the Work otherwise complies with the conditions stated in this License.
143 5. Submission of Contributions. Unless You explicitly state otherwise,
144 any Contribution intentionally submitted for inclusion in the Work
145 by You to the Licensor shall be under the terms and conditions of
146 this License, without any additional terms or conditions.
147 Notwithstanding the above, nothing herein shall supersede or modify
148 the terms of any separate license agreement you may have executed
149 with Licensor regarding such Contributions.
151 6. Trademarks. This License does not grant permission to use the trade
152 names, trademarks, service marks, or product names of the Licensor,
153 except as required for reasonable and customary use in describing the
154 origin of the Work and reproducing the content of the NOTICE file.
156 7. Disclaimer of Warranty. Unless required by applicable law or
157 agreed to in writing, Licensor provides the Work (and each
158 Contributor provides its Contributions) on an "AS IS" BASIS,
159 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160 implied, including, without limitation, any warranties or conditions
161 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162 PARTICULAR PURPOSE. You are solely responsible for determining the
163 appropriateness of using or redistributing the Work and assume any
164 risks associated with Your exercise of permissions under this License.
166 8. Limitation of Liability. In no event and under no legal theory,
167 whether in tort (including negligence), contract, or otherwise,
168 unless required by applicable law (such as deliberate and grossly
169 negligent acts) or agreed to in writing, shall any Contributor be
170 liable to You for damages, including any direct, indirect, special,
171 incidental, or consequential damages of any character arising as a
172 result of this License or out of the use or inability to use the
173 Work (including but not limited to damages for loss of goodwill,
174 work stoppage, computer failure or malfunction, or any and all
175 other commercial damages or losses), even if such Contributor
176 has been advised of the possibility of such damages.
178 9. Accepting Warranty or Additional Liability. While redistributing
179 the Work or Derivative Works thereof, You may choose to offer,
180 and charge a fee for, acceptance of support, warranty, indemnity,
181 or other liability obligations and/or rights consistent with this
182 License. However, in accepting such obligations, You may act only
183 on Your own behalf and on Your sole responsibility, not on behalf
184 of any other Contributor, and only if You agree to indemnify,
185 defend, and hold each Contributor harmless for any liability
186 incurred by, or claims asserted against, such Contributor by reason
187 of your accepting any such warranty or additional liability.
189 END OF TERMS AND CONDITIONS
191 APPENDIX: How to apply the Flora License to your work
193 To apply the Flora License to your work, attach the following
194 boilerplate notice, with the fields enclosed by brackets "[]"
195 replaced with your own identifying information. (Don't include
196 the brackets!) The text should be enclosed in the appropriate
197 comment syntax for the file format. We also recommend that a
198 file or class name and description of purpose be included on the
199 same "printed page" as the copyright notice for easier
200 identification within third-party archives.
202 Copyright [yyyy] [name of copyright owner]
204 Licensed under the Flora License, Version 1.0 (the "License");
205 you may not use this file except in compliance with the License.
206 You may obtain a copy of the License at
208 http://www.tizenopensource.org/license
210 Unless required by applicable law or agreed to in writing, software
211 distributed under the License is distributed on an "AS IS" BASIS,
212 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213 See the License for the specific language governing permissions and
214 limitations under the License.
216 * Author: Minkyu Kang <mk7.kang@samsung.com>
223 * pinchstart: triggered when start the touched two points
224 * pinch: triggered when move the touch point after pinchstart event occured
225 * pinchend: triggered when touchend event after pinchstart event occured
228 * point: touched points
229 * ratio: origin point-to-current point ratio for moving distance
231 * $("#pinch").bind("pinch", function (e, p) {
232 * console.log("point[0].x: " + p.point[0].x);
233 * console.log("point[0].y: " + p.point[0].y);
234 * console.log("point[1].x: " + p.point[1].x);
235 * console.log("point[1].y: " + p.point[1].y);
236 * console.log("ratio: " + p.ratio);
240 * $.mobile.pinch.enabled: true or false
241 * $.mobile.pinch.min: minimum value of ratio
242 * $.mobile.pinch.max: maximum value of ratio
243 * $.mobile.pinch.factor: scale factor of ratio
244 * $.mobile.pinch.threshold: move threshold of ratio
245 * $.mobile.pinch.interval: interval for pinch event
248 ( function( $, window, undefined ) {
252 var thisObject = this,
253 $this = $( thisObject );
255 if ( !$.mobile.support.touch ) {
259 function getDistance( point ) {
260 var x = point[0].x - point[1].x,
261 y = point[0].y - point[0].y;
263 return Math.sqrt( ( x * x ) + ( y * y ) );
266 function getParameter( point, ratio ) {
267 return { point: point, ratio: ratio };
270 $this.bind( "touchstart", function ( event ) {
271 var data = event.originalEvent.touches,
276 if ( !$.mobile.pinch.enabled ) {
280 if ( data.length != 2 ) {
285 { x: data[0].pageX, y: data[0].pageY },
286 { x: data[1].pageX, y: data[1].pageY }
289 $( event.target ).trigger( "pinchstart", getParameter( origin, undefined ) );
291 function pinchHandler( event ) {
292 var data = event.originalEvent.touches,
296 factor = $( window ).width() / $.mobile.pinch.factor;
307 { x: data[0].pageX, y: data[0].pageY },
308 { x: data[1].pageX, y: data[1].pageY }
311 delta = getDistance( current ) - getDistance( origin );
313 ratio = 1 + delta / factor;
315 if ( ratio < $.mobile.pinch.min ) {
316 ratio = $.mobile.pinch.min;
317 } else if ( ratio > $.mobile.pinch.max ) {
318 ratio = $.mobile.pinch.max;
321 if ( Math.abs( ratio - last_ratio ) < $.mobile.pinch.threshold ) {
325 $( event.target ).trigger( "pinch", getParameter( current, ratio ) );
329 if ( $.mobile.pinch.interval ) {
332 setTimeout( function () {
334 }, $.mobile.pinch.interval );
338 $this.bind( "touchmove", pinchHandler )
339 .one( "touchend", function ( event ) {
340 $this.unbind( "touchmove", pinchHandler );
341 $( event.target ).trigger( "pinchend",
342 getParameter( undefined, last_ratio ) );
353 $.event.special["pinch"] = pinch_event;
366 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
368 //>>excludeEnd("jqmBuildExclude");