guides
guides copied to clipboard
Please need to know how to add initial guides as default value
Environments
- Framework name:
- Framework version:
- Component name:
- Component version:
- Testable Address(optional):
Description
I need to save the guides then with one click use them
@musta-sd
use defaultGuides
prop.
Can you please show me how to use it
@musta-sd
Based on react, it is as follows.
defaultGuides={useMemo(() => [0, 100, 200], [])}
When the defaultGuides change, the guides are updated.
What about vue ?
@musta-sd
Is it Vue3? Is it Vue2?
<template>
<Guides :defaultGuides="guides" />
</template>
<script>
setup() {
const guides = [0, 100, 200];
return {
guides,
};
}
// or
data() {
return { guides: [0, 100, 200] };
}
</script>
Vue3 With composition API , I used this example and it is showing me an error Uncaught TypeError: guides.map is not a function at __proto.renderGuides
@musta-sd
Can you show the code you used Guides on?
<div class="container">
<img
ref="imageTarget"
style="border: 1px solid #cccccc"
:src="sourceCurrent ?? sourceOriginal"
:alt="imageAlt"
@dragstart.prevent=""
@load="isImageReady = true"
/>
</div>
</div>
@musta-sd
guides1 and guides2 are used in ref.
ref="guides1", ref="guides2"
Try below code:
:defaultGuides="defaultGuides1"
:defaultGuides="defaultGuides2"
const defaultGuides1 = ref([0, 100, 200]);
const defaultGuides2 = ref([0, 100, 200]);
It is working Thank you so much. last question: I need to customize the lines color based on picker , i tried with css but it is not working
@musta-sd
https://daybrush.com/guides/release/latest/doc/Guides.html#.GuideOptions
@musta-sd
What you're looking for is like lineColor
. lineColor="#f55"
lineColor is for the ruler not the lines , i am using this for ruler
v-if="mediaStore.isReviewImageLineGuiding"
ref="guides2"
type="vertical"
displayDragPos="true"
:defaultGuides="defaultGuides1"
backgroundColor="#ca3639"
lineColor="#ffffff"
v-bind:rulerStyle="{
top: '30px',
height: 'calc(100% - 30px)',
width: '30px',
}"
v-on:changeGuides="onChange"
v-on:clickRuler="clickRuler"
@musta-sd
Are you talking about the color of the guidelines?
https://codesandbox.io/s/intelligent-heisenberg-9xn421?file=/src/App.vue
I updated the new version (0.3.4) of vue3-guides. Try updating the version and adding the following properties:
:guideStyle="{ backgroundColor: '#333' }"
Thank you brother