Permalink
Browse files

get rid of false to stop propogation

  • Loading branch information...
1 parent 8ddf1af commit 25be488d18d8fef06cdbcd98f16fd68226b9d9a2 @maccman committed Apr 17, 2012
@@ -84,7 +84,6 @@ class List extends Spine.Controller
@current = @backgrounds[$(e.currentTarget).index()]
@trigger 'change', @current
@render()
- false
plus: ->
@current = new Background.LinearGradient(
@@ -96,13 +95,11 @@ class List extends Spine.Controller
)
@backgrounds.push(@current)
@trigger 'change', @current
- false
minus: ->
@backgrounds.remove(@current)
@current = @backgrounds.first()
@trigger 'change', @current
- false
class BackgroundInspector extends Spine.Controller
className: 'background'
@@ -96,18 +96,15 @@ class BoxShadowList extends Spine.Controller
@current = @shadows[$(e.currentTarget).index()]
@trigger 'change', @current
@render()
- false
addShadow: ->
@shadows.push(@current = new Shadow(blur: 3))
@trigger 'change', @current
- false
removeShadow: ->
@shadows.remove(@current)
@current = @shadows.first()
@trigger 'change', @current
- false
class BoxShadow extends Spine.Controller
className: 'boxShadow'
@@ -25,7 +25,7 @@ class Font extends Spine.Controller
render: =>
@disabled = not @stage.selection.isAny()
@$color.val(@stage.selection.get('color') or new Color.Black)
- @$size.val(@stage.selection.get('fontSize'))
+ @$size.val(@stage.selection.get('fontSize') ? 12)
@$family.val(@stage.selection.get('fontFamily'))
change: (e) ->
@@ -57,6 +57,8 @@ class Clipboard
pasteInternal: (e) ->
return unless @data
+ e?.preventDefault()
+
@stage.history.record()
@stage.add(el) for el in @data
@stage.selection.refresh(@data)
@@ -65,9 +67,6 @@ class Clipboard
# Re-clone the elements
@copyInternal()
- # Cancel event propogation
- false
-
release: ->
$(window).unbind 'beforecopy', @cancel
$(window).unbind 'copy', @copy
@@ -92,11 +92,11 @@ class KeyBindings extends Spine.Module
cKey: (e) ->
return unless e.metaKey
- @stage.clipboard.copyInternal()
+ @stage.clipboard.copyInternal(e)
vKey: (e) ->
return unless e.metaKey
- @stage.clipboard.pasteInternal()
+ @stage.clipboard.pasteInternal(e)
zKey: (e) ->
return unless e.metaKey
@@ -46,7 +46,6 @@ class SelectArea extends Spine.Controller
$(document).mousemove(@drag)
$(document).mouseup(@drop)
- true
drag: (e) =>
# We offset by 1, so it doesn't
@@ -71,13 +70,11 @@ class SelectArea extends Spine.Controller
@stage.selection.add(element)
else
@stage.selection.remove(element)
- true
drop: (e) =>
@selectArea?.release()
@selectArea = null
$(document).unbind('mousemove', @drag)
$(document).unbind('mouseup', @drop)
- true
module.exports = SelectArea
@@ -200,22 +200,19 @@ this.require.define({"app/controllers/inspector/background":function(exports, re
List.prototype.click = function(e) {
this.current = this.backgrounds[$(e.currentTarget).index()];
this.trigger('change', this.current);
- this.render();
- return false;
+ return this.render();
};
List.prototype.plus = function() {
this.current = new Background.LinearGradient(new Background.Position(0), [new Background.ColorStop(new Color.Black, 0), new Background.ColorStop(new Color.White, 100)]);
this.backgrounds.push(this.current);
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
List.prototype.minus = function() {
this.backgrounds.remove(this.current);
this.current = this.backgrounds.first();
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
return List;
@@ -196,23 +196,20 @@ this.require.define({"app/controllers/inspector/box_shadow":function(exports, re
BoxShadowList.prototype.click = function(e) {
this.current = this.shadows[$(e.currentTarget).index()];
this.trigger('change', this.current);
- this.render();
- return false;
+ return this.render();
};
BoxShadowList.prototype.addShadow = function() {
this.shadows.push(this.current = new Shadow({
blur: 3
}));
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
BoxShadowList.prototype.removeShadow = function() {
this.shadows.remove(this.current);
this.current = this.shadows.first();
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
return BoxShadowList;
@@ -101,9 +101,10 @@ this.require.define({"app/controllers/inspector/font":function(exports, require,
}
Font.prototype.render = function() {
+ var _ref;
this.disabled = !this.stage.selection.isAny();
this.$color.val(this.stage.selection.get('color') || new Color.Black);
- this.$size.val(this.stage.selection.get('fontSize'));
+ this.$size.val((_ref = this.stage.selection.get('fontSize')) != null ? _ref : 12);
return this.$family.val(this.stage.selection.get('fontFamily'));
};
@@ -157,6 +157,9 @@ this.require.define({"app/controllers/stage/clipboard":function(exports, require
if (!this.data) {
return;
}
+ if (e != null) {
+ e.preventDefault();
+ }
this.stage.history.record();
_ref = this.data;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -168,8 +171,7 @@ this.require.define({"app/controllers/stage/clipboard":function(exports, require
left: 10,
top: 10
});
- this.copyInternal();
- return false;
+ return this.copyInternal();
};
Clipboard.prototype.release = function() {
@@ -224,14 +224,14 @@ this.require.define({"app/controllers/stage/key_bindings":function(exports, requ
if (!e.metaKey) {
return;
}
- return this.stage.clipboard.copyInternal();
+ return this.stage.clipboard.copyInternal(e);
};
KeyBindings.prototype.vKey = function(e) {
if (!e.metaKey) {
return;
}
- return this.stage.clipboard.pasteInternal();
+ return this.stage.clipboard.pasteInternal(e);
};
KeyBindings.prototype.zKey = function(e) {
@@ -146,28 +146,28 @@ this.require.define({"app/controllers/stage/select_area":function(exports, requi
_ref.release();
}
$(document).mousemove(this.drag);
- $(document).mouseup(this.drop);
- return true;
+ return $(document).mouseup(this.drop);
};
SelectArea.prototype.drag = function(e) {
- var area, element, _i, _len, _ref;
+ var area, element, _i, _len, _ref, _results;
if (!this.selectArea) {
this.selectArea = new Area(e.pageX - this.offset.left + 1, e.pageY - this.offset.top + 1);
this.append(this.selectArea);
}
this.selectArea.resize(e.pageX - this.offset.left, e.pageY - this.offset.top);
area = this.selectArea.area();
_ref = this.stage.elements;
+ _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
element = _ref[_i];
if (element.inArea(area)) {
- this.stage.selection.add(element);
+ _results.push(this.stage.selection.add(element));
} else {
- this.stage.selection.remove(element);
+ _results.push(this.stage.selection.remove(element));
}
}
- return true;
+ return _results;
};
SelectArea.prototype.drop = function(e) {
@@ -177,8 +177,7 @@ this.require.define({"app/controllers/stage/select_area":function(exports, requi
}
this.selectArea = null;
$(document).unbind('mousemove', this.drag);
- $(document).unbind('mouseup', this.drop);
- return true;
+ return $(document).unbind('mouseup', this.drop);
};
return SelectArea;
@@ -13654,22 +13654,19 @@ this.require.define({"app/controllers/inspector/background":function(exports, re
List.prototype.click = function(e) {
this.current = this.backgrounds[$(e.currentTarget).index()];
this.trigger('change', this.current);
- this.render();
- return false;
+ return this.render();
};
List.prototype.plus = function() {
this.current = new Background.LinearGradient(new Background.Position(0), [new Background.ColorStop(new Color.Black, 0), new Background.ColorStop(new Color.White, 100)]);
this.backgrounds.push(this.current);
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
List.prototype.minus = function() {
this.backgrounds.remove(this.current);
this.current = this.backgrounds.first();
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
return List;
@@ -14091,23 +14088,20 @@ this.require.define({"app/controllers/inspector/box_shadow":function(exports, re
BoxShadowList.prototype.click = function(e) {
this.current = this.shadows[$(e.currentTarget).index()];
this.trigger('change', this.current);
- this.render();
- return false;
+ return this.render();
};
BoxShadowList.prototype.addShadow = function() {
this.shadows.push(this.current = new Shadow({
blur: 3
}));
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
BoxShadowList.prototype.removeShadow = function() {
this.shadows.remove(this.current);
this.current = this.shadows.first();
- this.trigger('change', this.current);
- return false;
+ return this.trigger('change', this.current);
};
return BoxShadowList;
@@ -14310,9 +14304,10 @@ this.require.define({"app/controllers/inspector/font":function(exports, require,
}
Font.prototype.render = function() {
+ var _ref;
this.disabled = !this.stage.selection.isAny();
this.$color.val(this.stage.selection.get('color') || new Color.Black);
- this.$size.val(this.stage.selection.get('fontSize'));
+ this.$size.val((_ref = this.stage.selection.get('fontSize')) != null ? _ref : 12);
return this.$family.val(this.stage.selection.get('fontFamily'));
};
@@ -15028,6 +15023,9 @@ this.require.define({"app/controllers/stage/clipboard":function(exports, require
if (!this.data) {
return;
}
+ if (e != null) {
+ e.preventDefault();
+ }
this.stage.history.record();
_ref = this.data;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -15039,8 +15037,7 @@ this.require.define({"app/controllers/stage/clipboard":function(exports, require
left: 10,
top: 10
});
- this.copyInternal();
- return false;
+ return this.copyInternal();
};
Clipboard.prototype.release = function() {
@@ -15630,14 +15627,14 @@ this.require.define({"app/controllers/stage/key_bindings":function(exports, requ
if (!e.metaKey) {
return;
}
- return this.stage.clipboard.copyInternal();
+ return this.stage.clipboard.copyInternal(e);
};
KeyBindings.prototype.vKey = function(e) {
if (!e.metaKey) {
return;
}
- return this.stage.clipboard.pasteInternal();
+ return this.stage.clipboard.pasteInternal(e);
};
KeyBindings.prototype.zKey = function(e) {
@@ -15836,28 +15833,28 @@ this.require.define({"app/controllers/stage/select_area":function(exports, requi
_ref.release();
}
$(document).mousemove(this.drag);
- $(document).mouseup(this.drop);
- return true;
+ return $(document).mouseup(this.drop);
};
SelectArea.prototype.drag = function(e) {
- var area, element, _i, _len, _ref;
+ var area, element, _i, _len, _ref, _results;
if (!this.selectArea) {
this.selectArea = new Area(e.pageX - this.offset.left + 1, e.pageY - this.offset.top + 1);
this.append(this.selectArea);
}
this.selectArea.resize(e.pageX - this.offset.left, e.pageY - this.offset.top);
area = this.selectArea.area();
_ref = this.stage.elements;
+ _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
element = _ref[_i];
if (element.inArea(area)) {
- this.stage.selection.add(element);
+ _results.push(this.stage.selection.add(element));
} else {
- this.stage.selection.remove(element);
+ _results.push(this.stage.selection.remove(element));
}
}
- return true;
+ return _results;
};
SelectArea.prototype.drop = function(e) {
@@ -15867,8 +15864,7 @@ this.require.define({"app/controllers/stage/select_area":function(exports, requi
}
this.selectArea = null;
$(document).unbind('mousemove', this.drag);
- $(document).unbind('mouseup', this.drop);
- return true;
+ return $(document).unbind('mouseup', this.drop);
};
return SelectArea;

0 comments on commit 25be488

Please sign in to comment.