mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
window size alert
This commit is contained in:
parent
8bd5fb3196
commit
9b77632faf
4 changed files with 2315 additions and 3329 deletions
5567
build/bundle.js
5567
build/bundle.js
File diff suppressed because it is too large
Load diff
|
@ -63,6 +63,11 @@ var init = function() {
|
|||
events.trigger('resize', e);
|
||||
});
|
||||
|
||||
$(window).on('windowSizeCheck', _.throttle(function(e) {
|
||||
var width = $(window).width();
|
||||
var height = $(window).height();
|
||||
eventBaton.trigger('windowSizeCheck', {w: width, h: height});
|
||||
}, 500));
|
||||
eventBaton.stealBaton('docKeydown', function() { });
|
||||
eventBaton.stealBaton('docKeyup', function() { });
|
||||
|
||||
|
@ -78,6 +83,13 @@ var init = function() {
|
|||
var view = new Views.ZoomAlertWindow();
|
||||
}
|
||||
});
|
||||
eventBaton.stealBaton('windowSizeCheck', function(size) {
|
||||
if (size.w < Constants.VIEWPORT.minWidth ||
|
||||
size.h < Constants.VIEWPORT.minHeight) {
|
||||
var Views = require('../views');
|
||||
var view = new Views.WindowSizeAlertWindow();
|
||||
}
|
||||
});
|
||||
|
||||
// the default action on window focus and document click is to just focus the text area
|
||||
eventBaton.stealBaton('windowFocus', focusTextArea);
|
||||
|
|
|
@ -21,3 +21,4 @@ exports.splitTextCommand = function(value, func, context) {
|
|||
func(command);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var GitError = require('../util/errors').GitError;
|
||||
qvar GitError = require('../util/errors').GitError;
|
||||
var _ = require('underscore');
|
||||
var Q = require('q');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
|
@ -394,34 +394,21 @@ var NextLevelConfirm = ConfirmCancelTerminal.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var ZoomAlertWindow = Backbone.View.extend({
|
||||
var ViewportAlert = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.grabBatons();
|
||||
this.modalAlert = new ModalAlert({
|
||||
markdowns: [
|
||||
'## That zoom level is not supported :-/',
|
||||
'Please zoom back to a supported zoom level with Ctrl + and Ctrl -',
|
||||
'',
|
||||
'(and of course, pull requests to fix this are appreciated :D)'
|
||||
]
|
||||
markdowns: this.markdowns
|
||||
});
|
||||
|
||||
this.modalAlert.show();
|
||||
},
|
||||
|
||||
grabBatons: function() {
|
||||
Main.getEventBaton().stealBaton('zoomChange', this.zoomChange, this);
|
||||
Main.getEventBaton().stealBaton(this.eventBatonName, this.batonFired, this);
|
||||
},
|
||||
|
||||
releaseBatons: function() {
|
||||
Main.getEventBaton().releaseBaton('zoomChange', this.zoomChange, this);
|
||||
},
|
||||
|
||||
zoomChange: function(level) {
|
||||
if (level <= Constants.VIEWPORT.maxZoom &&
|
||||
level >= Constants.VIEWPORT.minZoom) {
|
||||
this.finish();
|
||||
}
|
||||
Main.getEventBaton().releaseBaton(this.eventBatonName, this.batonFired, this);
|
||||
},
|
||||
|
||||
finish: function() {
|
||||
|
@ -430,6 +417,46 @@ var ZoomAlertWindow = Backbone.View.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var WindowSizeAlertWindow = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.eventBatonName = 'windowSizeCheck';
|
||||
this.markdowns = [
|
||||
'## That window size is not supported :-/',
|
||||
'Please resize your window back to a supported size',
|
||||
'',
|
||||
'(and of course, pull requests to fix this are appreciated :D)'
|
||||
]
|
||||
ZoomAlertWindow.__super__.initialize.apply(this, [options]);
|
||||
},
|
||||
|
||||
batonFired: function(size) {
|
||||
if (size.w < Constants.VIEWPORT.minWidth ||
|
||||
size.h < Constants.VIEWPORT.minHeight) {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var ZoomAlertWindow = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.eventBatonName = 'zoomChange';
|
||||
this.markdowns = [
|
||||
'## That zoom level is not supported :-/',
|
||||
'Please zoom back to a supported zoom level with Ctrl + and Ctrl -',
|
||||
'',
|
||||
'(and of course, pull requests to fix this are appreciated :D)'
|
||||
]
|
||||
ZoomAlertWindow.__super__.initialize.apply(this, [options]);
|
||||
},
|
||||
|
||||
batonFired: function(level) {
|
||||
if (level <= Constants.VIEWPORT.maxZoom &&
|
||||
level >= Constants.VIEWPORT.minZoom) {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var LevelToolbar = BaseView.extend({
|
||||
tagName: 'div',
|
||||
className: 'levelToolbarHolder',
|
||||
|
@ -532,6 +559,7 @@ exports.ConfirmCancelView = ConfirmCancelView;
|
|||
exports.LeftRightView = LeftRightView;
|
||||
exports.ZoomAlertWindow = ZoomAlertWindow;
|
||||
exports.ConfirmCancelTerminal = ConfirmCancelTerminal;
|
||||
exports.WindowSizeAlertWindow = WindowSizeAlertWindow;
|
||||
|
||||
exports.CanvasTerminalHolder = CanvasTerminalHolder;
|
||||
exports.LevelToolbar = LevelToolbar;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue