4949</template >
5050
5151<script >
52- import Platform from ' ../../features/platform'
5352import TouchPan from ' ../../directives/touch-pan'
5453import { cssTransform } from ' ../../utils/dom'
5554import { between , normalizeToInterval } from ' ../../utils/format'
5655import { start , stop } from ' ../../utils/animate'
5756import { getEventKey } from ' ../../utils/event'
5857import CarouselMixin from ' ./carousel-mixin'
5958import { QIcon } from ' ../icon'
59+ import FullscreenMixin from ' ../../utils/fullscreen-mixin'
6060
6161export default {
6262 name: ' q-carousel' ,
@@ -66,7 +66,7 @@ export default {
6666 directives: {
6767 TouchPan
6868 },
69- mixins: [CarouselMixin],
69+ mixins: [CarouselMixin, FullscreenMixin ],
7070 data () {
7171 return {
7272 position: 0 ,
@@ -217,44 +217,6 @@ export default {
217217 }
218218 })
219219 },
220- toggleFullscreen () {
221- if (this .inFullscreen ) {
222- if (! Platform .has .popstate ) {
223- this .__setFullscreen (false )
224- }
225- else {
226- window .history .go (- 1 )
227- }
228- return
229- }
230-
231- this .__setFullscreen (true )
232- if (Platform .has .popstate ) {
233- window .history .pushState ({}, ' ' )
234- window .addEventListener (' popstate' , this .__popState )
235- }
236- },
237- __setFullscreen (state ) {
238- if (this .inFullscreen === state) {
239- return
240- }
241-
242- if (state) {
243- this .container .replaceChild (this .fillerNode , this .$el )
244- document .body .appendChild (this .$el )
245- this .inFullscreen = true
246- return
247- }
248-
249- this .inFullscreen = false
250- this .container .replaceChild (this .$el , this .fillerNode )
251- },
252- __popState () {
253- if (this .inFullscreen ) {
254- this .__setFullscreen (false )
255- }
256- window .removeEventListener (' popstate' , this .__popState )
257- },
258220 stopAnimation () {
259221 stop (this .animUid )
260222 this .animationInProgress = false
@@ -298,8 +260,6 @@ export default {
298260 },
299261 mounted () {
300262 this .$nextTick (() => {
301- this .fillerNode = document .createElement (' span' )
302- this .container = this .$el .parentNode
303263 this .slidesNumber = this .__getSlidesNumber ()
304264 this .__planAutoPlay ()
305265 if (this .handleArrowKeys ) {
0 commit comments