243 |
243 |
244 if (Screenfull.enabled){ |
244 if (Screenfull.enabled){ |
245 bindClick(".Rk-FullScreen-Button", "fullScreen"); |
245 bindClick(".Rk-FullScreen-Button", "fullScreen"); |
246 |
246 |
247 document.addEventListener(Screenfull.raw.fullscreenchange, function () { |
247 document.addEventListener(Screenfull.raw.fullscreenchange, function () { |
248 var widthAft = _this.$.width(); |
248 //the listener occur too randomly and sometimes before the fullscreen is fully set up |
249 var heightAft = _this.$.height(); |
249 //so we add 500 delay |
250 |
250 setTimeout(function(){ |
251 if (_this.renkan.options.show_top_bar) { |
251 var widthAft = _this.$.width(); |
252 heightAft -= _this.$.find(".Rk-TopBar").height(); |
252 var heightAft = _this.$.height(); |
253 } |
|
254 if (_this.renkan.options.show_bins && (this.renkan.$.find(".Rk-Bins").position().left > 0)) { |
|
255 widthAft -= this.renkan.$.find(".Rk-Bins").width(); |
|
256 } |
|
257 |
|
258 paper.view.viewSize = new paper.Size([widthAft, heightAft]); |
|
259 |
|
260 _this.resize(_this.currentWidth, widthAft, _this.currentHeight, heightAft); |
|
261 |
|
262 _this.currentWidth = widthAft; |
|
263 _this.currentHeight = heightAft; |
|
264 |
|
265 paper.view.onResize = function(_event) { |
|
266 var newWidth = _event.size._width, |
|
267 newHeight = _event.size._height; |
|
268 var prevHeight = newHeight - _event.delta.height, |
|
269 prevWidth = newWidth - _event.delta.width; |
|
270 |
253 |
271 _this.resize(prevWidth, newWidth, prevHeight, newHeight); |
254 if (_this.renkan.options.show_top_bar) { |
272 }; |
255 heightAft -= _this.$.find(".Rk-TopBar").height(); |
|
256 } |
|
257 if (_this.renkan.options.show_bins && (this.renkan.$.find(".Rk-Bins").position().left > 0)) { |
|
258 widthAft -= this.renkan.$.find(".Rk-Bins").width(); |
|
259 } |
|
260 |
|
261 paper.view.viewSize = new paper.Size([widthAft, heightAft]); |
|
262 _this.resize(_this.currentWidth, widthAft, _this.currentHeight, heightAft); |
|
263 |
|
264 _this.currentWidth = widthAft; |
|
265 _this.currentHeight = heightAft; |
|
266 |
|
267 if (!Screenfull.isFullscreen) { |
|
268 paper.view.onResize = function(_event) { |
|
269 var newWidth = _event.size._width, |
|
270 newHeight = _event.size._height; |
|
271 var prevHeight = newHeight - _event.delta.height, |
|
272 prevWidth = newWidth - _event.delta.width; |
|
273 |
|
274 _this.resize(prevWidth, newWidth, prevHeight, newHeight); |
|
275 }; |
|
276 } |
|
277 }, 600); |
273 }); |
278 }); |
274 } else { |
279 } else { |
275 this.$.find(".Rk-FullScreen-Button").addClass("disabled"); |
280 this.$.find(".Rk-FullScreen-Button").addClass("disabled"); |
276 this.$.find(".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents").html(this.renkan.translate("Fullscreen not supported by your browser")); |
281 this.$.find(".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents").html(this.renkan.translate("Fullscreen not supported by your browser")); |
277 } |
282 } |