Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Not work properly with 'simplebar' #15

Open
dev-jonghoonpark opened this issue Sep 24, 2019 · 2 comments
Open

Not work properly with 'simplebar' #15

dev-jonghoonpark opened this issue Sep 24, 2019 · 2 comments

Comments

@dev-jonghoonpark
Copy link

dev-jonghoonpark commented Sep 24, 2019

Not work properly with 'simplebar'

the drag area is not holded when scroll.
drag area work like 'fixed'. so it select new item without old item.

simplebar : https://github.com/Grsmto/simplebar

for test you should install simplebar

npm install --save simplebar-vue

and this is the code for testing

<template>
  <div class="app">
    <h1>Vue Drag Select Example</h1>
    <simple-bar>
        <drag-select-container selectorClass="item">
          <template slot-scope="{ selectedItems }">
            <div
              v-for="item in 50"
              :key="item"
              :class="getClasses(item, selectedItems)"
              :data-item="item"
            >
              Item {{ item }}
            </div>
          </template>
        </drag-select-container>
    </simple-bar>
  </div>
</template>

<script>
import DragSelect from "vue-drag-select";

import SimpleBar from 'simplebar-vue';
import 'simplebar/dist/simplebar.css';

export default {
  name: "home",

  components: {
    SimpleBar,
    "drag-select-container": DragSelect
  },

  methods: {
    getClasses(item, selectedItems) {
      const isActive = !!selectedItems.find(selectedItem => {
        return parseInt(selectedItem.dataset.item, 10) === item;
      });

      return {
        item: true,
        active: isActive
      };
    }
  }
};
</script>

<style>
/* skiped other css in example */
.simplebar-wrapper {
    max-height: 500px;
}
</style>

thanks...

@stephan281094
Copy link
Owner

Hi there, thank you for taking the time to report this issue!

Looking through the documentation of simplebar, I noticed that it's not intended to be used on the body element. Currently, Vue Drag Select looks for scroll positions in the drag-select-container, falling back to document.body. It does not detect the scroll position in the parent (in this case the simplebar component).

I suppose we could add a prop that allows you to specify what scroll container to listen to. Would that work for you?

@dev-jonghoonpark
Copy link
Author

Yes. I think that would work to me.
thanks! :>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants