Skip to content

Commit

Permalink
Merge c3dedb4 into 93c03ea
Browse files Browse the repository at this point in the history
  • Loading branch information
marclaval committed Aug 21, 2014
2 parents 93c03ea + c3dedb4 commit b920b2a
Show file tree
Hide file tree
Showing 33 changed files with 976 additions and 318 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/node_modules
/dist
/sauce_connect.log
/npm-debug.log
/sc.log
/test-results
/tmp
Expand Down
5 changes: 4 additions & 1 deletion build/grunt/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ module.exports = function(grunt) {
hspRoot = grunt.config('hspserver.base')+"/hsp",
emptyJsResponse = function(req, res) { res.set('Content-Type', 'application/x-javascript'); return res.send(""); },
compilerPath = '/dist/' + VERSION + '/hashspace-noder-compiler.min.js',
runtimePath = '/dist/' + VERSION + '/hashspace-noder.min.js';
runtimePath = '/dist/' + VERSION + '/hashspace-noder.min.js',
gesturesPath = '/dist/' + VERSION + '/hashspace-noder-gestures.min.js';

grunt.log.subhead('Local website setup');
grunt.log.writeln('Starting local documentation web server...');
Expand All @@ -287,6 +288,8 @@ module.exports = function(grunt) {
grunt.verbose.ok(compilerPath, 'polyfilled to be empty');
app.get(runtimePath, emptyJsResponse);
grunt.verbose.ok(runtimePath, 'polyfilled to be empty');
app.get(gesturesPath, emptyJsResponse);
grunt.verbose.ok(gesturesPath, 'polyfilled to be empty');

// Proxying /test and /node_modules folders
app.use('/test', function(req, res, next) {
Expand Down
1 change: 1 addition & 0 deletions docs/playground/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ footerscripts: |
}
</script>
<script src="/dist/<%=version%>/hashspace-noder.min.js" type="text/javascript"></script>
<script src="/dist/<%=version%>/hashspace-noder-gestures.min.js" type="text/javascript"></script>
<script src="/playground/playground-samples-all.js" type="text/javascript"></script>
<script src="/playground/playground-all.js" type="text/javascript"></script>
<script type="noder">
Expand Down
2 changes: 2 additions & 0 deletions docs/samples/gestures/gestures.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('hsp/gestures/index').register();

{template gestures(msgList)}
<div class="touchboard" style="height:200px; background: #27AAFC;text-align:center;"
ontap="{addMsg(event)}" ontapstart="{addMsg(event)}" ontapcancel="{addMsg(event)}"
Expand Down
26 changes: 19 additions & 7 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ module.exports = function (grunt) {
cwd: "hsp/rt",
src: ['*.js'],
dest: 'hsp/rt'
},
{
cwd: "hsp/gestures",
src: ['*.js'],
dest: 'hsp/gestures'
}
]
}
Expand All @@ -268,15 +263,29 @@ module.exports = function (grunt) {
}
]
}
},
gestures: {
files: [{dest: 'dist/hashspace-browserify-gestures.js', src: ['hsp/gestures/index.js']}],
options: {
aliasMappings: [
{
cwd: "hsp/gestures",
src: ['*.js'],
dest: 'hsp/gestures'
}
]
}
}
},
uglify: {
hsp: {
files: [
{dest: 'dist/hashspace-browserify.min.js', src: ['dist/hashspace-browserify.js']},
{dest: 'dist/hashspace-browserify-compiler.min.js', src: ['dist/hashspace-browserify-compiler.js']},
{dest: 'dist/hashspace-browserify-gestures.min.js', src: ['dist/hashspace-browserify-gestures.js']},
{dest: 'dist/hashspace-noder.min.js', src: ['dist/hashspace-noder.js']},
{dest: 'dist/hashspace-noder-compiler.min.js', src: ['dist/hashspace-noder-compiler.js']}
{dest: 'dist/hashspace-noder-compiler.min.js', src: ['dist/hashspace-noder-compiler.js']},
{dest: 'dist/hashspace-noder-gestures.min.js', src: ['dist/hashspace-noder-gestures.js']}
]
}
},
Expand Down Expand Up @@ -342,10 +351,13 @@ module.exports = function (grunt) {
},
packages : [{
name : "hashspace-noder.js",
files : ['hsp/*.js', 'hsp/rt/*.js', 'hsp/gestures/*.js']
files : ['hsp/*.js', 'hsp/rt/*.js']
}, {
name : "hashspace-noder-compiler.js",
files : ['hsp/compiler/compile.js','hsp/transpiler/transpile.js']
}, {
name : "hashspace-noder-gestures.js",
files : ['hsp/gestures/*.js']
}]
}
}
Expand Down
20 changes: 19 additions & 1 deletion hsp/gestures/doubleTap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var hsp = require("../rt");
var klass = require("../klass");
var touchEvent = require("./touchEvent");
var Gesture = require("./gesture").Gesture;
Expand Down Expand Up @@ -158,4 +174,6 @@ var DoubleTap = klass({

});

module.exports.DoubleTap = DoubleTap;
module.exports.register = function() {
hsp.registerCustomAttributes(["ondoubletap", "ondoubletapstart", "ondoubletapcancel"], DoubleTap);
};
20 changes: 19 additions & 1 deletion hsp/gestures/drag.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var hsp = require("../rt");
var klass = require("../klass");
var touchEvent = require("./touchEvent");
var Gesture = require("./gesture").Gesture;
Expand Down Expand Up @@ -112,4 +128,6 @@ var Drag = klass({

});

module.exports.Drag = Drag;
module.exports.register = function() {
hsp.registerCustomAttributes(["ondrag", "ondragstart", "ondragmove", "ondragcancel"], Drag);
};
18 changes: 10 additions & 8 deletions hsp/gestures/gesture.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 Amadeus s.a.s.
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -25,18 +25,18 @@ var Gesture = klass({
/**
* Constructor.
*/
$constructor : function (target, evthandler) {
$constructor : function (nodeInstance, callback) {
/**
* Reference to the target
* @type HTMLElement
*/
this.target = target;
this.target = nodeInstance.node;

/**
* Reference to the event handler
* @type HTMLElement
* @type Function
*/
this.evthandler = evthandler;
this.callback = callback;

/**
* Event map uses ./touchEvent for touch event detection.
Expand Down Expand Up @@ -70,7 +70,9 @@ var Gesture = klass({
},

$dispose: function() {
this._disconnectTouchEvents();
if (this.callbackMap) {
this._disconnectTouchEvents();
}
this.callbackMap = null;
},

Expand Down Expand Up @@ -331,7 +333,7 @@ var Gesture = klass({
extraData.currentX = position[0].x;
extraData.currentY = position[0].y;
fakeEvent.detail = extraData;
this.evthandler.handleEvent(fakeEvent);
this.callback(fakeEvent);
event.cancelBubble = fakeEvent.hasStopPropagation;
event.returnValue = !fakeEvent.hasPreventDefault;
return event.returnValue;
Expand Down Expand Up @@ -364,4 +366,4 @@ var Gesture = klass({
}
});

module.exports.Gesture = Gesture;
module.exports.Gesture = Gesture;
105 changes: 0 additions & 105 deletions hsp/gestures/gestures.js

This file was deleted.

32 changes: 32 additions & 0 deletions hsp/gestures/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var doubleTap = require("./doubleTap");
var drag = require("./drag");
var longPress = require("./longPress");
var pinch = require("./pinch");
var singleTap = require("./singleTap");
var swipe = require("./swipe");
var tap = require("./tap");

module.exports.register = function() {
doubleTap.register();
drag.register();
longPress.register();
pinch.register();
singleTap.register();
swipe.register();
tap.register();
};
20 changes: 19 additions & 1 deletion hsp/gestures/longPress.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var hsp = require("../rt");
var klass = require("../klass");
var touchEvent = require("./touchEvent");
var Gesture = require("./gesture").Gesture;
Expand Down Expand Up @@ -126,4 +142,6 @@ var LongPress = klass({

});

module.exports.LongPress = LongPress;
module.exports.register = function() {
hsp.registerCustomAttributes(["onlongpress", "onlongpressstart", "onlongpresscancel"], LongPress);
};

0 comments on commit b920b2a

Please sign in to comment.